question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modernizing the codebase after Python 2

See original GitHub issue

Looking 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:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
obi1kenobicommented, Jan 24, 2021

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 the mypy config via typing_copilot: https://github.com/obi1kenobi/typing-copilot

It is a tool designed to help projects gradually move toward strict mypy compliance: it auto-detects the strictest passing mypy 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. With typing_copilot, you can set up a CI check enforcing that any time the mypy 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 supporting pip’s vendorized dependencies would require some additional configuration functionality in typing_copilot, I’d be happy to add that functionality if it would be useful to the pip project or other core Python ecosystem tools.

I’d also be happy to help improve the mypy config used in pip, including helping resolve #9502 itself.

Thanks for all your hard work building and maintaining pip!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found