r/Python • • 9d ago

Discussion What Python libraries do you think every backend developer should learn beyond FastAPI and Pandas?

I'm curious about what Python libraries experienced developers consider essential for backend development.
I'm currently exploring FastAPI and learning more about the Python ecosystem. Beyond the usual frameworks, what libraries do you find yourself using regularly in real-world projects?
I'd love to discover some underrated libraries that are genuinely useful in production projects, not just popular ones.
What are your must-have Python libraries, and why?

82 Upvotes

119 comments sorted by

72

u/BiologyIsHot 9d ago edited 9d ago

Is pandas useful for backend development? Maybe sqlachemy or something instead? Pydantic I consider already part of learning fastapi

6

u/niRmana_dev 9d ago

Yeah, I was also wondering about that. I mostly associate Pandas with data analysis rather than typical backend development. SQLAlchemy probably makes more sense for database operations. I'm still exploring where Pandas fits into backend workflows.

42

u/waldenhead 9d ago

Pandas is so 2016. All new data frame code is written in Polars now personally.

2

u/compulsive_tremolo 8d ago

It's hard to get away from it - theres so much legacy and support for Pandas.

Tbh data engine API wrappers in cloud environments have largely reduced the footprint of both (at least in enterprise settings).

5

u/ChercherArbeit 8d ago

The trick is to use polars then just convert into a pandas data frame for when you need it.

-1

u/cudmore 8d ago

And LLM’s are really good at replicating pandas/polars in typescript.

-9

u/[deleted] 9d ago

Pandas is better than polars is like Apache and nginx! Nginx just for reverse! Apache full power you must learn to controll. Pandas the same.

3

u/terletsky 8d ago

Pandas/Numpy is for Data Engineering roles. Backend developers never use these things.

36

u/ravepeacefully 9d ago

Shouldn’t really be, in my opinion. Great tool for analysis, no need for backend dev and objectively a bad choice for many things I’ve seen it used

36

u/Efficient_Bobcat_697 9d ago edited 7d ago

I've switched to polars (and marimo for prototyping and data exploration) and I couldn't be happier

I also really like peewee as an easier but less complet ORM than sqlalchemy.

Anyio as some interesting goodies on top of asyncio also

4

u/niRmana_dev 9d ago

Oh, Polars keeps coming up in recommendations. Definitely need to give it a try. Haven't explored Marimo or AnyIO yet either. Peewee sounds interesting too, especially if it's a simpler alternative to SQLAlchemy. Adding these to my learning list!

3

u/cometsongs sing me a song 7d ago

Just looked into Marimo and I’m already a convert; that it will setup and run code idea prototypes so clearly and robustly and neato wins me over. 👍

20

u/PrestigiousStrike779 9d ago

Sqlalchemy  Boto3 if you’re on AWS

3

u/niRmana_dev 9d ago

Yeah.. SQLAlchemy seems to be a must-have for database-heavy applications. Thanks!

1

u/ChampionshipThin9779 8d ago

Any good resources to learn SQL alchemy?

1

u/PrestigiousStrike779 8d ago

I learned primarily from the docs on their website.  There is a tutorial there.  https://docs.sqlalchemy.org/en/21/index.html

9

u/mttpgn Pythoneer 9d ago

To those saying both `boto3` and `pandas`, it's `awswrangler`.

6

u/niRmana_dev 9d ago

Oh nice, didn't know about awswrangler! Combining AWS services with Pandas sounds pretty useful. Definitely checking this one out.

4

u/Samhain13 9d ago

If your application does any kind of orchestration, "backoff" might come in handy. It automaically retries failed network calls in a staggered manner and, if the number of retries has been exhausted with no success, handles the error response for you.

2

u/niRmana_dev 8d ago

Oh, this is a good one! I haven't explored backoff yet. Retry handling is definitely useful when working with external APIs and background tasks. Adding it to my list!

1

u/uselesslogin 9d ago

Looks like python-backoff is the maintained fork

6

u/zzmej1987 9d ago

Django for the same reason as fastapi and dash for when you don't have time to wait for the front end.

2

u/niRmana_dev 9d ago

Django is definitely worth exploring too. And Dash sounds interesting for quickly building interfaces without getting stuck waiting on frontend development. Haven't tried that one yet!

3

u/TPECKA180 8d ago

I mainly work on AI simulations and experimental games. Pygame is surprisingly versatile for visualization, while SQLite, NumPy and Polars are worth considering for storing and processing simulation data. Python's standard library also covers more than people realize.

