The State of Python in 2021
deprogrammaticaipsum.com
deprogrammaticaipsum.com
Guido is now working on Python performance at Microsoft and is not the BDFL anymore. Instead, there is a five-person Steering Council overseeing Python.
The best C/C++ interaction options include Cython, cffi, and pybind11. None of those are mentioned. I don't know anybody still recommending SWIG.
No mention for FastAPI or asyncio is a big omission in the Web backend use case. Relatedly, the article still recommends Requests when the community is largely moving to httpx which supports both blocking and async networking.
For packaging, the author mentions and links to Conan (a C++ package manager) which sounds like he misheard Conda.
He's also saying that the easiest way to get Python on Windows is chocolatey. Well, if you type "python" into a command prompt on a fresh install of Windows, it will take you to the Windows Store where you can install the latest Python release with one click. For many users this gotta be easier than figuring out chocolatey.
There is no discussion on "Python, the language" and its state in 2021. I was looking forward to a discussion on that.
I don't mean to pile on but the definitive title sounded like we'd get something pretty authoritative. This ain't that.
With regards to installing via the windows store, I've been told by others in various programmer communities that this isn't the best idea. It doesn't add things to the PATH properly and is a pain to sort out.
I either install it from the python website or using scoop.
And is still in beta. It's got potential, not least because it borrows much of what makes requests good, but "the community is largely moving to httpx" is a stretch.
None of that is important anyway. Requests is an excellent library. Httpx appears to be becoming another excellent library and a natural successor. I'm just saying we shouldn't overhype something new before it's ready. Running beta dependencies in production is a risky business.
Guido now works at Microsoft.
pybind11 is probably the latest and greatest for C++ interop.
If your app grows big enough, you'll end up badly re-implementing Django in Flask. Django is far from perfect, but this blanket dismissal just sounds smug.
Python's goal that "there should be one obvious way to do anything" is admirable, but doesn't seem like it's lived up to in any way.
Say what you will about Golang, but I do like the fact that it won't even compile if you don't follow the mandated codestyle. I don't want to have to think about stuff like that when I have actual problems to think about.
I don't think that was ever a serious goal, it's just that initially Python competed with Perl, and Perl's slogan was "There's More Than One Way To Do It". Python didn't have as many different ways of doing the same thing in the language itself, and Python people liked that, so its slogan became the opposite.
Since Python 2 and 3 there are already far more different ways to do things in the language (like several ways of string formatting, etc) so it's more of a historical thing. And it was never the case for tooling.
I don’t find there to be a lack of standard tooling. Rather, there’s too many options to choose from you might say. It’s what success looks like, I guess.
I do expect that the state of dependancy management is going to change in the next few years because:
- MS has entered the game
- PEP are being worked on a lot on packaging lately
- shiv, briefcase and nuitka are getting traction
- poetry and dephell are very qualitative tools
- __pypackages__ is on the way (try it with pdm)
- pyflow show a very interesting approach to installing python
- python 2 is dead for good
- wheels are now ubiquitous
FastAPI is also a very popular choice these days, arguably more so than Pyramid and Tornado.
https://www.jetbrains.com/lp/devecosystem-2021/python/
https://www.jetbrains.com/lp/python-developers-survey-2020/ (in partnership with PSF)
Yeah what is up with that? Just quit if there's no variable called "quit". Nobody will care that the REPL doesn't give the exact right behaviour for one case.
Hell, make `quit` a keyword if you have to.
Anyway, I really want to like Python but three things make me hate it:
1. The miserable state of type checking.
2. The miserable performance.
3. The miserable project management situation.
Deno/Typescript fixes all of those in my book so I use that where possible. It's better than Python in almost every way.
I will switch to python 3.10 as soon as it's released just for the better error messages and the typing goodies though.
I love Python (I consider it my main language), but there are a ton of use cases for which I wouldn't use it for. Namely, if you need: robustness (provided by static typing, for example for critical systems), performance, parallelism. Scala, Rust, C# (Go, C++ also, but I dislike these two) are better options.
I'll grant you that aiohttp has a much nicer interface for websockets than I've seen in gevent-based libraries, but that seems like a very small win compared to the huge downside of chucking out most of the web server ecosystem and starting again.
It does forget to mention very important topics:
- type hints are finally useful, thanks to better mypy default and support, and allowing built-in, protocols and shortcuts into the syntax
- 3.10 ships with pattern matching and, I must insist, absolutely better error messages (being waiting for that for a while)
- black is the status quo formatting tool in the community
- pydantic base libs are getting a lot of traction (the article does mention typer, but not fast api)
- dephell allow you to convert between all those mess of various build systems so you can easily start with pip and move to poetry
- a new dev is now PAID by the PSF to work on python
- __pypackages__ is being actively experimented with, with initiatives like the pdm, the py launcher or pyflow (which also aims to take pyenv job, but saving you the compilation)
- plenty of speed work being done by MS, but also 2 other projects
- pyproject.toml is has now enough PEP to be better than setup.cfg , including one for a lock file
- vscode is now the most popular python ide, their language server pylance rocks and does feature auto imports now
- zipapps with shiv and compiled apps with nuitka changed the game of python deployment
- brett canon decided to use doit as a build tool publicly for new projects so it's getting traction. Ok, I kinda oversold it to him, but it's a good tool, it's worth checking out.
- asyncio is not a curiosity anymore, and the ecosystem is pretty mature, with uvloop, aiohttp, httpx, trio, etc. And the work for a integrated nurseries into the stdlib is on the way
- concurrency in Python has seen a boost because of the stdlib ShareMemory module, and sub interpretter are now being tested by popular projects
- python 2.7 has been dead for 1 year and it's business as uasual
- python 3.6 is the "old python" now. Funny, considering we used to thing f-string were the new toy
- rust is becomming python best friend, with more and more extensions being written in rust, and even one python implementation
- pyiodine makes it trivial to test real python code in a webpage. For web dev it's not usable, but for teaching it's been awesome:. Type to use sqlite in there, it's works magically, despite never touching the server : https://notebook.basthon.fr/
- htmx (the js lib) is getting used by pythonista that don't like js much
- wagtail, the cms, has become a thing of beauty
I probably forget a lot of things.
How is running a command a non trivial task?
Many others exist, too. Most are wrappers of some C++ lib, like Qt etc. some wrap these wrappers again.
Edit:anybody downvoting pls suggest a modern gui tool for python on desktop (which you hv experience with) . I need one and I have been looking. Using Tkinter now.
I feel like desktop UIs on Windows have been in the state of "It hurts when I do this" - "Stop doing it then" for a number of years. "Just put everything in a web view" might actually be the best way to have a GUI on Windows nowadays, if you really need one, and otherwise you simply avoid having to run an application on Windows entirely whenever you can (=pure web app).
Python deployment is an absolute nightmare. And don’t you dare say “just use conda”.
Python the language isn’t particularly great. The built-in libraries are a mixed bag. (Filesys is awful). But everyone is forced to use Python because numpy is super powerful and all the ML frameworks are in Python.
The fact that GIL is still an issue in 2021 is a god damn travesty. As is the overall awful performance of Python.
The language definitely got something right. But I can’t decide how much of its success is good ideas vs pure inertia.
But it's older than Java, think about that. Has it aged worse than other languages? Are Python libraries worse than Java's? Package management? Has Python more cruft? Is it harder to install?
At this point it's part inertia and network effects, although you should check the alternatives in ML: R, SAS, Matlab... I think Julia is better, but it has made some decisions not everyone likes. Static typing for ML, you may think, that would be awesome. Well, I think the language that got closest to it was Scala but it never escaped Spark.