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

Treat default dependencies as main group #1785

Merged

Conversation

Lykos153
Copy link
Contributor

@Lykos153 Lykos153 commented Sep 2, 2024

Poetry documentation on dependency groups [1] says:
"The dependencies declared in tool.poetry.dependencies are part of an
implicit main group."

The current implementation does not account for that and in particular does not allow to skip installation of default dependencies like in one of
poetry install --without main
poetry install --only-root
poetry install --only othergroup.

This commit adds main as an implicit group and also adds it as a default value where applicable.

[1]
https://python-poetry.org/docs/managing-dependencies#dependency-groups

Closes #1578

Contribution checklist (recommended but not always applicable/required):

  • There's an automated test for this change
  • Commit messages or code include references to related issues or PRs (including third parties)
  • Commit messages are conventional - examples from the log include "feat: add changelog files to fixup hook", "fix(contourpy): allow wheel usage", and "test: add sqlalchemy2 test"

@Lykos153 Lykos153 marked this pull request as draft September 2, 2024 15:13
@Lykos153 Lykos153 force-pushed the feature/default-deps-main-group branch 6 times, most recently from 30ef3fe to 581b49d Compare September 2, 2024 17:31
@Lykos153
Copy link
Contributor Author

Lykos153 commented Sep 5, 2024

A more backwards compatible solution would be to add a flag like useDefaultDeps ? true. Though in this case the behavior is not completely obvious, because poetry also installs by default all groups that don't have optional = true.

@Lykos153 Lykos153 marked this pull request as ready for review September 5, 2024 11:38
@Lykos153
Copy link
Contributor Author

Lykos153 commented Sep 5, 2024

Marking as ready for review in order to get feedback on whether the approach in this PR would be accepted or if a flag as proposed in my last comment would be preferred.

@cpcloud
Copy link
Collaborator

cpcloud commented Oct 28, 2024

The initial approach here seems reasonable to me.

Poetry documentation on dependency groups [1] says:
  "The dependencies declared in tool.poetry.dependencies are part of an
implicit main group."

The current implementation does not account for that and in particular
does not allow to skip installation of default dependencies like in one
of
`poetry install --without main`
`poetry install --only-root`
`poetry install --only othergroup`.

This commit adds main as an implicit group and also adds it as a default
value where applicable.

[1]
https://python-poetry.org/docs/managing-dependencies#dependency-groups

Closes nix-community#1578
@cpcloud cpcloud force-pushed the feature/default-deps-main-group branch from c779b19 to a269d29 Compare October 28, 2024 12:44
@cpcloud cpcloud merged commit caddf14 into nix-community:master Oct 28, 2024
188 checks passed
@cpcloud
Copy link
Collaborator

cpcloud commented Oct 28, 2024

Thanks!

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

Successfully merging this pull request may close these issues.

Default dependencies should work as if they were in main group
2 participants