Developing with Conda

To make packaging and publishing easier, we are using Poetry as our dependency and package manager. If you are used to Conda and still wish to use Conda instead or alongside Poetry as your package manager, there are a number of options.

Use a Conda environment as the virtual environment used by Poetry

When Poetry installs your package’s dependencies, it checks whether you are already in a virtual environment (including a Conda environment) and, if so, uses that as the virtual environment for your project. This means that you can use Poetry as a package manager from within a Conda environment.

For example, for this project, you could create a Conda env with just Python 3.9 installed:

$ conda create -n fmnp python=3.9 --no-default-packages
$ conda activate fmnp

You can then install the rest of the dependencies using Poetry:

(fmnp) $ poetry install

Running poetry env info will verify that you are using the Conda environment as your virtual environment:

(fmnp) $ poetry env info

Virtualenv
Python:         3.9.12
Implementation: CPython
Path:           /home/username/miniconda3/envs/fmnp
Valid:          True

Note that it is highly recommended that you do not use Conda to install any packages within this environment (except for Python itself), as this is likely to lead to dependency issues.

Just use Conda, do not use Poetry

If you do not wish to use Poetry at all, then that is fine too! A Conda environment file is provided and you can simply use this to install the project dependencies:

$ conda create -f environment.yml

Caution

Whilst this is fine for development, you will not be able to package or publish the project without relying on a different tool. In particularly, the project will not be installed as a package in editable mode, which may cause issues when running tests. If you add extra dependencies whilst developing the code, you will not be able to add these to the pyproject.toml file automatically via Poetry, and you won’t be able to build a poetry.lock file for other users to use. In short, if you will be adding dependencies, please use Poetry.