Skip to content

Manage dependencies with pixi - #407

Merged
maxrjones merged 33 commits into
developfrom
use-pixi
Mar 18, 2025
Merged

Manage dependencies with pixi#407
maxrjones merged 33 commits into
developfrom
use-pixi

Conversation

@maxrjones

@maxrjones maxrjones commented Jan 30, 2025

Copy link
Copy Markdown
Member

Moves from using conda environment files to using pixi to store all dependency information in pyproject.toml

Check out the updated contributing guide to get started.

TODO:

  • Update readthedocs build setup
  • Add quickstart to PR description
  • Set up environments for minimum and upstream tests
  • Update contributor guide
  • Check that release workflow doesn't need updating
  • Add release notes

Closes #310

@TomNicholas TomNicholas added CI Continuous Integration dependencies Updates a dependency labels Jan 30, 2025
@TomNicholas

Copy link
Copy Markdown
Member

At the risk of being really annoying, should we be switching to pixi or to uv here?

@maxrjones

maxrjones commented Mar 5, 2025

Copy link
Copy Markdown
Member Author

At the risk of being really annoying, should we be switching to pixi or to uv here?

It doesn't matter to me as long as we find a way to install all dependencies without using conda environment files. Pip installing h5py doesn't install the netcdf4/hdf5 C libraries which will give the user a module not found error when trying to use those readers. So, in this PR I use the conda distributions of those libraries in

VirtualiZarr/pyproject.toml

Lines 121 to 124 in a2b5461

[tool.pixi.feature.hdf5-lib.dependencies]
netcdf4 = ">=1.7.2,<2"
hdf5 = ">=1.14.4,<2"
h5netcdf = ">=1.5.0,<2"
Do you know if the wheels for the underlying C libraries are available via PyPI such that we could meet this goal using uv without pixi?

@TomNicholas

Copy link
Copy Markdown
Member

Thanks for the clarification.

There seem to be some wheels listed to download for all of these projects:

https://pypi.org/project/netCDF4/#files
https://pypi.org/project/h5py/#files
https://pypi.org/project/h5netcdf/#files

@maxrjones

Copy link
Copy Markdown
Member Author

There seem to be some wheels listed to download for all of these projects:

good to know, thanks. since this PR will really change the developer experience I'll just open RFC PRs for both pixi and uv and see which people prefer. Probably won't get to it until over the weekend though

@TomNicholas

Copy link
Copy Markdown
Member

Thank you @maxrjones ! Really appreciate your efforts here.

@maxrjones
maxrjones requested a review from a team March 17, 2025 15:09

@abarciauskas-bgse abarciauskas-bgse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'll let @TomNicholas provide official approval.

Comment thread docs/contributing.md
Comment thread docs/contributing.md Outdated
Comment thread docs/releases.rst
Comment thread pyproject.toml
'universal_pathlib @ git+https://github.com/fsspec/universal_pathlib',
'numcodecs @ git+https://github.com/zarr-developers/numcodecs',
'ujson @ git+https://github.com/ultrajson/ultrajson',
'zarr @ git+https://github.com/zarr-developers/zarr-python',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should zarr-python from github be an upstream dependency? I know it's also in default dependencies but just curious because zarr-python also a dependency of icechunk.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using Zarr's internal metadata classes in the develop branch, I think it's important to explicitly test for compatibility with the latest, unreleased changes in Zarr-Python.

Co-authored-by: Aimee Barciauskas <aimee@developmentseed.org>

@TomNicholas TomNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, I just have a couple of questions so I can understand the choices better.

Comment thread ci/min-deps.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What defines the min-deps dependencies now? The dependencies in the pyproject.toml?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's in pyproject.toml and defined is the combination of these dependency sets:

min-deps = ["dev", "hdf", "hdf5", "hdf5-lib"] # VirtualiZarr/conftest.py using h5py, so the minimum set of dependencies for testing still includes hdf libs

It's unfortunate the s3 (included as part of dev and the hdf libraries are required right now for running any tests (this was already the case) and would be good to refactor the conftest.py modules so this isn't the case.

I also added a line to the contributing guide showing how to list the installed environments.

Comment thread docs/contributing.md
Comment on lines +18 to +21
# Run all tests
pixi run --environment test run-tests
# Skip tests that require a network connection
pixi run --environment test run-tests-no-network

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it necessary to make running the tests a pixi thing, rather than just installing dependencies using pixi and then running tests using pytest directly?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a shorthand for running a command in a specified shell. I added a note on how to explicitly start a shell to run pytest in 86ff959 (#407)

Comment thread docs/contributing.md
pixi install --environment docs
pixi run build-docs
```
Pixi can also be used to serve continuously updating version of the documentation during development at [http://0.0.0.0:8000/](http://0.0.0.0:8000/).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's cool. Will that work with #486?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, unfortunately they'll have some merge conflicts to resolve but it uses the same sphinx-autobuild extension they reference.

@TomNicholas TomNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing @maxrjones thank you so much!

@maxrjones
maxrjones merged commit 81a760d into develop Mar 18, 2025
@maxrjones
maxrjones deleted the use-pixi branch March 18, 2025 00:35
@maxrjones maxrjones mentioned this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration dependencies Updates a dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use uv / pixi?

4 participants