1

u/niRmana_dev 8d ago

That's an interesting use case! I hadn't thought of Pygame as a visualization tool for simulations. NumPy and Polars also seem like a useful combination for handling larger simulation datasets. Do you mostly use Pygame for real-time visualization or for building interactive experiments?

184

u/martinky24 9d ago

Pydantic

53

u/ianitic 9d ago

Tbf, if you know fastapi you should probably know pydantic. Unless you are using fastapi wrong haha.

16

u/Drumma_XXL 9d ago

Pydantic has way more stuff to offer than what is frequently used in fastapi.

6

u/ninhaomah 9d ago

Ohhh... Late by a min... Well done!

0

u/ochagas26 6d ago

Really?!😒️😒️

2

u/Best_Tea9451 8d ago

Definitely pydantic and sqlalchemy - you’ll see them in almost every real project. Try learning polars and/or PyArrow to see how they can help you get much better performance than pandas. Though if you solve performance issues by switching from pandas to polars, maybe you should rethink your data processing from the basics first

2

u/niRmana_dev 8d ago

That's a good point about performance. I've mostly used Pandas so far, but Polars keeps coming up in recommendations. I'll definitely explore both Polars and PyArrow. And yeah, optimizing the actual data processing logic should come before just switching libraries.

82

u/cig-nature 9d ago

The built-in collections module never gets enough love, and is always useful.

https://docs.python.org/3/library/collections.html

42

u/dysprog 9d ago

If we are talking built-ins, itertools changed the way I think about loops and programming.

I was running out of memory storing intermediate lists that didn't need to be stored.

13

u/Duodanglium 9d ago

Yeah, shout out to Raymond Hettinger.

18

u/patryk_builds 8d ago

From one fastapi project, the ones i'd miss most, with the reason each earned its place:

- httpx. every backend ends up calling someone else's api. async client, sane timeouts, and easy to swap for a fake in tests

- sqlalchemy 2.0 with alembic. the 2.0 style is much clearer than the old one, and alembic is the part people skip until the first schema change in production. read every autogenerated migration before running it, it guesses wrong more often than you'd think

- pytest. fixtures are the real feature. a fake payment gateway or a fake http answer as a fixture keeps the whole suite off the network

- ruff. one tool for lint and format, fast enough to run on every save, and it ends style arguments

- jinja2, if you ever render html or emails. server-rendered pages cover a lot more than people expect before a js framework is needed

Not a library, but the habit that mattered more than any of them: put every call to an outside service behind one module of your own. then tests replace that one module, and swapping the provider later touches one file

2

u/iKnowSearchEngines 7d ago

Jinja2 is also super great for sql dynamic queries. Like super wow if you ever need to build some kind of a sql query engine for custom BI project then jinja2 is your friend

29

u/GrainTamale Pythonista 9d ago

SQLite, DuckDB, requests

12

u/GrainTamale Pythonista 9d ago

DuckDB cause it's genuinely powerful and cool.

...aNd rUSt! /s

11

u/Count_Dirac_EULA 9d ago

You joke about rust but it’s not a joke... I know it’s a Python thread and questions about Python libraries.

We’ve swapped some pipeline steps from Python to Rust because the cost and speed advantages were stupid. There are some cases where Rust even beats Go at data engineering tasks.

And for modeling we are also moving to Rust for some things. Polars being native Rust helps.

…. But to stay on topic, Polars and DuckDB are amazing.

5

u/GrainTamale Pythonista 9d ago

I ❤️ Polars

7

u/Garybake 8d ago

Im seeing more use of httpx over requests, mostly due to native async. I recently switched to httpx2 due to library support.

1

u/dusktreader 8d ago

This is the way

1

u/Training_Advantage21 8d ago

Yep. SQLite might make more sense than Pandas.

21

u/RedSinned 9d ago

You don‘t need pandas. Go for polars

23

u/Wide_Guava6003 8d ago

Polars. Instead of pandas. Nobody should learn pandas.

8

u/todorpopov 8d ago

I’ve seen multiple people mention these already, but collections, itertools, functools, and Pydantic make Python such an enjoyable language to work with. Some honourable mentions are also contextlib (because I’ve rarely seen it used more in-depth than just a custom context manager, yet is so powerful and makes your code so much cleaner), asyncio (great all around; really useful for modern Python) and pytest (incredibly flexible and nice to use).

15

u/dusktreader 9d ago

httpx2, typer/click, loguru, pydantic, pendulum, inflection, sqlalchemy/alembic, boto3, pytest, and zensical.

4

u/No_Departure_1878 9d ago

what about rich + struclog?

4

u/dusktreader 9d ago

I prefer loguru over structlog.

I would recommend rich for CLI apps that produce a bit of output, but APIs don't have any use for it. Plus, it's a dependency of typer, so it's kinda in my list. 😂

1

u/No_Departure_1878 9d ago

If you have a process with many logs, you would need to be able to capture them all and go through them fast. I am not sure how that can happen if you do not send them to JSON.

3

u/dusktreader 9d ago

loguru can do structured logging. In a prod/staging deployment you activate that. For dev and local, use pretty logs.

1

u/iamevpo 8d ago

What's inflection? And zensical as a lib?

1

u/dusktreader 8d ago

https://inflection.readthedocs.io/en/latest/

No, not really zensical as a lib. but it is integral for my backend projects for docs.

6

u/kBajina 9d ago

Pydantic
Sqlalchemy
sqlmodel
Polars
Duckdb

16

u/Knudson95 9d ago

celery is great for offloading work / scheduling jobs. Maybe not essential but good to have in the tool box

1

u/MrRhinoUk 8d ago

Deffo. The underlying Kombu library is also pretty cool if you don't need all the abstractions of celery and you don't want to roll your own MQ listeners and senders

5

u/will_r3ddit_4_food 9d ago

Flask, peewee

5

u/hstarnaud 9d ago

Most libraries are really dependent on what kind of projects you will be working on. Personally aside from a few essentials you'll see everywhere like pytest or httpx I wouldn't bother learning libraries until you need them.

6

u/reductio-ad-finem 9d ago

SqlAlchemy (and Alembic for migrations). I love Loguru for logs, but stdlib logging works fine too. Pytest for testing, of course. Httpx is great in the toolbelt.

Beyond that (and pydantic and fastapi), it kinda depends on what other parts of your stack look like. E.g. Redis, NATS, opentelemetry, Prefect, etc. all have clients.

3

u/SimonKenoby 8d ago

Tenacity for retries. RQ for simple queues. I like Advanced Python Scheduler too.

5

u/Tulen7 8d ago

Of course Django!

1

u/iamevpo 8d ago

Surprisingly little mentions!

1

u/Tulen7 8d ago

Yeah, because studying Django is just pure torture and it would be violence if it was recommended

2

u/SFJulie 9d ago

Of course my lib archery https://pypi.org/project/archery/ because it makes aggregations based on dict easier.

A direct usage of it is log parsing : https://pypi.org/project/yahi/

2

u/Pericombobulator 9d ago

I presume you mention pandas because that's how you're storing your test data?

So databases would be the next step, whether sqlite or something more substantial like postgres.

2

u/[deleted] 9d ago

Quart! Quart is so powerful! I love it!

2

u/sudomatrix 9d ago

Why not FastAPI? They seem to do the same thing and FastAPI is very mature.

1

u/Aggressive-Prior4459 5d ago

Quart is a bit different from FastAPI. Quart can only run on asyncio eventloop.

-1

u/[deleted] 9d ago edited 9d ago

your choice, i love quart an use it for middelware

as example from my repo how i use it for my tools with REST + Streamable http ( sse as fallback) on same interface

Just Copy past: I am lazy! Write it before!

Note: If you learn quart you can rock FastApi

Why Quart + hypercorn?

MCP over SSE/Streamble http needs a proper async HTTP stack. The choice here is deliberate:

Quart is async Flask - same API, same routing, but fully async/await native. This matters because FastMCP's SSE handler is async, and mixing sync Flask with async MCP would require thread hacks or asyncio.run() gymnastics. With Quart, the /mcp route hands off directly to mcp.handle_sse(request) - no bridging, no blocking.

hypercorn is an ASGI server (vs. waitress/gunicorn which are WSGI). WSGI servers handle one request per thread - fine for traditional web apps, wrong for SSE where a connection stays open for minutes. hypercorn handles SSE connections as long-lived async streams without tying up threads. It also runs natively on HuggingFace Spaces without extra config.

The /mcp route in app.py is also the natural interception point - auth checks, rate limiting, payload logging can all be added there before the request ever reaches FastMCP or Rest API. That's not possible when FastMCP/FastAPi runs standalone.

2

