54 comments

[ 0.23 ms ] story [ 132 ms ] thread
Refusing to read (in spite of my genuine interest) based on the click-baity title.
The text is written in the same clickbaity style. But the libraries look pretty interesting.
I second this. The libraries were actualy pretty interesting
To be fair, other than the title, I don’t think it’s written in a clickbait style.

I’m not bombarded with ads and they aren’t doing the thing where you get one page per list item. And several people have found certain libraries useful.

As I'm writing this, the title is "Top Python libraries of 2020 you should know about". Sure, it sounds a bit click-baity, but what's a better way of writing that title? The only way to remove the clickbait element is to literally list all or several of the libraries, which would make for a terrible title.
Then you should also refuse to comment.
Summary of list:

  * Typer
  * Rich
  * Dear PyGui
  * PrettyErrors - formatting and coloring error messages in the terminal
  * Diagrams
  * Hydra - build configurations in a composable manner, and override certain parts from the command line or config files.
  * OmegaConf
  * PyTorch Lightning
  * Hummingbird - compile your trained traditional ML models into tensor computations
  * HiPlot - high-dimensional data using parallel plots
  * Scalene
  * Norfair - real-time object tracking; the real reason for this post, as it is created by the company
Hi, author here. We have been doing the series of posts every year since 2016, way before Norfair was even a dream.
(comment deleted)
To be fair the Norfair library is presented as a 'bonus' item and not part of the top 10 list. Even as self-promotion it seems relevant and fair.
DearPyGUI is awesome, and I hope that people don't use it en-mass so that my side-projects using it have an easy time getting a lot of attention because of it!
I've been using Python a lot, both professionally and privately. Been contributing to Cpython.

Not sure I like the language. The best dependency manager (Poetry) is buggy. The default interpreter is slow.

But I love the ecosystem of third party packades. Thank you! Python will be around for a long time.

Curious what bugs you have come across with poetry?
In the current version, 1.1.4, if your package has optional dependencies (AKA "extras"), the generated package metadata is incompatible with setuptools (specifically the packaging package, which can't parse the requirement specs generated by poetry), so I've had to stick with 1.0 for now.

I've encountered a few issues like this since I started using poetry 0.12.

Thanks for sharing, indeed that is very bad. Do you know if this bug is already reported?
Race conditions in the installer. The parallel installer must be disabled.

But generally I like poetry and I am also a contributor (--remove-untracked). Don't want to bash it to much.

I also like and use it and have been trying to compare it with pipenv(which we switched from). To be honest it has been nothing but very pleasant to use and I am surprised when people have issues(maybe we have those issues and I am not aware?).

I have not had any issues with installer race conditions, did I miss, was lucky or you had a special case it surfaced maybe?

After lots of experience with many Python package managers, I’ve always found conda to be the best across the board.
I have to agree with you here.
I tried conda on a couple of occasions, but it always took an absurd amount of time for dependency resolution (upwards of a minute on average hardware and smallish projects with a few heavyweight dependencies like numpy). Is that aspect better now?
Nope, but it's worth it to find out about dependency problems before the installation, rather than after.

Conda also handles C/C++ libraries well, which is a must if you're packaging DS/ML code for Python.

Oh, so does Conda proactively download metadata as part of its resolution process (as opposed to, e.g., greedily downloading immediate dependencies and walking that tree, which is what I assume Pip does?)?
It's still slow. The reason it's slow is because they use a complete SAT solver to do the resolution. So, it's slow, but it's also thorough. It gives some insight into why pip's dependency management is not thorough: they're clearly sacrificing completeness for performance.
As another data point, emerge has a noticeable delay (a few seconds, up to 10 or so for deep dep trees), but it does a full resolution and isn't using all cores (or isn't using them well anyway -- total utilization is under 15% while resolution is underway). It's much faster than conda on similar machines.

Is conda making a bunch of network calls as part of its resolution process?

Note that pip has recently gotten a proper version resolver. It's still plenty of fast, but it's also definitely possible to run into degenerate cases for which it will never finish.
Coming from Python into the Node.js/React world, I find myself missing the Python library ecosystem, and as fantastic as NPM is, Poetry was not so far behind it that I generally noticed...

Sequelize is an order of magnitude worse than SQLAlchemy, IMO, as the Postgres support seems tacked on, and Sequelize hasn't correctly guessed a single column or table name yet.

In the contrary, I find Poetry is pretty buggy comparing to pipenv. I am a casual Python coder for fun and ran into issues with Poetry following their intro document. With pipenv, I have not encountered any of the issues so far.
I like how they led with something of general interest -- just about anybody might want to make a command line script that requires arguments. Typer might help me get away from Bash scripts to just write in Python.
Agreed. I've had exact same idea for quite some time now, but never got to writing it - I'm glad someone did, and seemingly in a very good manner.
Ever since type hinting came about I wanted a library like typer (I had a few attempts to write one, but often lost motivation with other things). This was the first time I’ve seen it and am excited to read more into it!
Thanks for putting that together. Great list!

I use Hy (a thin Lisp skin/wrapper for Python) for a few personal projects (not at work) and great libraries help make applications shorter and easier to maintain. Best code to write is no code.

Thank you to the author of this list. I pay pretty close attention, and yet most of these libraries were new to me and I can see myself using 1-5 right away! This was a great list.
I am glad it was of help! We put a lot of effort every year into these lists.
If Dear PyGUI uses immediate mode, does it perhaps have the makings of a game library?

I looked briefly at pygame a while ago and was dissuaded when using hardware surfaces seemed to be black magic in the opinion of many users of the library, and using software rendering nets you a max of like 25fps if you do nothing but blit black across the entire screen. Does anyone know if pygame is still the state of the art for python game dev?

It would be much higher than 25 fps for sure. I would say it could stand a fair chance for some starter level 2d games to hit 60fps or higher easily. However that is not the intended use case the library at the moment, it currently aims at giving a face to scripts and med-large applications. But it wouldn't be bad introduction to the idea of having to deal with frames and a render loop and logic loop ect for a beginner!
PyGame recently released a new version based on SDL2 instead of SDL. I don't know if it's actually faster but given that SDL2 focuses on accelerated rendering I'd imagine so. Worth checking out in any case.

Just in case it's still as slow as ever: there's perfectly fine SDL2 bindings for python, so if you use those at least the slowness will be your own fault.

Like every year, a thoughtful and helpful list. Thank you, Tryo labs.

I've left the ecosystem for the JVM, professionally, so a nice way to keep up with what's going on in Python land.

Absolutely off-topic, but can somebody advise on the best resource to learn the most up-to-date Python for somebody who is mentally stuck on Python 2.7-3.2? I always referred to Python when I needed to quickly write some tool for personal use, but never professionally, even though I am a professional programmer. And recently while writing something like this I was struck with how bad my Python actually is in 2020, compared to how other languages I know currently look. Quick lookup shows that it seemingly has pretty powerful typehints system now, but I never used it. I have no idea, which parts of standard library you aren't supposed to actually use anymore, and use some well-established 3rd part library instead (like it was with requests). And stuff like that. And is it even a good idea, to finally switch to the newest versions of Python and to never look back?

So, basically, what's the best way to catch up?

I"d strongly recommend Trey Hunner at PythonMorsels. The approach is to give you a concise problem that should exercise some part of your python knowledge, and have you write code, re-write your code, bang your head against a problem, and then, once you've written something that passes all the unit tests, you get a walk through possible solutions by someone who knows python well.

Trey starts with a description of how you might solve the problem (which is about how I solved the problem 50% of the time) that is almost always clearly wrong, even though it "works" - then he shows you a somewhat more pythonic and modern way - and you go, "aha!", and then, he shows you the elegant solution - and it changes your life, and you use that pattern in everything you write.

His focus though, is really on how to write clean pythonic 3.x code more than the latest and greatest features, but he tags his problems/solution sets, so if you really want to dive into decorators, or context managers, or dunder methods - you can zoom right in.

The only problem I've had with Python Morsels is I look at the code I wrote a year ago (I'm not a developer) and I'm embarrassed and ashamed at how gross it was.

I wholeheartedly endorse The Python Cookbook by David Beazley. It's almost a decade old, but hasn't aged a bit. Its "recipes" are practical, elegant, and often somewhat cheeky: I'm thinking in particular of a puckish trick he uses to lazily interpolate variable bindings into a format string automatically by resolving it in the context of previous stack frames (helpfully packaged as a modular function that emits nice errors), and another to tamper with the restrictions of the GIL by executing threaded computations in separate interpreters. But while the book is loaded with black magic, it's also the first place I turn when trying to refresh myself on more quotidian topics like navigating a filesystem, making subprocess calls, overriding class instance behavior with magic methods, etc.
> bsolutely off-topic, but can somebody advise on the best resource to learn the most up-to-date Python for somebody who is mentally stuck on Python 2.7-3.2? I always referred to Python when I needed to quickly write some tool for personal use, but never professionally, even though I am a professional programmer. And recently while writing something like this I was struck with how bad my Python actually is in 2020, compared to how other languages I know currently look.

You are me!

Just build something you need (or just a simple To Do app) and use a modern library / framework that uses the “new” stuff. I can highly recommend to give FastAPI a try. Even just going through the examples in the docs (amazing docs) should get you started.
> So, basically, what's the best way to catch up?

Install the latest python version and use it. Ignore the bits you don't need. The type hints for example are neat but entirely optional.

Typer looks cool. I really like the idea of just writing functions to create command line scripts rather than using argparse.

Here's another library that takes a similarish approach using annotations, although it's not quite as polished: https://pypi.org/project/runcommands/

Typer and specially diagrams look like will be pretty handy for me in the near future. Don't know how I missed then. Thanks for the list!
Need to see more eBPF mentions.
Except for Pretty Errors, nothing else is useful for me. And why are so many packages related to ML/AI? Is there no development for anything else anymore?
Is there a list of those that were hip 10 years ago, and if they are still properly maintained today?
would love to see this too. even just 3-5 years ago
We have done the same post every year since 2016!