python-validators / validators

Python Data Validation for Humans™.
MIT License
977 stars 155 forks source link

Add python_requires='>=3.4' and yank previous releases dropping Python 2.7 #162

Closed vphilippon closed 4 years ago

vphilippon commented 4 years ago

Hello!

I've just noted that validators dropped Python 2.7 support at version 0.14.3. It seems it kept working in my case until 0.16.0. My luck I guess :)

Unfortunatly, the package doesn't fully properly declare the drop of Python 2.7, causing Python 2.7 system to keep trying to install it. The solution: Add python_requires='>=3.4' in the setup.py (https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires)

Another unfortunate aspect is that it's not possible to go back in time to add this metadata to 0.14.3, 0.15.0 and 0.16.0. The solution to this would be the new option to yank releases from pypi. In short, it prevents a package version from being automatically picked up by a pip install validators, but will keep that package version available for anyone specifically requesting with pip install validators==0.14.3 for instance. The best of both worlds :). The option should be available from the maintainer's UI. Ref: https://pypi.org/help/#yanked https://twitter.com/di_codes/status/1253166894158417926

Doing both of these would be sincerly greatly appreciated. I can send a MR for the python_requires='>=3.4' part, but the yank on pypi is necessary for keeping the ecosystem sane for system still depending on Python 2.7. Thanks!

kvesteri commented 4 years ago

Done 👍

vphilippon commented 4 years ago

@kvesteri Hello, thanks for that!

Unfortunatly, it seems like I something didn't go right, because pypi doesn't detect that validators 0.17.0 is for python>=3.4 only, so instead this fails at the pip install level. I've seen this happen when the release is done with some older tooling, rather than the latest version of twine.

