Skip to content

Fix hatch matrix setup for minimal and optional dependencies #2872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 16, 2025

Conversation

maxrjones
Copy link
Member

I noticed after Martin's comment in #2774 (comment) that even the 'minimal' tests include optional dependencies including fsspec and universal_pathlib. I think it's worth only including the required dependencies and those necessary for running tests / type checking in the "minimal" test environment.

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Feb 27, 2025
@d-v-b
Copy link
Contributor

d-v-b commented Feb 27, 2025

sounds good to me

@maxrjones
Copy link
Member Author

Tests are failing because the environment name changed, I'll fix this in a bit

Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Very 👍 this

@maxrjones maxrjones marked this pull request as draft February 28, 2025 21:48
@maxrjones maxrjones changed the title Run minimal tests without fsspec, requests, aiohttp Fix hatch matrix setup for minimal and optional dependencies Apr 12, 2025
Comment on lines 150 to +158
[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "2.1"]
version = ["minimal"]

[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "2.1"]
features = ["optional"]
deps = ["minimal", "optional"]

[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "2.1"]
features = ["gpu"]
[tool.hatch.envs.test.overrides]
matrix.deps.dependencies = [
{value = "zarr[remote, remote_tests, test, optional]", if = ["optional"]}
]
Copy link
Member Author

Choose a reason for hiding this comment

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

I determined by looking at the old logs that there were no actual differences between the minimal and optional groups of the matrix. This override setup properly includes optional dependencies for the optional group and excludes them from the minimal group.

[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "2.1"]
features = ["gpu"]
Copy link
Member Author

Choose a reason for hiding this comment

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

We separately have the testgpu environment, so there's no need to include another gpu feature set in the regular test matrix. I removed it because it only makes the setup more confusing.

@@ -64,6 +64,7 @@ jobs:
run: |
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage
- name: Upload coverage
if: ${{ matrix.dependency-set == 'optional' && matrix.os == 'ubuntu-latest' }}
Copy link
Member Author

Choose a reason for hiding this comment

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

The minimal environment will have less coverage than optional, so there's no value in uploading it to codecov

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a downside to uploading it? I think it might be worth just keeping all the uploads to keep the complexity of this file down.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seemed to me a tradeoff between complexity in the workflow and complexity in understanding the codecov logs - https://app.codecov.io/gh/zarr-developers/zarr-python/commit/ebadec01e74acdd5bc3273be771c20a0f6a67cce. But not many people will interact with those logs so I can remove this line

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair - I tend not to look at the logs, but agree that it makes the logs a bit easier. Lets leave the line in and I'll merge 🚢

@maxrjones maxrjones marked this pull request as ready for review April 12, 2025 16:57
@maxrjones maxrjones requested a review from dstansby April 12, 2025 16:57
Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

For simplicity, I think might be worth keeping the codecov upload? Let me know what you think either way - otherwise this is looking 👍

@@ -64,6 +64,7 @@ jobs:
run: |
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage
- name: Upload coverage
if: ${{ matrix.dependency-set == 'optional' && matrix.os == 'ubuntu-latest' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a downside to uploading it? I think it might be worth just keeping all the uploads to keep the complexity of this file down.

@dstansby dstansby merged commit 5f49d24 into zarr-developers:main Apr 16, 2025
30 checks passed
@maxrjones maxrjones deleted the minimal-tests branch April 16, 2025 14:30
d-v-b pushed a commit to d-v-b/zarr-python that referenced this pull request Apr 20, 2025
…velopers#2872)

* Run minimal tests without fsspec, requests, aiohttp

* Retain existing test env names

* Use importorskip

* Specify which matrix config to upload codecov on

* Remove redundant gpu env

* Add obstore to min_deps definition

* Fix optional dependency set

* Add remote_tests set to doctest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs release notes Automatically applied to PRs which haven't added release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants