-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Install requirements from pyproject #13616
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
Conversation
|
Hey @ja2142 thanks for opening a PR against pip. There are some important design questions to consider on if this is the right choice of design from both a UX perspective (same flag or a different flag as Please be aware all maintainers are currently volunteers, so we don't tend to have a lot of time to spend on pip, and it may be quite some time before any of weighs in on this. |
|
Thanks for a response. I lean slightly towards As far as I understand from discussion on #11440, there is no way to get dependencies from the build system with a guarantee that build (or part of build) won't be invoked, which would likely result in a failure when used in a container with just pyproject.toml. Reading comments on #11440, it seems that reading |
|
Could you support pip install -r pyproject.toml[test,mypy] |
|
With not only optional-dependencies but also dependency-groups, I feel this needs a separate flag than to overload |
I don't see why? Optional dependencies can probably be easily and consistently supported like they are elsewhere, like in @rexzhang's example. I'm not that familiar with dependency groups, but it seems like installing just a group is already possible, for example:
only installs somegroup, not the package itself. So it's unclear to me what would need to be done here. One minor issue I see is that:
right now would install deps from #11440 also mentioned installing just build dependencies, but it sounds like it should just be a separate flag that works independently of
By the way, judging by the names (test, mypy) these sound like development dependencies. If they are, these should probably be dependency groups instead of optional dependencies. Doesn't mean optional dependencies shouldn't be supported, I'm just nitpicking that a better example would be something like:
|
|
I don’t think your minor issue is minor at all. Also note that you can supply both One possible design is to allow specifying paths to pyproject.toml as positional arguments instead, which is unambigious. That leaves an awkward issue to |
You mean going back to original proposal, something like
Isn't that
I don't see any issue with positionals, it's only with |
Your statement here is confusing, and that might reflect a lack of understanding on your part. Pip doesn't install If you want to read a list of requirements from a file in a different format, you should use a new option. That's what the I'm a strong -1 for trying to cram this functionality into the I don't actually find the arguments for this feature very compelling in any case. In nearly every realistic case I've seen, the list of requirements would be better recorded as a dependency group - certainly that's the case for those that use extras. And for the case of installing just the project's dependencies without the project itself, doing that properly requires calling the build backend - reading Basically, this PR doesn't feel like a simpler way of addressing the use case Footnotes |
|
I agree that overloading I think a unambiguous flag for what this PR does would need to be something like However, IMO, it also makes clear it's probably too specific to for pip flags, and rather what would be more general would be a Thanks for your PR @ja2142 but I don't think this design is going to be accepted so I'm going to close the PR to make that clear. I'm not stopping discussion, but I think if a new design is pursued it should be a new PR. |
closes #11440 ?
This is more of a proof of concept, I can try improving it and adding tests if this approach is deemed to be ok.
Since actual
--only-depsoption opens up a lot of rabbit holes (when installing anything other than.) and installing only dependencies of some remote package for example doesn't seem to be useful to me, this PR just handles dependencies from pyproject.toml in -r, e.g.pip install -r pyproject.toml.I guess this is technically a breaking change, but I don't know what kind of person keeps their requirements in non-toml format in a file named pyproject.toml.
-r pyproject.tomlis also apparently what uv already does.Only main dependencies (the ones in project.dependencies) are handled (for now?). Trying to do
install -r pyproject.tomlon pyproject with dynamic dependencies results in an error.As is, I believe this PR is enough to address at least my use case for this: it allows caching dependency layers in docker easily, without additional tools.