Skip to content

fix: Remove '<4' from python_requires in packaging guide #850

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

matthewfeickert
Copy link
Contributor

As discussed in the discuss.python topic "Use of “less-than next-major-version” (e.g., <4) in python_requires (setup.py)" and other places there can be some side effects of adding <4 to a library's python_requires. This PR removes it, as requested by @njsmith in the discuss.python topic.

The section above the lines discussed in the topic that uses compatible release syntax is also removed given that ~=3.3 also enforces <4.

My apologies in advance if this was already discussed in an Issue and decided against (I didn't see any when I scrolled through) or in a previously closed PR. Please let me know if you'd like me to open an Issue to discuss this PR topic instead.

Tagging @pfmoore and @njsmith as they were the devs in the discuss.python topic and @NickleDave and @henryiii as they might be interested in this as well.

As discussed in https://discuss.python.org/t/use-of-less-than-next-major-version-e-g-4-in-python-requires-setup-py/1066
and other places there can be some side effects of adding `<4` to a
library's python_requires. This PR removes it, as requested in the
discuss.python question.

The section above the lines discussed in the topic that uses compatible
release syntax is also removed given that `~=3.3` also enforces `<4`.

Additional references of problems known to Matthew for posterity:

* Twitter threads:
  - https://twitter.com/HEPfeickert/status/1362170933658738701
  - https://twitter.com/nicholdav/status/1366978826790666240
* GitHub Issues:
  - python-poetry/poetry#3747
Copy link
Contributor

@henryiii henryiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind, unlike for libraries (where honestly this is still a poor idea for a general library pin), using Requires-Python causes pip to scroll back through history to find the first matching version that does not have a Requires-Python slot that does not include the current Python. This is never correct for a "future" version, but can only be used for the use case it was designed for - dropping a version that you used to support.

@webknjaz webknjaz merged commit 8fc99c8 into pypa:main Mar 3, 2021
@matthewfeickert matthewfeickert deleted the fix/remove-less-than-4 branch March 3, 2021 23:40
@matthewfeickert
Copy link
Contributor Author

Thanks very much for the fast review @pfmoore and @webknjaz!

@engnadeau
Copy link

For posterity, related to: nedbat/coveragepy#1021

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants