r/Python • u/niRmana_dev • 1d 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?
44
Upvotes
63
u/BiologyIsHot 1d ago edited 1d ago
Is pandas useful for backend development? Maybe sqlachemy or something instead? Pydantic I consider already part of learning fastapi
32
u/Efficient_Bobcat_697 1d 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 complet ORM than sqlalchemy.
Anyio as a some interesting goodies on top of asyncio also
19
u/PrestigiousStrike779 1d ago
Sqlalchemy Boto3 if you’re on AWS
9
u/mttpgn Pythoneer 1d ago
To those saying both `boto3` and `pandas`, it's `awswrangler`.
3
u/Samhain13 1d 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.
5
u/zzmej1987 1d ago
Django for the same reason as fastapi and dash for when you don't have time to wait for the front end.
150
u/martinky24 1d ago
Pydantic
2
u/Best_Tea9451 20h 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/TPECKA180 17h 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.
64
u/cig-nature 1d ago
The built-in collections module never gets enough love, and is always useful.
https://docs.python.org/3/library/collections.html
16
u/OkCardiologist8006 1d ago
testcontainers is a big one imo. spinning up a real throwaway postgres or redis for your pytest run catches the stuff mocks happily let through, like a migration that doesn't actually apply or a query that only breaks on the real db
24
u/GrainTamale Pythonista 1d ago
SQLite, DuckDB, requests
20
u/RedSinned 1d ago
You don‘t need pandas. Go for polars
19
u/Wide_Guava6003 22h ago
Polars. Instead of pandas. Nobody should learn pandas.
13
u/dusktreader 1d ago
httpx2, typer/click, loguru, pydantic, pendulum, inflection, sqlalchemy/alembic, boto3, pytest, and zensical.
6
u/kBajina 1d ago
Pydantic
Sqlalchemy
sqlmodel
Polars
Duckdb
5
u/will_r3ddit_4_food 1d ago
Flask, peewee
5
u/patryk_builds 20h 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
13
u/Knudson95 1d ago
celery is great for offloading work / scheduling jobs. Maybe not essential but good to have in the tool box
4
u/hstarnaud 1d 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.
4
u/todorpopov 18h 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).
6
u/reductio-ad-finem 1d 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/Fine_League311 1d ago
Quart! Quart is so powerful! I love it!
3
u/SimonKenoby 15h ago
Tenacity for retries. RQ for simple queues. I like Advanced Python Scheduler too.
4
u/Tulen7 15h ago
Of course Django!
2
u/SFJulie 1d 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 1d 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/UrbanSuburbaKnight 21h ago
starlette should be on your list since you're using it in fastapi anyway. asyncio and sqlalchemy probably and httpx.
2
u/EconomistProof373 19h ago
SQLAlchemy and Alembic are probably my top picks
2
u/JaffaB0y 12h ago
Pydantic (it's used by FastAPI)
2
u/billFoldDog 12h ago
numpy
2
u/jimbiscuit 20h ago
Plone
1
u/PA100T0 22h ago
Given modern day cybersecurity is off the rails: Guard Core for API Security
1
u/Electrical-Tax-6670 18h ago
Msal
1
u/ericls 1d ago
ASGI and PEP3333
1
u/darkcorum 22h ago
I'd say sqlalchemy and SQL is a good next choice
-3
u/Equivalent_Style4790 11h ago
Experienced developers don’t use python as backend lol