| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
原始链接: https://news.ycombinator.com/item?id=43307563
这篇 Hacker News 帖子讨论了新型 Python 包管理器 “uv” 的日益普及,它旨在取代 pyenv、pip、conda 和 poetry 等工具。用户称赞 uv 在依赖项解析和安装方面的速度,使 Python 开发更快更令人愉快。 重点突出的功能包括其直观的命令行界面 (CLI)、支持工作区的单体仓库 (monorepo)、通过 “uv tool install” 替代 pipx,以及新颖的 “uv run” 命令,该命令可以直接从脚本注释 (PEP 723) 自动创建临时虚拟环境并安装必要的依赖项。 虽然一些用户提到了与 GPU 特定依赖项相关的次要问题,以及考虑到其背后的公司,可能存在的盈利问题,但总体情绪 overwhelmingly positive。许多人认为 uv 极大地改善了 Python 开发人员的体验,甚至呼吁现有工具承认 uv 是一个更优的解决方案。
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've used 'em all, pip + virtualenv, conda (and all its variants), Poetry, PDM (my personal favorite before switching to uv). Uv handles everything I need in a way that makes it so I don't have to reach for other tools, or really even think about what uv is doing. It just works, and it works great.
I even use it for small scripts. You can run "uv init --script" and then "uv add package1 package2 package3 --script ". This adds an oddly formatted comment to the top of the script and instructs uv which packages to install when you run it. The first time you run "uv run ," uv installs everything you need and executes the script. Subsequent executions use the cached dependencies so it starts immediately.
If you're going to ask me to pitch you on why it's better than your current preference, I'm not going to do that. Uv is very easy to install & test, I really recommend giving it a try on your next script or pet project!
reply