Skip to content
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

Dependency groups #4260

Merged
merged 6 commits into from
Jul 23, 2021
Merged

Dependency groups #4260

merged 6 commits into from
Jul 23, 2021

Conversation

sdispater
Copy link
Member

This PR adds support for dependency groups to have a more granular organization of dependencies.

For a complete list of changes and improvements you can refer to the updated documentation in this PR.

Pull Request Check List

Resolves: #1644

  • Added tests for changed code.
  • Updated documentation for changed code.

@sdispater sdispater added area/solver Related to the dependency resolver area/installer Related to the dependency installer kind/feature Feature requests/implementations labels Jul 7, 2021
@sdispater sdispater added this to the 1.2 milestone Jul 7, 2021
@sdispater sdispater requested a review from a team July 7, 2021 18:24
@sdispater sdispater force-pushed the dependency-groups branch 3 times, most recently from 2d453e0 to 60159be Compare July 7, 2021 19:48
@sonarcloud
Copy link

sonarcloud bot commented Jul 7, 2021

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
30.9% 30.9% Duplication

not_found = set(packages).difference(removed)
if not_found:
raise ValueError(
"The following packages were not found: {}".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"The following packages were not found: {}".format(
f"The following packages were not found: {', '.join(sorted(not_found))}"

"""
Removing without specifying a group removes packages from all groups.
"""
installed.add_package(Package("foo", "2.0.0"))
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about maybe creating constants for the strings baz, foo, 1.0.0, and 2.0.0, since they are repeated so often?

If you agree, you will need to change the other test files that use these same values.

installer.with_groups(["dev"])
installer.run()

assert 0 == installer.executor.installations_count
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe create a constant for the value 0?

@@ -86,7 +86,7 @@ def test_lock_file_data_is_ordered(locker, root):
[metadata]
lock-version = "1.1"
python-versions = "*"
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
content-hash = "178f2cd01dc40e96be23a4a0ae1094816626346346618335e5ff4f0b2c0c5831"
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be interesting to create a constant for content-hash. Here we see an example that if it had a constant, it would not be necessary to make 7 changes to the same value.

@sdispater sdispater merged commit 0768be1 into master Jul 23, 2021
@sdispater sdispater deleted the dependency-groups branch July 23, 2021 10:00
@finswimmer finswimmer mentioned this pull request Aug 3, 2021
2 tasks
@br3ndonland br3ndonland mentioned this pull request Aug 3, 2021
2 tasks
@uSpike uSpike mentioned this pull request Aug 7, 2021
@neersighted neersighted mentioned this pull request Sep 6, 2022
2 tasks
mpeteuil added a commit to mpeteuil/poetry-dotenv-plugin that referenced this pull request Jul 16, 2023
Poetry first switched from dev dependencies [to dependency groups](python-poetry/poetry#4260) in
version
[1.2.0a2](https://github.com/python-poetry/poetry/blob/master/CHANGELOG.md#120a2---2021-08-01). The dev dependencies are currently deprecated and will be removed at some point, so this change switches to the new groups configuration.

For more information about dependency groups, see [the section in the
official documentation](https://python-poetry.org/docs/master/managing-dependencies#dependency-groups).
lukehsiao added a commit to lukehsiao/poetry-udeps that referenced this pull request Aug 8, 2023
Poetry 1.2+ includes a new organization for dev dependencies.
This patch checks both locations, starting with the pre-1.2 location.

Ref: python-poetry/poetry#4260
Closes: #1
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/installer Related to the dependency installer area/solver Related to the dependency resolver kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support dependencies groups
3 participants