Could you share how you made the upload, or try with the latest twine version if possible? (Note: I don't have much more time to investgate today myself, I should be able to check back on monday.)

Nicusor97 commented 4 years ago

Hello @kvesteri, I and Vincent are colleagues (working on the same project) and I want to know if you try to upload the tar.gz file using the latest version of twine as Vincent suggested. Also, if you will share how you made the upload will be useful for us to help you to investigate. (Our pipelines are still stuck because of this)

kvesteri commented 4 years ago

The package was uploaded using setuptools.

python setup.py sdist upload

Response:

running sdist
running egg_info
writing validators.egg-info/PKG-INFO
writing dependency_links to validators.egg-info/dependency_links.txt
writing requirements to validators.egg-info/requires.txt
writing top-level names to validators.egg-info/top_level.txt
reading manifest file 'validators.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files found matching 'docs/_themes/.git'
writing manifest file 'validators.egg-info/SOURCES.txt'
running check
creating validators-0.17.0
creating validators-0.17.0/docs
creating validators-0.17.0/tests
creating validators-0.17.0/tests/i18n
creating validators-0.17.0/validators
creating validators-0.17.0/validators.egg-info
creating validators-0.17.0/validators/i18n
copying files to validators-0.17.0...
copying CHANGES.rst -> validators-0.17.0
copying LICENSE -> validators-0.17.0
copying MANIFEST.in -> validators-0.17.0
copying README.rst -> validators-0.17.0
copying setup.py -> validators-0.17.0
copying docs/Makefile -> validators-0.17.0/docs
copying docs/conf.py -> validators-0.17.0/docs
copying docs/index.rst -> validators-0.17.0/docs
copying docs/make.bat -> validators-0.17.0/docs
copying tests/__init__.py -> validators-0.17.0/tests
copying tests/test_between.py -> validators-0.17.0/tests
copying tests/test_card.py -> validators-0.17.0/tests
copying tests/test_domain.py -> validators-0.17.0/tests
copying tests/test_email.py -> validators-0.17.0/tests
copying tests/test_extremes.py -> validators-0.17.0/tests
copying tests/test_iban.py -> validators-0.17.0/tests
copying tests/test_ipv4.py -> validators-0.17.0/tests
copying tests/test_ipv4_cidr.py -> validators-0.17.0/tests
copying tests/test_ipv6.py -> validators-0.17.0/tests
copying tests/test_ipv6_cidr.py -> validators-0.17.0/tests
copying tests/test_length.py -> validators-0.17.0/tests
copying tests/test_mac_address.py -> validators-0.17.0/tests
copying tests/test_md5.py -> validators-0.17.0/tests
copying tests/test_sha1.py -> validators-0.17.0/tests
copying tests/test_sha224.py -> validators-0.17.0/tests
copying tests/test_sha256.py -> validators-0.17.0/tests
copying tests/test_sha512.py -> validators-0.17.0/tests
copying tests/test_slug.py -> validators-0.17.0/tests
copying tests/test_url.py -> validators-0.17.0/tests
copying tests/test_uuid.py -> validators-0.17.0/tests
copying tests/test_validation_failure.py -> validators-0.17.0/tests
copying tests/i18n/__init__.py -> validators-0.17.0/tests/i18n
copying tests/i18n/test_es.py -> validators-0.17.0/tests/i18n
copying tests/i18n/test_fi.py -> validators-0.17.0/tests/i18n
copying validators/__init__.py -> validators-0.17.0/validators
copying validators/between.py -> validators-0.17.0/validators
copying validators/card.py -> validators-0.17.0/validators
copying validators/domain.py -> validators-0.17.0/validators
copying validators/email.py -> validators-0.17.0/validators
copying validators/extremes.py -> validators-0.17.0/validators
copying validators/hashes.py -> validators-0.17.0/validators
copying validators/iban.py -> validators-0.17.0/validators
copying validators/ip_address.py -> validators-0.17.0/validators
copying validators/length.py -> validators-0.17.0/validators
copying validators/mac_address.py -> validators-0.17.0/validators
copying validators/slug.py -> validators-0.17.0/validators
copying validators/truthy.py -> validators-0.17.0/validators
copying validators/url.py -> validators-0.17.0/validators
copying validators/utils.py -> validators-0.17.0/validators
copying validators/uuid.py -> validators-0.17.0/validators
copying validators.egg-info/PKG-INFO -> validators-0.17.0/validators.egg-info
copying validators.egg-info/SOURCES.txt -> validators-0.17.0/validators.egg-info
copying validators.egg-info/dependency_links.txt -> validators-0.17.0/validators.egg-info
copying validators.egg-info/not-zip-safe -> validators-0.17.0/validators.egg-info
copying validators.egg-info/requires.txt -> validators-0.17.0/validators.egg-info
copying validators.egg-info/top_level.txt -> validators-0.17.0/validators.egg-info
copying validators/i18n/__init__.py -> validators-0.17.0/validators/i18n
copying validators/i18n/es.py -> validators-0.17.0/validators/i18n
copying validators/i18n/fi.py -> validators-0.17.0/validators/i18n
Writing validators-0.17.0/setup.cfg
Creating tar archive
removing 'validators-0.17.0' (and everything under it)
running upload
Submitting dist/validators-0.17.0.tar.gz to https://upload.pypi.org/legacy/
Server response (200): OK
Nicusor97 commented 4 years ago

@kvesteri What version of setuptools are you using?

And also, why not using twine? From the official documentation of dropping older versions of Python: https://packaging.python.org/guides/dropping-older-python-versions/ , they are suggesting to use twine al least 1.9.

Using setuptools, somehow the pypi doesn't detect that validators 0.17.0 is for python>=3.4 only, so instead this fails at the pip install level. ERROR: Package 'validators' requires a different Python: 2.7.14 not in '>=3.4' I think the uploading process using twine should look like: ` $ pip install -U pip setuptools wheel twine

$ rm -rf dist/ build/

$ python setup.py sdist bdist_wheel

$ twine upload -r test dist/*

$ twine upload dist/* `

ThiefMaster commented 4 years ago

Looks like you broke something..

[adrian@claptrap:/tmp]> pip --version
pip 20.2 from /tmp/testenv/lib/python2.7/site-packages/pip (python 2.7)
[adrian@claptrap:/tmp]> pip install wtforms-components
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing /home/adrian/.cache/pip/wheels/02/6e/ab/142b4be0588c0e75f87fbcd5bad69ec6ef91795688e501ad3c/WTForms_Components-0.10.4-py2.py3-none-any.whl
Collecting validators>=0.5.0
  Using cached validators-0.17.0.tar.gz (28 kB)
ERROR: Package 'validators' requires a different Python: 2.7.18 not in '>=3.4'

I think you need to yank 0.17.0 as well and release 0.17.1 with the correct metadata. Not having used twine to upload may indeed have been the problem, but best to check with the folks in #pypa on freenode...

kvesteri commented 4 years ago

I just tried the following:

  1. Created new virtual environment with py3
  2. Installed latest version of validators using pip install validators

Everything went smoothly

ThiefMaster commented 4 years ago

This is a problem on Python 2.7, if a package pulls in validators with no max version restriction

kvesteri commented 4 years ago

Ok, re-uploaded new version 0.17.1 using twine. See if it helps

ThiefMaster commented 4 years ago

looks good, so once you yanked 0.17.0 it should work

kvesteri commented 4 years ago

yanked :+1:

ThiefMaster commented 4 years ago

works fine now, thanks!

vphilippon commented 4 years ago

Thanks for taking the time to fix this @kvesteri , this is really appreciated.

The good news is that you should be out of the Python 2 realm on this for good now! Enjoy it! 🍰