Skip to content

Dependency groups - #4260

Merged
sdispater merged 6 commits into
masterfrom
dependency-groups
Jul 23, 2021
Merged

sdispater merged 6 commits into
masterfrom
dependency-groups

Conversation

@sdispater

Copy link
Copy Markdown
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
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2021

Copy link
Copy Markdown

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

Comment thread docs/managing-dependencies.md Resolved
not_found = set(packages).difference(removed)
if not_found:
raise ValueError(
"The following packages were not found: {}".format(

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

lock-version = "1.1"
python-versions = "*"
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
content-hash = "178f2cd01dc40e96be23a4a0ae1094816626346346618335e5ff4f0b2c0c5831"

Copy link
Copy Markdown
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 force-pushed the dependency-groups branch from 60159be to 5c5af42 Compare July 23, 2021 09:50
@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
1 of 2 tasks
@br3ndonland br3ndonland mentioned this pull request Aug 3, 2021
2 tasks done
@uSpike uSpike mentioned this pull request Aug 7, 2021
@Cielquan Cielquan mentioned this pull request Nov 29, 2021
2 tasks done
@neersighted neersighted mentioned this pull request Sep 6, 2022
2 tasks done
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/pyproject-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
@github-actions

Copy link
Copy Markdown

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