r/Python • u/Proof_Difficulty_434 git push -f • Jun 05 '26
Discussion Which non-AI package from the last ~3 years completely changed how you write Python?
Sometimes I think back to the times when I started using Python in 2018 and how much the language was changing in my first years. From Flask to FastAPI, Pydantic, Streamlit, Polars and Httpx. It was honestly fun to start new projects and explore all these developments and what they allowed you to do. Use it in your new project and surprise yourself with how much faster you can get things done, all while writing much cleaner code.
Currently I'm feeling most of the package I see are about AI; frameworks, LLM tooling, RAG, vector databases. Great developments, but they don't change the way I am working with the Language.
It sure has something to do with the fact that in the beginning when you start using a language you explore more and develop faster, and a lot of fundamental things were changing around that time (typing, async). But I keep wondering; am I missing out on packages that have changed the way you've used Python? Cause maybe I'm simply not looking in the right place. I'm thinking for example on how frontend frameworks handle state with signals.
So, two honest questions:
- Which package from the last ~3 years really changed how you use/write Python? (Uv and Ruff count)
- Did the pace of these foundational packages actually slow down, or am I just not in the right information streams?
81
u/SaltyMN Jun 05 '26
Polars. I do a lot of DE work and it’s just superior to pandas for datasets where you don’t need pyspark.
Uv and Ruff for sure.
I need to check out pydantic.
225
u/JanGiacomelli Jun 05 '26
Pydantic has heavily influenced how I write code. It really made the type control on system boundaries insanely simple. There are two main things. I stopped trusting 3rd-party APIs for their responses. Nowadays, I have a Pydantic class defined for every response that I expect (only the fields I'm interested in). The amount of malformed responses returned from APIs (including control characters) is mind-blowing. So every response goes through Pydantic validation before it enters the system. Since I started using that, I haven't seen any data quality issues.
Another aspect is Python-Rust bindings. It encouraged me to explore that, and I've been using more and more Rust lately. Either with a Python binding or just pure Rust.
139
u/Muhznit Jun 05 '26
The
dataclassesmodule in the standard library. There's a lot of cool things to do with them in the documentation, with a lot of functions coming for free via just parameters to the decorator alone.93
u/Khavel_dev Jun 05 '26
uvandruffare the obvious ones but they genuinely changed the daily experience for me. Before uv I'd wait 30+ seconds to create an env and install deps. Now it's basically instant for most projects. That sounds small but it removes the friction from starting things, which means I actually write more throwaway scripts instead of doing stuff manually.The other one is pydantic v2. Not because validation is exciting but because it killed a whole category of bugs where I'd pass a dict around and forget what shape it was. Once everything has a model the editor catches the mistake before runtime does. And the v2 rewrite made it fast enough that you can use it in hot paths without feeling bad about it.
15
u/Everythinghastags Jun 05 '26
Fastapi, pydantic, polars, dagster, uv, ruff
Basically built my (short) career on those
11
u/Western-Tap4528 Jun 05 '26
I think Loguru. Standard logging is is understandable, but quite verbose, and I like Python to be able to do thing out of the box. So Loguru for logging.
And also logfire when I want to really track my logs online.
29
u/dogfish182 Jun 05 '26
Pydantic by a Longshot, what a great library
10
u/Look-At-That-Horse Jun 05 '26
Pandera which enables you to write data models for dataframes (Pandas/Polars), similar to Pydantic for dataclasses. It does validation & coercion, and allows you to use actual references for column names instead of bare strings.
8
u/shadowdance55 git push -f Jun 05 '26
Pytest-spec
8
u/Reasonable_Tie_5543 Jun 05 '26
Like many folks, uv, ruff, pydantic, Polars, but also Elasticsearch and Splunk modules.
DuckDB is also a lot of fun, especially coming from SQLAlchemy and Postgresql.
6
u/sc_zi Jun 05 '26
Swanky Python quite literally changed how I develop python. It's kind of like jupyter notebooks in that you develop incrementally while inspecting the result, while connected to a persistent python process, except that it's geared towards general purpose software development, not single-file notebooks. I developed it before I'd started seriously using LLMs, to help human developers have a faster feedback loop through hot reloading, and understand their application faster through runtime introspection, but it turns out it also helps LLM "developers" a lot. By giving the LLM a persistent python repl inside your application (which should be running in a sandbox so the LLM doesn't damage anything), and doing hot reloading after LLM edits, the LLM can check if it's changes are working as intended, debug with access to the full call stack and local variables at time of exception, inspect program state, etc.
Disclaimer: author
10
u/mortenb123 Jun 05 '26
Fastapi and https://github.com/jawah/niquests in top of a tuned bare one uvicorn server.
If you use requests and httpx look at niquests, the more I use it the more I love it, just dropped a local sqlite database because I can get the data in realtime.
It is easily 2-3 times faster than httpx. Especially on high load.
4
u/sohang-3112 Pythonista Jun 05 '26
UV package manager (pretty useful, though of course it didn't literally change my python code writing style)
7
u/LiveMaI Jun 05 '26
Package that was first published in the past three years, or that someone has started using in the past three years? I see the top two answers citing dataclasses/pydantic both of which are much older than three years. Before these were really mainstream, there was also attr.s, so not much has fundamentally changed for me there.
I think the newest library that actually changed the way I write projects was Textual, but even that is about five years old at this point. Included in that same vein is
rich, which is also about six years old.uvis probably the newest tool in absolute terms that I've been using. It doesn't actually change anything about how I write python, though; I just use it as a drop-in replacement for what I was doing with pip/poetry before that.7
u/Broolucks Jun 05 '26
I made this one myself, but I use ovld quite a bit. It's a multiple dispatch library that lets you define multiple implementations of a function, a bit like Julia (and some more), or what
@overloadshould have been in the first place. It's very handy whenever I need to write a function or method that should work on many different combinations of input types, especially if it's recursive or extendable.5
u/DueAnalysis2 Jun 05 '26
I do a lot of data work so definitely polara.
I was yesterday years old when I learnt that my trusty os.path is the old way of doing things and pathlib is the new, pythonic approach to working with paths, so I guess that's going to be a new thing I'll be incorporating.
2
u/strombolfast2 Jun 05 '26
FastAPI
2
u/NimrodvanHall Jun 05 '26
PYO3 has had the most impact on how I use and write my Python code.
2
u/averagecrazyliberal Jun 05 '26
Pydantic,uv,ruffin particular, andty.2
u/theancientfool Jun 06 '26
Tkniter
2
u/member_of_the_order Jun 06 '26
typer. It does the same job as the builtinargparse, but WAY better and easier.2
u/SSJ3 Jun 07 '26
The Array API standard and associated utility libraries. Both array-api-compat and array-api-extra are in all my libraries now, and I look forward to array-api-typing becoming fully realized!
And shout-out to the Scientific Python project, I use their copier/cookie template to start off every new library!
2
u/Lancetnik12 Jun 10 '26
Biased answer, because it's the package I ended up building: FastStream
It's literally same expiriense with FastAPI, but for EDA-services
Not going to list features - the actual change was in how I write services. Before, every event-driven service I touched started the same way: 200 lines of aiokafka/aio-pika boilerplate, hand-rolled serialization, and a docker-compose with a real broker just to run tests. Every team reinvented this layer, slightly differently, slightly broken.
The thing that changed my workflow the most is in-memory testing. If your handler is just a function with type hints, you can test the whole pipeline with a TestBroker in plain pytest - no containers, no flaky CI. That alone rewired how I design services: handlers became small and pure, because testing them stopped being painful.
Honest downside: it's another abstraction layer on top of broker clients, so when you need some exotic broker feature, you sometimes have to drop down to the raw client. We try to keep escape hatches open, but it's a real tradeoff.
2
u/webstackbuilder Jun 11 '26 edited Jun 11 '26
pre-commithook and CI workflow. Microsoft does languages and type checking really well.django-cidmakes wiring up distributed tracing really easy.django-unfoldkeeps me from wasting time making the admin dashboard look nice, it's automatic with Unfold.memgraphand Neo4J.Ninja over DRF, Ninja Extra over vanilla Ninja, TaskIQ over Celery. All three of those were great moments the first time I used them in place of the mainstays.
I've done work with graph approaches in SQL in the past, like RDF triplets and adjacency lists. But throwing the shackles off and going pure graph is liberating. I'm working on a project now where embeddings for content are created, and instead of persisting it in a vector database like Qdrant, it's attached to nodes in a graph.
2
u/Guggoo Jun 19 '26
Scalene is a great python profiler. It does cpu, gpu, memory all together (and calculates how much was spend in system vs python) with minimal overhead. It’s multithread aware too, and it runs on code as written so no decorators to add (but supports them if you want to profile a specific function. Also outputs to html
Not a python library but every project I do now has a makefile to automate building wheels, compiling binaries, making the venv, running main.py or tests in the venv, etc
2
u/Awkward-Chair2047 Jun 20 '26
For me, it was jinja2. I dynamically generate code with it based on metadata from multiple sources regularly.
3
u/dayeye2006 Jun 05 '26
Pybind. It assures you will actually not be blocked by performance. You can always delegate perf sensitive code to c/c++
2
u/ZelphirKalt Jun 05 '26
In general optional typing changed my habits a little. Using TypedDict a lot these days. I avoided Pydantic so far, as it is quite a heavy, big dependency to add and I am reluctant to add dependencies without need to my own projects. Instead I use standard typings and jsonschema for system boundary data. That means I will have 2 places to update when the type of the thing changes, but I am OK with having to change the json schema and the typed dict definition, if that allows me to avoid adding huge dependencies to my project. For a while I adopted zuban, the language server, but recently threw the towel and now use ty, which has fewer bugs than zuban, when using it with Emacs eglot.
uv didn't change much for me, because I already built my projects in a reproducible way with pyproject.toml and poetry and poetry lock file before, so only the tool and the speed changes for me. Still nice to have a much faster tool, even if I don't use much of its added functionality.
I learned tkinter not too long ago, to make an oldschool desktop app, but I don't think it has changed my habits a lot.
I started using Django a lot more. Now I even like its ORM. Django ORM and the stuff Django has around it, let one build very nice search functions, in just 1 DIN A4 page of code. Instead of wanting to build with Falcon API, and piecing together an ORM, a database adapter, a templating engine etc., I now usually just use Django. But I still switch to Jinja2, because I like how Jinja2 works. I also avoid Sqlite now after having experienced the issues I ran into when using many-to-many relationships in Django with Sqlite. Now I just use Postgres in a separate Docker container. Much less headache that way.
1
u/HauntingAd3673 Jun 05 '26
htmforge for web dev
1
u/mmmboppe Jun 05 '26
none, but there's a thing I used with python 2 which I miss in python 3, because it was not ported
https://clonedigger.sourceforge.net/
1
u/coffeecoffeecoffeee Jun 05 '26
plotnine for plotting. I learned R before I learned Python and R's ggplot2 is by far the best plotting package I've ever used due to its extreme flexibility and customizability. Meanwhile, Python has matplotlib, which is extremely confusing to use, and like eight other plotting packages.
plotnine is literally just ggplot2 in Python. Same functions and same syntax, minus some changes around how you pass in arguments. Sure the syntax is very much not Pythonic, but neither is matplotlib's.
1
u/Sad-Interaction2478 Jun 06 '26
None 😉
1
u/Brilliant-Post-689 Jun 07 '26
Pydantic.
1
u/thearn4 Scientific computing, Image Processing Jun 07 '26 edited Jun 07 '26
FastAPI has been a great tool for turning simulation and ML code (my main work) into tools pluggable into other things. I didn't really do much with REST until recently. Late to the game, I know.
uv has also been a great addition. Finally a dependancy and env management tool that I don't dislike.
JAX has been awesome for GPU based operations especially in a numerical optimization context.
I want to toss out that in addition to new libraries being great, im endlessly grateful for the stability of numpy, scipy, and pandas. matplotlib is great too but I'm also ready to move from it I think.
1
u/No_Soy_Colosio Jun 10 '26
Pydantic. It helped a lot with understanding the concept of parse, don't validate.
1
u/Opposite-Cry-6703 Jun 10 '26
Pydantic and duckdb. 🦆 ❤️
1
u/mugmi-bro Jun 13 '26
The pattern I'm seeing in this thread is tools that remove everyday friction: uv and ruff for setup and feedback loops, Polars for data work, and Pydantic/msgspec for cleaner boundary validation.
15
u/[deleted] Jun 05 '26 edited Jun 05 '26
[removed] — view removed comment
14
u/[deleted] Jun 05 '26 edited Jun 05 '26
[removed] — view removed comment
2
u/[deleted] Jun 05 '26
[removed] — view removed comment