Local build¶
We use a combination of conda
and poetry
.
Each on its own is more than enough; however, we often want to use packages that are only available in conda
.
Mixing environment manages like conda
and poetry
must be done with care.
This usually involves install all desired conda
packages and then using only poetry afterwards.
If you want to use a new conda
package down the road, you normally need to recreate the environment from scratch.
Steps¶
Installing conda¶
If you do not have conda
installed, follow the instructions here.
Note
We recommend using libmamba
instead of mamba
or classic conda
.
Conda environment¶
First, we setup a conda
environment inside the repository (.venv
).
Now we install our desired conda packages in one of two ways.
With this procedure, you can install any conda
packages desired.
First, activate the conda environment.
Add all relevant conda channels so they are exported to environment.yml
.
For example, we can add conda-forge
.
Install all desired packages; for example,
If needed, write a new conda-lock
file.
Poetry-tracked packages¶
After installing all conda
packages, we switch over to exclusively using poetry
.
The following command uses poetry
to install all packages specified in pyproject.toml
.
Add packages¶
To add dependencies using the poetry add
command, you need to first activate the conda environment.
Now you can run any poetry
commands within the local conda
environment.
For example, we can add numpy as a dependency:
After making any changes to pyproject.toml
you need to write a new poetry.lock
file.
Remember to deactivate the conda
environment once you are done.
pre-commit
¶
TODO: