r/Python • • 2d 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?
74 Upvotes

38 comments sorted by

58

u/deceze 2d ago

Very nice, but hardly surprising. Switching libraries comes with a cost, and unless the new thing is substantially better in some specific aspect, a switch is hardly worth it. Especially for fundamental things like Django vs. FastAPI; you ain’t gonna rewrite your entire server just because.

5

u/Business-Feedback635 2d ago

yes, not switching totally make sense. but it does not mean new projects are adopting them as well

19

u/kenflingnor Ignoring PEP 8 2d ago

Are people still using httpx?  Last I saw that project was pretty much shut down because the maintainer had a mental episode, and most major frameworks have migrated to httpx2

6

u/Business-Feedback635 2d ago

Yes, people are still using httpx. In November, 10,397 new PyPI uploads required httpx and 906 required httpx2. httpx2 is growing fast. httpx also had a release (0.29.0) on 26 November.

The big SDKs did move: openai, anthropic, mcp, huggingface-hub and google-genai now require httpx2. But FastAPI, litellm, ollama and gradio still use httpx, and only about 5% of existing httpx projects have switched so far.

6

u/kenflingnor Ignoring PEP 8 2d ago

Interesting. We migrated all of our stuff over to httpx2 at work because the risks of sticking with httpx weren’t worth it 

1

u/Business-Feedback635 2d ago

curious what are the risk of httpx? i myself use httpx

8

u/kenflingnor Ignoring PEP 8 2d ago

The maintainer basically shut the whole thing down from the community and was barely developing on it.  Supply chain risks were the primary concern

7

u/Gugalcrom123 2d ago

Why did you compare FastAPI to Django and not to Flask?

4

u/Business-Feedback635 2d ago edited 2d ago

on PyPI, FastAPI is far ahead of Flask, with 4.9% of projects against 1.1%

in the article all three are compared

4

u/Business-Feedback635 2d ago edited 2d ago

Two things you would like to know:

  • Typer vendors Click now. Since Typer 0.26.0 (26 May 2026), Typer ships its own copy of Click's code. The counts only use the libraries each project lists itself, so a Typer project counts for Click only if it also lists Click, before and after that change.
  • Run it yourself. The query is in the post. Each run reads about 6.8 GB, and the BigQuery sandbox gives 1 TB of queries a month for free. The scripts and raw results are here: https://github.com/pypi-data/blog/tree/main/python-library-adoption-pypi

14

u/mortenb123 2d ago

And still people choose httpx over requests when there is a way better kid in town: https://pypi.org/project/niquests/ I've replaced 40+ requests projects with a oneliner: 'import niquests as requests', for httpx is little more job, but performance is better.

3

u/Brandhor 2d ago

I always forget about niquests so I always use requests but at least in my case it doesn't really make that much of a difference since I never need to do thousands of requests per second

1

u/AICausedKernelPanic 22h ago

I wonder how this will shape over the next 5 years or so with everyone using LLMs. Does an LLM being biased towards one library mean the gap between libraries grows significantly? maybe even within the next year or two I reckon we'll start to see a difference in how libraries/frameworks are adopted

1

u/Business-Feedback635 16h ago

totally make sense. i agree people tends to use those libraries which are recommended by llms instead of those which are better

10

u/billsil 2d 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.

21

u/yvrelna 2d ago edited 2d 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. 

4

u/j_hermann Pythonista 2d ago

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

4

u/MrSlaw 2d ago

Also nice for things like uv run --resolution lowest-direct --isolated pytest to test your project's lower-bounds to ensure all supported versions/dependencies actually pass your tests

9

u/ritchie46 2d 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

2

u/Beginning-Fruit-1397 2d 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

1

u/billsil 1d ago

I mean I don’t know plotly, but they all are interactive.

I get the code is shorter, but it really just feels like a preference to me and a huge ask to switch on an existing open source project. I run one and minimizing dependencies is a major priority.

For a 15 year project, I’ve seen everything change and change back. I used optparse, switched to docopt, switched to docopt-ng, switched to argparse. Setuptools changed to disruptions changed to a different setuptools, changed to pip with setuptools, changed to pip with pyproject.

I’d rather just not deal with something that is going to change its API on me.

1

u/Beginning-Fruit-1397 1d ago

I always struggle to see the constant battle with API changing. Besides a few search & replace that are done in minutes

1

u/billsil 1d ago

Unless you have 300k lines of code.

It’s easy if you know the thing you’re switching to. It’s was not at all a few search and replaces to switch to pyproject or to ditch nose and go back to unittest. Plotly is a totally new API.

1

u/Beginning-Fruit-1397 22h ago

Oh yea I was more talking abt the "minimize dependencies for API changes on updates". Ofc changing libraries is another thing entirely

1

u/billsil 14h ago

Ahh yea. It’s very easy to support a wide range of versions as long as you’re consistent. Trying to upgrade a code that ran on python 2.3 and has an exe that doesn’t build on my operating system and all I have is a few pictures is harder. Numeric is basically numpy, but a lot has changed. The dead gui backend took way longer.

2

u/ali_the_bettor_34 2d ago

one data point from a small market data project of mine: httpx for the rest calls, websockets for the live stream, plotly for the charts, plain argparse for the cli, and no dataframe library at all, prices stay in decimal and the stats come from the stdlib statistics module. so httpx and plotly fit your new projects pattern, but the gap your table can't show is projects that skip both pandas and polars, would be curious how many new projects requiring httpx declare neither

3

u/unapologeticjerk 2d ago

lol @ rich not on there.

Also, I hate scraper bots and I hate Fastly and I hate how even my own personal pip search that quietly snatched and used the JS token got fucked within 24 hours after like two uses. AI or Scum of the Fucking Earth Auto Scrapers: which will end humanity first?

2

u/Pro_Strikerr 2d ago

The 0 of 1,214 for Django to FastAPI is the real headline. Nobody rewrites a working server for a nicer framework. For new projects httpx mostly wins because async is built in, so there is no second client to add later

1

u/russellvt 1d ago

Needs more pixels

1

u/darylvp 1d ago

Understandable no Django users want to switch to FastAPI.

1

u/Youssef_Ismail396 1d ago

The Django → FastAPI 0 of 1,214 makes sense to me. Once a project has its models, admin and auth built on Django, there's nothing to "switch", it would be a rewrite. For a small CLI I made recently I went the other way and used only argparse and the standard library, because it's a security tool and I didn't want users to have to trust extra packages. Curious if your data shows how many new projects have zero dependencies at all, and whether that number is growing.

-3

u/vesnikos 2d ago

I feel that polars is more suitable for data wrangling or data transformations and pandas more for data analytics, data science

8

u/Business-Feedback635 2d ago

i feel in few years polars may catch pandas, as polars growth is increasing and pandas growth is decreasing

7

u/Beginning-Fruit-1397 2d ago

Not really. Pandas doesn't have any leads vs polars in any case, except geospatial data it seems ATM

1

u/vesnikos 2d ago

I am skeptical that if you need anything they requires gdal at that stage you haven't finished your analysis yet