diff --git a/package-structure-code/declare-dependencies.md b/package-structure-code/declare-dependencies.md index 2d43c792..f8aebb55 100644 --- a/package-structure-code/declare-dependencies.md +++ b/package-structure-code/declare-dependencies.md @@ -406,10 +406,8 @@ dependencies = [ :::{todo} -### Using conda and pixi +### Using conda and Pixi -::::{todo} -Ask Matthew to review this section... ::: The `pyproject.toml` file works great for pure-Python packages. However, @@ -423,64 +421,41 @@ You can maintain an `environment.yml` file to help users and contributors set up conda environments. This is especially useful for packages with system-level dependencies like GDAL. -**Consider pixi for conda workflows:** +**Consider Pixi for conda package focused workflows:** + +[Pixi](https://pixi.sh) is a modern package manager built on top of both +the conda and Python package ecosystems. +Pixi is able to treat conda and Python package requirements with parity when +resolving environments, but uses a "conda-first" approach of using already +resolved conda packages if possible when resolving Python dependencies. +Pixi [can also use `pyproject.toml` for configuration](https://pixi.sh/latest/python/pyproject_toml/). +If your project relies heavily on conda packages, Pixi offers a streamlined +workflow with faster dependency resolution and automatic lock file support for +full environment reproducibility. +If you already have an existing conda environment definition file, like +an `environment.yml`, you can +[import the environment](https://pixi.sh/latest/tutorials/import/) into a new +Pixi workspace with -[Pixi](https://pixi.sh) is a modern package manager built on conda that -uses `pyproject.toml` for configuration. If your project relies heavily -on conda packages, pixi offers a streamlined workflow with lockfiles and -faster dependency resolution. +``` +pixi init --import environment.yml +``` :::{admonition} A note for conda users :class: tip If you use a conda environment for development and install your package -with `python -m pip install -e .`, dependencies will be installed from -PyPI rather than conda. This can cause conflicts, especially for packages -with system dependencies. +with `python -m pip install -e .` dependencies will be installed from PyPI, +potentially overwriting conda packages that had already been installed. +This can cause conflicts, especially for packages with system dependencies. To avoid this, install your package without dependencies: -`python -m pip install -e . --no-deps` - -Then install dependencies through your conda environment.yml file. -::: -:::: - -### Using conda and pixi - -:::{todo} -Ask matthew to review this section... -::: - -The `pyproject.toml` file works great for pure-Python packages. However, -some packages (particularly in the scientific Python ecosystem) require -dependencies written in other languages like C or Fortran. Conda was -created to support the distribution of tools with non-Python dependencies. - -**For conda users:** - -You can maintain an `environment.yml` file to help users and contributors -set up conda environments. This is especially useful for packages with -system-level dependencies like GDAL. - -**Consider pixi for conda workflows:** -[Pixi](https://pixi.sh) is a modern package manager built on conda that -uses `pyproject.toml` for configuration. If your project relies heavily -on conda packages, pixi offers a streamlined workflow with lockfiles and -faster dependency resolution. - -:::{admonition} A note for conda users -:class: tip - -If you use a conda environment for development and install your package -with `python -m pip install -e .`, dependencies will be installed from -PyPI rather than conda. This can cause conflicts, especially for packages -with system dependencies. - -To avoid this, install your package without dependencies: -`python -m pip install -e . --no-deps` +``` +python -m pip install -e . --no-deps +``` -Then install dependencies through your conda environment.yml file. +Then install dependencies through your conda `environment.yml` file. ::: ## Dependencies in Read the Docs