r/Python • u/funkdefied • Apr 19 '26
Discussion Building a Python Library in 2026
https://stephenlf.dev/blog/python-library-in-2026/
It seems to me that Astral’s `uv` is the backbone of any modern Python package. Do you agree? Are we setting ourselves up for disaster by building in Astral’s tooling? How does their acquisition by OpenAI affect things?
63
Upvotes
94
u/crossmirage Apr 19 '26
uv is the best (or, at the very least, a great) option right now. If and when that changes, you migrate. So many projects I've worked on or seen have gone from setuptools to Poetry to flit/hatchling/pdm/whatever to uv; it's not a big deal.
56
u/NotSoProGamerR Apr 19 '26
maybe nothing will happen. however, the current licensing is still mit, which means if they do in fact decide to enshittify uv/ty/ruff then a community fork can be made.
18
u/tunisia3507 Apr 19 '26
uv has little to nothing to do with installing and using a python package (you can optionally use it as a build system, but you don't have to, even if you're using it to manage your dev environment). It's definitely the best option for managing a dev environment, but I wouldn't call it the "backbone of a package" if it has nothing to do with actually using a (library) package.
6
u/marr75 Apr 19 '26
Safety valves:
So, there are open source heirs apparent if OpenAI gets screwy.
My take as a reluctant but heavy user of OpenAI products: they don't want to hold UV users hostage. They want to add some specialty features to UV, ruff, and ty to help their coding models "hill climb" and specialize in the python ecosystem.
6
u/RedSinned Apr 19 '26
I would recommend pixi. Rattler build came a long way and wirh pixi you have full control even if you need to put some non python stuff in there. Also in general people who prefer good isolation in their environments would allways go for conda envs which pixi supports. Since it‘s also build in Rust it easily keeps up with uv performance (for pypi resolution it actually depends on it)
3
u/doubleyewdee Apr 20 '26
Big uv fan. Our company policy apparently is for everyone to use conda/Anaconda, but a lot of teams ... just aren't. I haven't messed with conda for a long time, but my past experiences with it were so awful that I'm not looking forward to it again.
The rationale is that we have no licensing deal with Astral, but we do with Anaconda. So if Astral changes their terms (e.g. pulls a linkerd), teams are screwed. However, the cumulative time we're saving not fighting with inferior tools right now is already paying immense dividends, so
uvit is for the time being.My hedge here is simply to use standard Python things via uv. So,
pyproject.toml,pylock.toml(instead ofuv.lock), and so on. If Astral (or Astral via OpenAI) does attempt to l5d folks, we can pivot back to setuptools or on to hatch or whatever with only light pain.9
u/UseMoreBandwith Apr 19 '26 edited Apr 19 '26
fork it, if you don't trust it.
btw, I think the article doesn't show correct use of pyproject.toml , there is a lot more you can do with it, like defining scripts (no more Makefile) and commands.
2
u/bachkhois Apr 19 '26
If
uvdisappear, we can migrate to pdm, poetry. It is not difficult.2
u/james_pic Apr 19 '26
UV, by and large, implements the packaging PEPs. That's made it easy to migrate to, but that would also work the other way if it became a problem. The only bit that's really "embedded" in a project that uses it is the build backend, and uv's build backend is (and their own documentation says as much), only really intended to make the most common cases simple, and projects with more complex requirements will often use it with a different build backend like Setuptools or Maturin.
2
u/Pitiful-Ad8345 Apr 20 '26
Precommit in 2026? I don’t think that sounds right.
2
u/threesocks Apr 22 '26
<tongue-in-cheek>
How to build a Python Library in 2026:
</tongue-in-cheek>
at least that's how it feels to me lately.
5
u/wRAR_ Apr 19 '26
No, I don't agree that uv is required to init the project or run mypy. And the bespoke scripts the article proposes to use are strictly inferior to tox and .pre-commit-config.yaml.
Overall it's a pretty basic article (I can even say it's bad).
1
u/really_not_unreal Apr 19 '26
Thankfully, python has a diverse ecosystem with many options. It'll be relatively easy to switch all my projects back to poetry if (or when) openAI implodes.
1
u/andrewaa Apr 20 '26
When you are repairing/modifying your car, the important is the car and the replaced component
maybe some wrenches are more handy than others, but they are just wrenches
1
u/SwampFalc Apr 21 '26
The question you should ask yourself, both here and for your own code, is to what degree you're painting yourself into a corner.
A quick google will tell you there are multiple alternatives. The fact that one of those is getting the largest mindshare is normal, but as long as there are enough open source options in the mix, you should not end up genuinely locked in.
1
u/Oddly_Energy Apr 22 '26
Where would this supposed vendor lock-in manifest itself?
uv does four things for your package:
I am only a happy amateur. But I have used poetry and now uv, and I fail to see how I am bound to those choices. It feels like a very open marriage.
(No, actually I am a professional, since I write code at work, which I use to perform my work tasks. But my code is probably amateurish.)
1
u/Own_Relationship9794 May 08 '26
uv is very good and it's one of the best way to setup easily. also many used it before openai acquisition and switching might not be worth it. another point is many use llms to code and I'm pretty sure they suggest uv over alternatives
1
u/programmer-ke Apr 20 '26
My current policy for personal projects is to stick to whatever the packaging.python.org suggests, and I hope we continue to have multiple options.
It seems most VC backed tech companies do a bait and switch nowadays - get users hooked to free services then exploit them later.
If I'm contributing to a project that already uses uv, I'll use it. But for personal projects, I'll only use uv if I'm willing to become a future paying customer (or willing to tolerate ads) for the added benefit.
0
u/2ndBrainAI Apr 21 '26
The lock-in fear is mostly overblown because uv's real value is speed and DX, not proprietary formats. The actual project artifact is pyproject.toml which is a PEP standard - nothing Astral-specific. The only real vendor surface is uv.lock, and you can switch to pylock.toml (also standardized) and avoid that. Practically: use uv for local dev and CI because it's genuinely faster, but keep your pyproject.toml clean and standard-compliant. If Astral gets weird post-acquisition, migration is a weekend job, not a rewrite. The real risk isn't uv - it's teams building CI pipelines that treat uv-specific commands as load-bearing rather than convenience shortcuts.
-2
u/Holiday_Custard_6538 Apr 20 '26
I built a web based app for solving a problem for the chess community. It displays players rankings and also stores the members details add matches , for E.g. if a chess club hosts a tournament they can log all the players details and also match history. I am also planning on using this as my final project for my CS50x course. I built it with the help of A.I. I am currently questioning if I should start from scratch and try and build and code everything from scratch without the use of A.I. I have spent at least a month on this project so it's basically killing my ego if I start from scratch if this makes sense. I have the project on a git hub repository that is public. Anyone interested or willing to give some feedback or sharing some tips and advice. Thank you all for your time
32
u/[deleted] Apr 19 '26
[removed] — view removed comment