r/Python • • 4h ago

Discussion I compared the libraries Python projects used from 2018 to 2026

PyPI's BigQuery table lists the dependencies of every uploaded file. I counted how many projects require each library in every year from 2018 to 2026, then split the 2026 projects into new ones (first upload in 2026) and older ones.

New projects pick the newer library

  • Typer 15,442 vs Click 13,057

  • httpx 34,876 vs requests 21,190

  • FastAPI 10,852 vs Django 2,221

Older projects keep what they had

  • Click 6,209 vs Typer 3,078

  • requests 16,210 vs httpx 5,673

  • FastAPI 2,416 vs Django 2,293 (close)

Almost nobody switches. Of the projects that required the old library in 2024 and released again in 2026:

  • Click → Typer: 32 of 2,654 (1.2%)

  • requests → httpx: 161 of 7,765 (2.1%)

  • pandas → Polars: 23 of 6,182 (0.4%)

  • Django → FastAPI: 0 of 1,214

Some old libraries keep their lead anyway

  • pandas 28,787 vs Polars 3,012

  • Matplotlib 18,488 vs Plotly 2,974

  • PyTorch 10,298 vs TensorFlow 713 (TensorFlow fell from 1.6% of projects in 2020 to 0.3%)

"Isn't this just LLM projects?" Partly. 17% of the new projects with dependencies require an LLM SDK, and about a third of new httpx and FastAPI projects do. But two thirds of them require none.

Limits: these are declared dependencies, not imports. Optional extras are left out. Every project counts once, popular or not. 2026 runs to 2 December.

Charts per pair, the BigQuery query to check your own libraries, and the full switching table: https://py-code.org/blog/python-library-adoption-pypi/

  • If you maintain a project on requests, Click or pandas, what would it take for you to switch? Or is "it works" reason enough to stay?

  • If you did migrate an existing project (requests → httpx, pandas → Polars, Flask → FastAPI), was it worth the effort?

  • For new projects, what made you pick httpx or Typer over the old default?

20 Upvotes

13 comments sorted by

View all comments

2

u/billsil 4h ago

Polars doesn’t have error messages as good as pandas. At least it’s an option though, plotly vs matplotlib? What good reason is there to switch? The syntax isn’t even similar.  On click vs typer, what’s wrong with argparse?

Going even further back, I’m still on unittest. I started with unittest, did nose, then nose2, and back to unittest. It works and isn’t likely to require a refactor ever.

4

u/yvrelna 3h ago edited 1h ago

pytest is what I use these days for any new non-trivial projects. 

It's much lightweight syntax than unittest, and it has the look and feel of what a Python native unit test framework would look like instead of a Java test framework that's been ported to Python. 

It supports running existing unittest tests, so porting is trivial, you just switch your test run to call pytest. And then you get all the plugins and just write new tests on pytest and keep old tests as they were until you have a reason to port them. At worst, you'll just forget that you're now using pytest and just keep writing things the same old unit test way. 

3

u/j_hermann Pythonista 2h ago

Stir in tox and uv, and testing for multiple Python versions is easy, and also blazingly fast.

3

u/Beginning-Fruit-1397 2h ago

Well plotly is interactive for one, and  find the plotly express API much better and easierr to read. + the style is much nicer IMO

5

u/ritchie46 4h ago

I'd argue that. If you use proper LazyFrames you get error messages before the query is executed. Showing the exact location this error occurred. Together with the stricter typing this has much less room for surprises.

https://github.com/pola-rs/polars/pull/30592