pyupgrade
placeholder
Our great sponsors
pyupgrade | placeholder | |
---|---|---|
23 | 9 | |
3,326 | 667 | |
- | - | |
7.9 | 4.6 | |
15 days ago | 4 months ago | |
Python | Python | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pyupgrade
-
A Tale of Two Kitchens - Hypermodernizing Your Python Code Base
pyupgrade and flynt are examples of tools that modify your code base from earlier python versions into the newest python syntax, rewriting all string formats into f-strings and similar things.
-
Conversion from the f-string literals to format method in python
pyupgrade - A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
-
Which is your favourite or go-to YouTube channel for being up-to-date on Python?
He made yesqa and pyupgrade (among others), and also works on flake8. His main job is for https://sentry.io/.
-
Reasons Python Sucks
That's a decade to make a 30 second change. Add something like https://github.com/asottile/pyupgrade to your pre-commit hooks and you won't even need 25 of those seconds.
-
Is there a way to convert python 2 to 3 without finding every single line and fix it?
There is also pyupgrade: https://github.com/asottile/pyupgrade
-
I've recently learned about better support for type-hinting. What other 'best practices' have been introduced in Python 3.10 or newer?
pyupgrade is a useful tool that can help you find some of these things.
-
Flake8 took down the gitlab repository in favor of github
and last a little plug or two -- because I do this all for free and despite millions benefiting I receive zero proportional benefit from the maintenance work I put in -- consider sponsoring or maybe check out pre-commit.ci which would have automatically fixed this problem for you a year and a half ago
-
Django upgrade services?
Running https://github.com/adamchainz/django-upgrade with https://github.com/asottile/pyupgrade recursively will give an idea about how much work is there on Django side. Still, there may have dependency on third party libraries (both django+python). Another thing to consider is which role Django performing here, serving APIs or html views. As good test coverage is already there, you are on lucky side.
-
It’s Time to Say Goodbye to These Obsolete Python Libraries
Such goodness here and even points to an interesting project I’d never heard of for automated “de-deprecation”
https://github.com/asottile/pyupgrade
-
Is there a linter which would suggest using elif rather than an else in an if clause?
I do would like to recommend pyupgrade. Just pip install as expected and then run pyupgrade --py310-plus to drag your code kicking and screaming into $CURRENT_YEAR. Or at least into whatever version you're using :)
placeholder
-
Gnome developer proposes removing the X11 session
This guy wasn't maintaining Python, he as creating a new version incompatible with either Python 2.7 or Python 3.
Red Hat and other large companies have maintained Python for years after 2.7 died (EOL date was January 1st, 2020). IBM/Red Hat offer Python 2.7 including security fixes and bug fixes until 2024 (https://access.redhat.com/solutions/4455511).
Had he just provided patches to Python 2.7, nobody would've batted an eye. Instead, they created an alternative language that was completely different (https://web.archive.org/web/20161210161837/https://www.nafta...).
Founders and core devs indicated that the name was the only problem (https://github.com/naftaliharris/tauthon/issues/47#issuecomm...) and that even things like the header file names could continue to be named Python because of API compatibility.
You can fork any open source project you like, but you still need to stick follow trademark law. You can't just release Linux 2.7 because you disagree with breaking changes in 3.0 either, but you're free to take the Linux code and release Twonux if you really care.
-
Debian 12 python2 install
If that doesn't work for some reason, there's this project which claims to be an "active" fork of Python 2, but it also has a lot of backports and additions so I worry a bit about backward compatibility and stability: https://github.com/naftaliharris/tauthon You would have to build this from source as well.
-
Don't carelessly rely on fixed-size unsigned integers overflow
Without developers of the compilers all others groups are pretty much irrelevant. There were lots of people who were telling that Python3 is abomination and some even attempted to fork it but fork haven't caught enough interest thus Python2 is, for all intends and purposes, dead.
-
Blog post: Rust in 2023
Python developers noticed that people are not in any hurry to switch but instead of trying to understand “why” they have drawn the line in the sand and spent their efforts trying to kill unofficial attempts to create a fork.
-
Ubuntu Pro
WinAmp 2 (1998) was widely liked. WinAmp 3 (2002) was considered bloated, and flopped.
So Nullsoft followed it up with WinAmp 5 – because 2+3=5 – in 2003, which was very broadly the codebase of WinAmp 2 (small and lean) plus the skin support from WinAmp 3 (the only part people liked).
This won people back, and WinAmp is still around and got an update this year, 20 years on.
I think it's too late for there to be a Python 5, but I did read a blog post long ago – which I can't find again, or I'd link to it – which proposed a similar compromise fix to Python, in considerable technical detail.
I am with @blagie on this: the Python world handled the 2→3 transition spectacularly badly. V3 didn't deliver enough, and strong-arming people by just end-of-lifing Python 2 and expecting the world to move on was foolhardy and short-sighted.
(And I don't even use the language myself. I'm just observing.)
It's a real shame Tauthon didn't get more traction and support.
https://github.com/naftaliharris/tauthon
If it had got enough support and continued, maybe the Python maintainers would have learned something, but I've not seen any sign that they have.
This is nothing new. For comparison, Perl 6 went so badly that Perl 5 now looks likely to continue as Perl 7:
https://www.perl.com/article/announcing-perl-7/
And PHP 6 didn't really happen -- AFAICT as a total outsider, Unicode support proved too hard and it was never released; the community backported the important bits to PHP 5, and then a new PHP 7, more modest in scope, developed from PHP 5.
The Python world could have done the same, and Tauthon was an effort in that direction.
It's too late now. I suspect that, just as Perl has lost a massive amount of interest and use, partly from the nearly-two-decade-long effort to release Perl 5, Python has done the same -- sabotaged its own community with this high-handed "your leaders know best" approach.
-
Will GIL ever be gone?
I just can't see a major fork happening (see: Tauthon, a fork of 2.7 to keep it alive, but no updates in a year or so).
- What happens if we don't migrate Python 2 code to python 3
-
Pip has dropped support for Python 2
If you want forks there are forks. Off the top of my head, Redhat is supporting Python 2 for several more years and there's a project called Tauthon [1] that is "Python 2.8" in spirit. I'm sure there's more efforts I'm not aware of.
[1] https://github.com/naftaliharris/tauthon
What are some alternatives?
pre-commit-hooks - Some out-of-the-box hooks for pre-commit
awesome-buttplug - A list of awesome projects that use the Buttplug Sex Toy Control Library
flynt - A tool to automatically convert old string literal formatting to f-strings
AntiqueAtlas - A Minecraft mod that adds a fancy interactive map item.
black - The uncompromising Python code formatter
CraftTweaker - Tweak your minecraft experience
pep585-upgrade - Pre-commit hook for upgrading type hints
xdg-desktop-portal - Desktop integration portal
autoflake - Removes unused imports and unused variables as reported by pyflakes
kpatch - kpatch - live kernel patching
black - The uncompromising Python code formatter [Moved to: https://github.com/psf/black]
linux - Linux kernel source tree