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

[FR] Strict dependencies by groups #7421

Closed
2 tasks done
rockandska opened this issue Jan 27, 2023 · 3 comments
Closed
2 tasks done

[FR] Strict dependencies by groups #7421

rockandska opened this issue Jan 27, 2023 · 3 comments
Labels
status/duplicate Duplicate issues

Comments

@rockandska
Copy link

rockandska commented Jan 27, 2023

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

Seems that poetry, even if in dedicated groups, build the dependencies tree based on all groups.
Seems fair since, depending on your needs, you install just "lint" group, or "formatter" group or two groups, with main, without main, run those groups with only one python version in contrary to the package itself etc...
But, sometimes, it constrains the users and hit dependency hell even if they use a group only for test/lint etc... or doesn't let them use a recent version of a package because one of the packages require an old version for a cross dependency.
As an example, flake8 and its dependency on importlib-metadata < 5 who constrains many packages.

Having something similar as depends_on = [] for groups to let the lock file be built based on group dependency and let users have more flexibility would be really convenient.

As an example :

[tool.poetry.dependencies]
python = ">= 3.7, <= 3.11"

[tool.poetry.group.lint]
optional = true
# depends_on by default is [ 'main' ]
depends_on = []
           
[tool.poetry.group.lint.dependencies]
python = ">= 3.7, <= 3.8"
flake8 = "*"

[tool.poetry.group.typing]
optional = true
depends_on = [ 'main' ]

[tool.poetry.group.typing.dependencies]
mypy = "*"

In this example :

  • lint / typing are optional and not included in build
  • lint is only intended to be executed with python 3.7 or 3.8
  • typing is intended to be executed with the same python versions the project has
  • lint is isolated, so dependencies required by flake8 (importlib-metadata<5) doesn't influence other packages in other groups if they don't depend on lint
  • poetry install --with lint will fail because lint does not have main in depends_on
  • when doing poetry install --only typing, it will install main too since it depends on it

Hope it will see the light in poetry someday and other users will welcome this Feature Request.

Regards,

@rockandska rockandska added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jan 27, 2023
@neersighted
Copy link
Member

This is 80% a duplicate of #1168, and also touches on #5037. I think you're also mixing in a request for groups that get written to the wheel metadata -- currently only the main group can ever end up in the built metadata.

I'm going to close this as a duplicate, but feel free to ask questions about the other FRs and look for an issue for 'groups in metadata'/create a FR for that if it doesn't already exist.

@neersighted neersighted added status/duplicate Duplicate issues and removed kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jan 27, 2023
@rockandska
Copy link
Author

I already searched but was not able to found #5037 that is closer than #1168 in the goal expected.
And indeed, I mixed up the "optional" option with what is indeed included in metadata

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2023
Copy link

This issue 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
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

2 participants