-
Notifications
You must be signed in to change notification settings - Fork 17
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
Use python_requires to force pip to not download if on python2 #20
Comments
Thank you for the explanation! |
You should probably issue a patch release with this ASAP, that way the python2 issue won't arise for others. |
I thought it was covered with your patch that has this line python_requires='>=3.4', |
Yes, but you need to release 0.8.1 with #21 for that to take effect. |
Also weirdly… warehouse has a pypi 0.8.1 but pypi legacy is still pointing to 0.8.0: https://pypi.python.org/pypi/allofplos Even though it has a 0.8.1 branch. And that 0.8.1 branch lacks a data-requires-python field on it's target: Example of what it should look like: Did you rebuild the package with a setuptools >=24? Also, it looks like you didn't distribute an sdist (which you should probably do for downstream packaging folks). |
This is ver setuptools I have:
|
You need to use
python_requires
in yoursetup.py
in order to restrict builds that occur viapip
which issues a query to PyPI.Below is a long explanation of what's happening and what you need to do, but the tldr is:
I installed allofplos on python2 with no difficulty, that's not supposed to happen.
What's wrong
I understand based on
That installing on python 2 (or even 3.3) is not supposed to be possible.
Unfortunately, it is. E.g., I installed allofplos on python 2:
A PR is forthcoming, specifically to add
python_requires >= 3.4
to yoursetup(…)
args & fix a couple of other things.Why
python_requires
worksWhen the package is being pulled down from PyPI if someone has
pip>=9
then it will check the python version before it downloads the file and if their version does not not matchpython_requires
.Why your current approach fails
Currently your only approach doesn't work for a subtle reason: it only catches people who run
python setup.py
directly or who have a really old version of pip. As mentioned in the talk linked below, everyone should be discouraged from runningpython setup.py
directly, but you've got the right thought to try to catch those that do catches for those who do).This also means you need another catch inside the
setup.py
in case someone tried to download it withpip
but their pip version is way less than 9.0.0.This is how we handle the pip version problem in IPython's setup.py:
This also requires that anyone building the package from source has a
setuptools >= 24.2.0
. If you don't want to make that a requirement on the actual library, then you'll need a different way to communicate that dependency (possibly with a dev_requirements.txt and a CONTRIBUTING.md?).Resources for learning more
I mentioned this to @eseiver, but in case she didn't pass it along there's a great talk on this here: https://www.youtube.com/watch?v=2DkfPzWWC2Q. 😉
If you'd prefer to read the docs though:
https://packaging.python.org/tutorials/distributing-packages/#python-requires
The text was updated successfully, but these errors were encountered: