-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add allowlist/blocklist for packages to be permitted #10797
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
Comments
You can use a proxying index (something like simpleindex would probably work for this) to serve only the packages you want to make visible without storing the actual packages locally. Alternatively, you could probably use a constraints file, something like
This should work almost exactly the same as your whitelist/blacklist idea, and uses existing pip features. |
Any turtorial for both two ways? |
For constraints files, https://pip.pypa.io/en/stable/user_guide/#constraints-files |
For constraints files,can you offer an example? |
Sorry, no. The information I gave is all I have. You'll need to do some research yourself. |
A constraints file let's you implement a deny list and to some extent an allow list. Tou deny certain versions of a package with Maybe you can completely deny any version of a package with some syntax? e.g. Here's a very simple introduction to constraints files: https://luminousmen.medium.com/pip-constraints-files-b684992705b6 |
From my test,
constraint is
Why? |
You can't have * in a middle segment, only the ending. See PEP 440 for the details. |
Closing this out, since the "correct" answer here is doing this package blocking on the index server side of things. |
What's the problem this feature will solve?
As some packages have some problems like GPL license or bugs, i want to find a way to forbid user in my environment install them by pip.
Describe the solution you'd like
we can add a new section in pip.conf like
then when users in my environment to use
pip install xxx==1.1.0
, they will get a msg like "xxx is not available for the whitelist"Alternative Solutions
Right now , i only find that building my own pypi can work on it. But i need a lot of space to save the packages.
Additional context
In my opinion, it is efficient for us to limit on pip by a config. Just check and reject it if configured. It is a very elegant and simple way.
What i want is not building my own PYPI that will cause other problems like when to update,more space to save packages.
Code of Conduct
The text was updated successfully, but these errors were encountered: