-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Option to ONLY install extras from pyproject.toml #2052
Comments
Extras have a different purpose/semantics. And no installers would install them separately from the mandatory runtime deps. They are exposed to the end-users and are essentially a feature-flag like API. Also, pip-tools is not an installer but a constraint file generator. |
@webknjaz I understand what you are saying. I think I solved my problem using using the constraint arg (-c). Basically I am trying to generate a requirements-dev.txt file, but I want to make sure that the pinned dependencies from the requirements.txt file are used. This does what Im looking for. pip-compile --upgrade -o requirements/main.txt
pip-compile --upgrade -c requirements/main.txt -o requirements/dev.txt --extra=dev As per your comment about using extras in a pyproject.toml file to define dev dependencies. I think you are right, that should not be done in a installable library type project. However, in an application project, where code is simply being deployed, I dont see why you shouldn't define dev dependencies in the extra-dependencies section. As there really is no "end-user" of the application. |
I'd like to emphasize that extras are only defined in the context of distribution metadata. Any other use implies a distribution anyway. To address this separate use case, PEP 735 defines dependency groups that aren't going to end up in the distribution metadata and are tailored specifically to the use case you're describing. Meanwhile, keep having separate requirements files — they're made for this too, the difference is that they are pip-specific and PEP 735 is going to solve this in a generic cross-compatible tool-agnostic manner. |
What's the problem this feature will solve?
Being able to produce requirement files which only contain the extra dependencies in the pyproject.toml file.
Describe the solution you'd like
For a few of my python applications (not installable libraries) I am using pyproject.toml files to define the top-level dependencies. I like being able to define all of the dependencies within the pyproject.toml file, rather than using requirements.in files.
I would like to be able to create a requirements-dev.txt file based off the optional-dependencies in the pyproject.toml, but only the extra dependencies should be in the requirements-dev.txt file.
The text was updated successfully, but these errors were encountered: