28 ms·
The State of Python in 2021
- jellyksong 5y ago> Thankfully these days Cloud Native Python apps are built around less monolithic options such as Flask, Pyramid, or Tornado. FastAPI is also a very popular choice these days, arguably more so than Pyramid and Tornado.
- yewenjie 5y agoSlightly off-topic: How do I delete all sorts of Python installations from various kinds of tools (pyenv, asdf, conda etc.) and just have the system one (on Arch Linux)?
- akx 5y agoIn general: Find executables named `python` that aren't Arch's default and delete their related hierarchies?
- memco 5y agoOne thing I didn't see mentioned is profiling. I'm really interested in the recently released Scalene tool: https://pypi.org/project/scalene/ https://pypi.org/project/scalene/, which seems to be a top contender to replace all the previous tools.
- danmur 5y agoI use scalene, it's great. py-spy is good too for more real-time use
- andi999 5y agoNo love for Tkinter?
- hdjjhhvvhga 5y agoAlthough subjectively the look on Windows 10 seems a bit better than on previous versions, it still feels a bit ancient. So you may ask what's the point: if you create a GUI in 2021 you will probably want it to look modern and attractive. Even a modern TUI interface may look better.
- hutattedonmyarm 5y agoDo you happen to know a more modern GUI framework for Python?
- pletnes 5y agoNot an expert at all and can’t vouch for quality but there’s at least wxpython, pyqt, and wrappers of gtk, win32 and cocoa out there. There’s also a .net interop lib which might talk to windows libraries. Many others exist, too. Most are wrappers of some C++ lib, like Qt etc. some wrap these wrappers again.
- andi999 5y agoMy take on these: Win32 gui is not modern, cocoa and gtk is not windows, pyqt is not free for commercial products,. Net interop in cpython is annoying, and until last year wxpython didn't work under python3. Wxpython might be worth looking at again though. (but then why not Tkinter) 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.
- Biganon 5y agoPySide. It's a Qt binding, under LGPL license. I used it for a fairly big project.
- formerly_proven 5y agoTk and Ttk are essentially different toolkits with a similar API. There are some decent looking themes (ark, breeze, yaru, there's even a bootstrap port) and also some native themes for Ttk. I believe the native Windows theme is Win32. You likely don't want an UI backed by Win32 widgets, for various reasons (poor performance, looks kind of bad, flicker/redraw issues, abandoned by MS). 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).
- jstx1 5y agoThis doesn't say a lot about the current state of Python. It's just a list of the libraries that the author happens to know. Presented not in list form.
- pqn 5y agoA couple notable omissions: Guido now works at Microsoft. pybind11 is probably the latest and greatest for C++ interop.
- 5-more-minutes 5y ago+1 for pybind11
- dkdbejwi383 5y agoEvery now and then I consider revisiting Python (I haven't used it in anger for a few years), but I am continually put off by the wild-west state of dependency management, lack of standard tooling and project configuration. 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.
- Scarblac 5y ago> 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. 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.
- lmm 5y agoThis is rewriting history. It was a serious goal at the time, and the language was all the better for it; the fact that it wasn't applied to tooling is the language's gravest mistake.
- Scarblac 5y agoMaybe, but I have trouble thinking of a Python language decision that was made (or not made) because there should be a single way to do things. Can you think of one?
- lmm 5y agoPushing map/reduce/filter behind an import was done on the grounds that list comprehensions were the preferred way to express the same things.
- skeeks 5y agoOff topic: is it just me or is the font of that webpage barely readable on screen?
- rcarmo 5y agoNot just you. I immediately clicked Reader mode, although I couldn't really point to a definite trigger.
- kubb 5y agoIn my office, everyone seems to avoid python like fire. The big reason seems to be that lack of static type checking makes their work harder in the long run.
- fredrb 5y agoDo they avoid all dynamic typed languages or only Python in particular?
- kubb 5y agoAll of them, but Python is the only one (apart from Javascript) that's approved for internal use.
- BiteCode_dev 5y agoPython is no Haskell but type hints does reach Pareto level for catching bugs. Mypy is now well integrated into IDE so no reason to have a type error anymore. I will switch to python 3.10 as soon as it's released just for the better error messages and the typing goodies though.
- kubb 5y agoApparently the type hints don't work because people don't use them in libraries.
- ptx 5y agoI was going to object that one reason for not using static typing is that certain perfectly reasonable patterns are difficult to describe to the type checker, e.g. sharing tests between TestCase classes by using a mix-in – but apparently[1] Python 3.8 solved that particular case. [1] https://stackoverflow.com/a/60323489/896841 https://stackoverflow.com/a/60323489/896841
- santiagobasulto 5y agoThis is true. But it doesn't necessarily make Python bad. It's just not the right tool for the job. 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.
- pqn 5y agoSome additional "State of Python"-themed material: https://www.jetbrains.com/lp/devecosystem-2021/python/ https://www.jetbrains.com/lp/devecosystem-2021/python/ https://www.jetbrains.com/lp/python-developers-survey-2020/ https://www.jetbrains.com/lp/python-developers-survey-2020/ (in partnership with PSF)
- qwertox 5y agoI don't understand how aiohttp isn't even mentioned. It's such a joy to write HTTP servers with it.
- joppy 5y agoThe whole async ecosystem in Python seems like a bordering-on-insane duplication of work, given that a huge amount of the benefits can be gained simply by running your application under gevent (which is what many in the WSGI server crowd have been doing for yonks). The fact that every piece of code has to be rewritten (and usually in a very stupid way, like putting 'async' and 'await' in the right spots and otherwise leaving things alone) is just madness. 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.
- mkl95 5y ago> Installing Python is still a non trivial task How is running a command a non trivial task?
- ambivalence 5y agoThere are quite a few inaccuracies here. 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.
- el_oni 5y agoThanks for the httpx info. Im still using requests but have been looking for a none-blocking option. 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.
- jgb1984 5y agoThe author clearly isn't as well informed as he thinks himself to be. And what a smug jab at Django... Better refer his blogpost to the dumpster where it belongs.
- Silhouette 5y agoRelatedly, the article still recommends Requests when the community is largely moving to httpx which supports both blocking and async networking. 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.
- forrestthewoods 5y agoPython causes me a great deal of suffering. This XKCD summarizes one reason why. https://xkcd.com/1987/ https://xkcd.com/1987/ 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.
- plafl 5y agoPython definitely started with very good ideas and whatever success it has achieved is by merit and not marketing power or reputation of a company behind. Clean syntax, a decent object model, good documentation. Good taste in general. 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.
- tmarice 5y ago> At some point I got a job as a Django application developer, a framework pompously marketed “for perfectionists with deadlines”; a punchline filled with hubris and undeserved merit. Thankfully these days Cloud Native Python apps are built around less monolithic options such as Flask, Pyramid, or Tornado. 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.
- jgb1984 5y agoThe author clearly isn't as well informed as he thinks himself to be. And what a smug jab at Django... Better refer his blogpost to the dumpster where it belongs.
- BiteCode_dev 5y agoThat's harsh. I do think he is very wrong and ignorant, but there is no need to be upset about it. The article is not without interest for someone who don't see the python ecosystem regularly. I hope you didn't flag the article for that.
- Biganon 5y agoAnd you seem to overestimate the quality of your overly aggressive comment, since you copy and paste it several times.
- BiteCode_dev 5y agoWhy is it flagged ? The article is imperfect, but midly useful. 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/ 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.
- Silhouette 5y agoI agree it's unfortunate that this submission was flagged. The original article wasn't perfect but it has prompted several informative comments including the parent of this one, which most people presumably won't see now.
- reportgunner 5y agoI don't see the black python formatter[0] mentioned. I use it for all of my projects and I love it as I prefer not to have a linter distract me while I type. You can see a demo[1] without installing it to check how it works. [0] https://github.com/psf/black https://github.com/psf/black [1] https://black.vercel.app/ https://black.vercel.app/
- IshKebab 5y ago> I still facepalm every time I type quit in the REPL and get the tone-deaf "Use quit() or Ctrl-D (i.e. EOF) to exit" message instead. 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.
- urxvtcd 5y agoI'll risk giving an impression of being set in my superior ways: just type Ctrl-D as it suggests? It works for every readline-like environment, like shell, ssh session, redis cli, and so on.