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

Allow extras to specify different versions of dependencies #9194

Closed
Gattocrucco opened this issue Mar 21, 2024 · 3 comments
Closed

Allow extras to specify different versions of dependencies #9194

Gattocrucco opened this issue Mar 21, 2024 · 3 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@Gattocrucco
Copy link

Issue Kind

Brand new capability

Description

I want to define an extra for my package that pins specific versions of some dependencies, without affecting dependency resolution when it is not used.

My use case: I'm writing a library that depends on jax. I want to define an extras metal that installs jax-metal to support Apple GPUs. However, jax-metal requires a specific version of jaxlib. Since jax updates frequently, it is limiting to force a certain version of jax even when the extra is not used.

Possible way the thing could look like:

[tool.poetry.dependencies]
jax = "^0.4.22"
jaxlib = "^0.4.22"
jax-metal = { version = "0.0.6", optional = true }

[tool.poetry.extras]
metal = [
    "jax-metal",
    { change-dependency = "jaxlib", version = "0.4.22" },
]

Would it be possible at all to do this? Or is it blocked by the way pip itself handles extras in packages it installs?

Impact

I've found someone having a similar problem on this stackoverflow thread. They made a plugin, but 1) it seems unmaintained and a bit messy, so I don't trust depending on it, 2) it works at the level of installing groups, so not for the extras in my final released package.

I guess there are other people with similar needs, but I don't know how many.

Workarounds

Workarounds I know of:

  • Create a separate package for my library with different dependencies
    • Time-consuming for me
  • Ask users to install jax-metal themselves following instructions
    • Time-consuming for users
    • Annoying for me because I can't use poetry to install things on my development copy
@Gattocrucco Gattocrucco added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Mar 21, 2024
@dimbleby
Copy link
Contributor

basically a special case of #6419

@Gattocrucco
Copy link
Author

Ah thanks! I missed that. Closing this.

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 Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants