-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] pip options in extra_requires #4928
Comments
Proposed solutionIn Since those lines are not valid packages, Potential fix In
Not sure how to create a pytest test to cover the situation of a project with requirement.txt containing a dependency which is locally hosted. |
In the meantime, after pip-compile and before calling To install the package
|
Hi @msftcangoblowm thank you very much for opening this issue e for the initial investigation. Please note however that this is a documented limitation instead of a bug. In the docs page you can read:
So I am reclassifing this as a feature request instead of a bug. |
From setuptools POV can understand and accept, as a documented limitation, is considered a FR. Arguments forWould like to advocate for this feature, so laying out the arguments, eventhough it's not news. There are other perspectives:
Counter arguments
These require system services: pypiserver or dumb-pypi this requires nothing but a folder and no additional dependencies.
|
Setuptools is a build backend. Its purpose is to create an artifact with spec-compliant metadata. It is not an installer and has no ability to know where the deps are coming from. Similarly, the installers can only see the abstract names of the deps. And installers can decide where to get the deps. Build backends are an absolutely incorrect place for storing/processing/special-casing settings of arbitrary build front-ends. This separation is standardized and exists for a reason. Start at PEP 517 to understand more. |
This is not a build backend build frontend issue. The build backend is setuptools.build_meta Not passing any config settings to a custom build backend and/or thru to the build front end subprocess. setuptools requirements parsing is crashing when encountering garbage requirements lines. Would merely like to filter out the garbage before setuptools requirements parsing occurs. This is not an add support request it's to gracefully ignore all options appearing in requirements files. The status quo of do nothing results in setuptools being a dedicated tool for pypi.org only. |
A way to reframe this is consider any requirement line beginning with So this FR is build front end agnostic. Is this chain of thought acceptable? There is no package named Sorry this FR did not start off by proposing requirements lines starting with |
Not really. Pip settings don't get into core packaging metadata. I think I missed that you were talking about a specific feature of setuptools loading the entries from pip-specific requirement files. So it might make sense to look into disregarding those flags on parsing. Another way would be declaring this unsupported and telling people to restructure layering of the requirement files in a way that allows pointing to files that don't include pip flags. Arguably, your setuptools config should be loading entries of |
load .in instead of .txt
package The workflow is:
Believe i'm the only person on the planet using A package will use both
A package author chooses which, to use, for what. When a dependency package has dodgy/misbehaving transitive dependencies, those can be thrown into separate venv. Example commands to render
Assumes pyproject.toml has those three venv configured and a declaring this unsupportedThis is equivalent to There is no third option. A package contains only dependencies and optional-dependencies. Using only make sense to look into disregarding those flags on parsingLets do this. Pretty please. Treat Can i get consensus that this is the way to move forward. |
Hi @msftcangoblowm thank you for the clarifications. I think I understand your motivations and how it would help to move your use case forward. However we also need to consider 2 points:
With that in mind, I believe that would be best to explore some of the other options mentioned by @webknjaz, for example:
Can you have 2 files, one without the flags intended to be consumed by |
if setuptools would cooperate by allowing two sets of dependencies and optional-dependencies. One setuptools safe. And current pair consumed by build front ends that can include build front end options. With two sets of dependencies and optional-dependencies, For example
How would setuptools find the safe requirements files during If setuptools says yes. I am willing to retool Lets call this
If
The advantage of |
setuptools version
setuptools==77.0.3
Python version
Python 3.9
OS
Void Linux
Additional environment information
packaging==24.2
pip==25.0.1
pip-tools==7.4.1
Description
When hosting
.whl
locally or on a warehouse, besides pypi.org, how to inform pip where to search for those packages:cli provided options
--find-links
--extra-index-url
or--index-url
$HOME/.pip/pip-conf
requirements.txt
fileWhen
.whl
are hosted locally or on non-pypi.org warehouses,pip-compile
will insert lines looking like,--extra-index-url http://localhost:8080/simple/
setuptools.dist.Distribution._normalize_requires
does not filter out those lines!Then
packaging.requirements.Requirement.parse
does not recognize those lines as packages.other reports
wreck#30
packaging#884
Expected behavior
setuptools.dist.Distribution._normalize_requires
, filter out (sourced from config file) lines that start with--find-links
--extra-index-url
or--index-url
.Avoiding
packaging.requirements.Requirement
raising a packaging.requirements.InvalidRequirement exception.How to Reproduce
$HOME/.pip/pip-conf
filepip-compile -o requirements.in requirements.txt
requirements.in
requirements.txt
pyproject.toml
.whl
filespackagenotonpypiorg.whl
python -m build
a project withrequirement.txt
containing a dependency only hosted locally.build
askssetuptools
to search for packages. Firsthttp://localhost:8080/simple/
thenpypi.org
setuptools.dist.Distribution._normalize_requires
does not filter out warehouse location lines.packaging.requirements.Requirement
does not recognize those lines as packages.In this example, a local pypiserver is configured. When
python -m pip install
runs, the--extra-index-url
option is necessary to find locally hosted .whl (packages). Which is great forpip
, not so great forpython -m build
.Output
The text was updated successfully, but these errors were encountered: