Skip to content

Hatch environments support PEP735 dependency-groups #1922

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

djcopley
Copy link
Contributor

Closes #754
Closes #1852

@djcopley djcopley force-pushed the hatch-dependency-groups branch 4 times, most recently from 4528af3 to f987adb Compare March 4, 2025 01:36
djcopley added 2 commits March 4, 2025 10:21
Dependency groups have no impact on binary distributions so moved to build frontend.
Copy link
Contributor

@funkyfuture funkyfuture left a comment

Choose a reason for hiding this comment

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

thank you for your effort on this. i left a few notes regarding the user documentation and hope to find some time soon for a deeper look.

maybe the PA's usage guide reg. the dependency groups could also be linked somewhere: https://packaging.python.org/en/latest/specifications/dependency-groups/

Comment on lines +152 to +159
[tool.hatch.envs.test]
dependency-groups = ["test"]

[tool.hatch.envs.lint]
dependency-groups = ["lint"]

[tool.hatch.envs.dev]
dependency-groups = ["dev"]
Copy link
Contributor

Choose a reason for hiding this comment

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

i can imagine that a completely reflected use-case would be preferable here. i don't know the current affairs reg. user documentation guidelines, maybe @lwasser has some advice.

dependencies = [
"coverage[toml]>=7.0.0",
]
# Project dependencies will be included if not skip-install and in dev-mode
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't really get what this wants to tell me; it seems to be suited for a sentence or two outside the example snippet.

Comment on lines +125 to +127
!!! note
Unlike features which affect how the project itself is installed, dependency groups are separate dependencies that are installed alongside the project.

Copy link
Contributor

Choose a reason for hiding this comment

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

if the point here is to point out that dependency groups are no direct project dependencies, i think that aspect can be included in one of the prior paragraphs.

Copy link
Contributor

@flying-sheep flying-sheep left a comment

Choose a reason for hiding this comment

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

Dependency groups exist to be exactly what hatch’s env dependencies are, so I don’t like the indirection of making an env refer to dependency groups to install.

I think we should do more that simply support them, we should actually integrate them: #1852 (comment)

So I propose that we change hatch to actually collect the list of defined dependency groups and merge it with the list of hatch envs (each dependency group implicitly defines a hatch env, and each hatch env implicitly installs its corresponding dependency group). @ofek should weigh in here.

Imagine: if dependency groups would have existed when designing hatch, would they be used like I propose? I think yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants