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

support dependency groups #421

Closed
Roger-luo opened this issue Aug 20, 2023 · 6 comments
Closed

support dependency groups #421

Roger-luo opened this issue Aug 20, 2023 · 6 comments

Comments

@Roger-luo
Copy link

I think this is a very convenient feature that pdm and poetry has. When I try to make a package that may use CUDA, I need to have a dependency that depends on hardware configurations, and a package manager has no means to know that thus I believe the best way is to let users decide which group of dependencies they should install. This is like the features at the package level.

Currently, there is no way to specify both CPU and GPU dependencies with rye within one pyproject.toml, cargo also has something similar that allows one to specify dependencies based on the current crates' features. And I don't see a way of passing "extra"s in python's pyproject.toml (e.g pass the extra [cuda12] across packages) I hope this could be something rye can fix

@rbavery
Copy link

rbavery commented Mar 12, 2024

It also would be great to be able to build wheels by specifying dependency groups. I want to build a CPU version of my package that uses the CPU version of pytorch, and another that uses the GPU version and also installs a few other packages. poetry doesn't support this even though it has dependency groups.

@nikhilweee
Copy link
Contributor

nikhilweee commented Aug 7, 2024

Came here to say it would be nice to see this feature. Although I'm a bit confused as to what do we mean by dependency groups.

  1. Python projects already have a way of specifying extras under [project.optional-dependencies] in pyproject.toml. Is this what we are referring to?
  2. There's also a draft PEP-735 which is also called dependency groups. Although this talks about adding a top level [dependency-groups] table in pyproject.toml, amongst other things.

If we're referring to extras, I think rye already supports them. To add flask as an extra under the group web,

rye add flask --optional web

To add flask[async] as an extra / optional dependency under the group web,

rye add flask --features async --optional web

What's confusing is that if you need to do rye sync with the web extra included, you use --features instead of --optional.

rye sync --features web

@sirfz
Copy link

sirfz commented Sep 6, 2024

rye sync --features web

This actually doesn't work for me, must have something to do with a limitation in virtual packages (#639)

@jmcvetta
Copy link

jmcvetta commented Oct 18, 2024

It would be pretty cool if Rye produced a separate lockfile for each dependency group.

I.e. if we have a dependency group foobar, then running rye sync --features foobar will produce a lockfile requirements-foobar.lock.

Then in my Dockerfile it's super easy to install this dependency group, using the uv pip install technique recommended in the Rye docs.

RUN uv pip install -r requirements-foobar.lock

@sirfz
Copy link

sirfz commented Oct 18, 2024

I.e. if we have a dependency group foobar, then running rye sync --features foobar will produce a lockfile requirements-foobar.lock

Absolutely. Right now I resort to hacky solutions managing multiple pyproject files (or lock files) for each env (e.g. env with jax and another with torch -- these install different cuda dependencies so they don't play well with each other)

@Roger-luo
Copy link
Author

FYI. astral-sh/uv#8090 I think this can be closed as people/new features are moving to uv.

@Roger-luo Roger-luo closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2024
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

No branches or pull requests

5 participants