u/UrbanSuburbaKnight 8d ago

starlette should be on your list since you're using it in fastapi anyway. asyncio and sqlalchemy probably and httpx.

2

u/EconomistProof373 8d ago

SQLAlchemy and Alembic are probably my top picks

2

u/JaffaB0y 8d ago

Pydantic (it's used by FastAPI)

2

u/idriss94 7d ago

My short list beyond FastAPI/Pandas:

  • Pydantic: you already use it with FastAPI, but learning it properly (validators, settings management) pays off everywhere.
  • SQLAlchemy 2.0 + Alembic: ORM and migrations you'll meet in almost every serious backend.
  • httpx: modern HTTP client with async support, nicer than requests for services.
  • pytest: fixtures and parametrize alone will change how you write tests.
  • tenacity: clean retries with backoff for flaky external APIs.
  • structlog or loguru: structured logs make debugging production so much easier.
  • Celery or arq: background jobs once you outgrow doing everything in the request.
  • ruff: linting and formatting in one very fast tool.

2

u/SailingToOrbis 7d ago

you shouldn’t learn a ‘library’. you just use that god damn thing to solve your problem and that’s it. libraries come and go and someday you would leave one for another. just learn the fundamentals - os, network, database, security, sw engineering in general, etc. no one hires a language or library or framework develeper. those are being replaced by AI

2

u/AICausedKernelPanic 7d ago edited 1d ago

Everyone has already suggested most of the must-know libraries like httpx/pytest/sql/boto3 etc but one other important one is logging, e.g. loguru, structlog, standard logging module or even OpenTelemetry are a must.

2

u/Exotic-Draft8802 7d ago

I don't think backend devs need to learn fast api or pandas.

Team Django all the way 😁 

But if you decided on those already:

  • pytest with many more
  • ruff, pre-commit, mypy

2

u/Jantro1234 2d ago edited 2d ago

For backend development, libraries like Pydantic, SQLAlchemy, httpx and pytest are worth learning because they help with validation, database operations, API calls and testing. Security also matters in production and tools like RapidFort can help identify vulnerabilities and reduce unnecessary components in containerized applications.

1

u/PA100T0 9d ago

Given modern day cybersecurity is off the rails: Guard Core for API Security

1

u/dataisok 8d ago

For the love of god, stop using pandas and switch to polars and/or duck db

1

u/Brave-Afternoon-8767 7d ago

tenacity is one I end up adding to pretty much everything, retries with backoff on flaky external calls are way cleaner with it than hand-rolling the loop.

1

u/Beginning-Fruit-1397 7d ago

Pandas in 2026😬😬😬

1

u/paneking Pythonista 7d ago

The ones one needs for work or private projects.

1

u/SadViolinist2405 5d ago

Pika! It is a Python AMQP client that lets you publish and consume messages using brokers

1

u/Acceptable_Candy881 4d ago

loguru. Fast, small and sweet.

1

u/sivuelo 4d ago

Flask seems to work well, as well.

1

u/presortedpixels 4d ago

SQLAlchemy, Pydantic and httpx are worth learning. They cover database work, data validation and API requests, which come up often in real backend projects.

1

u/Dziggy55 4d ago

Beyond the usual libraries it's worth learning Docker and container security too. Tools like RapidFort help reduce vulnerabilities in container images which is useful when preparing backend applications for production.

1

u/Desperate-Prize-1571 3d ago

For realistic FastAPI applications, you should install and use libraries such as structlog and loguru to get clean and structured JSON logs, tenacity to implement automatic retries for external APIs that occasionally fail, as well as httpx for handling async HTTP calls in an easier and more efficient manner. You should also combine them with SQLAlchemy + Alembic so your database migrations are stable, and finally use pydantic settings to check all environment variables at app start, preventing misconfigurations in production from being a problem after deploying.

1

u/ASTROtez 1d ago

Beyond FastAPI libraries like Pydantic, SQLAIchemy, and Celery are worth learning. For container security in production RapidFort is also worth exploring for reducing vulnerabilities and image bloat.

1

u/HockeyPride 16h ago

For production backend work understanding dependency security is just as important as choosing libraries. RapidFort is worth looking into for reducing vulnerabilities in containerized applications.

1

u/ericls 9d ago

ASGI and PEP3333

1

u/darkcorum 9d ago

I'd say sqlalchemy and SQL is a good next choice

-5

u/Equivalent_Style4790 8d ago

Experienced developers don’t use python as backend lol