Modernizing the codebase after Python 2
See original GitHub issueLooking forward into the post-Python-2-support world (i.e. post pip 20.3), we’re going to want to modernize pip’s codebase. That’s going to involve a lot of things.
Consider this issue an attempt to try to create a singular location, to create the list of all of the things we’d want to free from the chains of maintaining Python 2 support. 😃
- Cleanup the mypy configuration.
- Enum usage.
- Drop
__ne__
when not needed. - Drop Python-2 compatibility-related vendored modules.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to upgrade a Python 2 codebase to Python 3 - Medium
In this article, you have learned how to upgrade a Python 2 codebase to Python 3. There are three stages, namely modernization (Stage...
Read more >How To Upgrade Your Codebase To Python 3 from Python 2.x
Python can be upgraded gradually, without replacing your entire codebase with something new in one go. Doing so is way too much work...
Read more >Porting Python 2 Code to Python 3 — Python 3.11.1 ...
Use Futurize (or Modernize) to update your code (e.g. python -m pip install future ). Use Pylint to help make sure you don't...
Read more >Guide to Migrating from Python 2(Legacy) to Python 3
python-modernize is a utility based on 2to3, but uses six as a runtime dependency to give out a common subset of code running...
Read more >How we retired Python 2 and improved developer happiness
In 2018, LinkedIn embarked on a multi-quarter effort to fully transition to a Python 3 code base. After approximately two quarters of ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
While looking into the “cleaning up the mypy config” task mentioned here, I happened to come across an issue with how
mypy
is being used, so I opened #9502. In particular, I found that issue by attempting to improve themypy
config viatyping_copilot
: https://github.com/obi1kenobi/typing-copilotIt is a tool designed to help projects gradually move toward strict
mypy
compliance: it auto-detects the strictest passingmypy
config for the current state of the codebase, and can then set up a “ratcheting” mechanism for type correctness where type quality can only improve in the future. Withtyping_copilot
, you can set up a CI check enforcing that any time themypy
configuration can be made stricter, it is done so — tightening the ratchet whenever possible.I am the maintainer of
typing_copilot
, and while it is a relatively young tool, it is already being used across more than 100kLOC of Python across a few projects. While supportingpip
’s vendorized dependencies would require some additional configuration functionality intyping_copilot
, I’d be happy to add that functionality if it would be useful to thepip
project or other core Python ecosystem tools.I’d also be happy to help improve the
mypy
config used inpip
, including helping resolve #9502 itself.Thanks for all your hard work building and maintaining
pip
!That’s in-progress. 😃
https://github.com/pypa/pip/pulls?q=is%3Apr+sort%3Aupdated-desc+complete+type+annotations