<aside> <img src="notion://custom_emoji/9040cc52-5c24-4c85-8328-7061a24dd7f9/1b0d969b-881f-806e-93ce-007a91128a50" alt="notion://custom_emoji/9040cc52-5c24-4c85-8328-7061a24dd7f9/1b0d969b-881f-806e-93ce-007a91128a50" width="40px" />

requirements.txt → poerty → uv → pyproject.nix

uv 能够管理依赖和虚拟环境,依赖允许来自git仓库https://docs.astral.sh/uv/concepts/projects/dependencies/#changing-dependencies。uv等现代性包管理器利用hash锁定依赖。uv依托python的setuptools编译依赖。

nix的加入允许非特定语言地描述依赖(仅用nix),适用复杂依赖项目且熟悉nix。

</aside>

https://docs.astral.sh/uv/

https://www.cnblogs.com/wang_yb/p/18635441

工作流

mkdir demo && cd demo
uv init
echo "requests" > pyproject.toml
uv sync
.venv\\Scripts\\activate
uv pip list

Features

<aside> <img src="notion://custom_emoji/9040cc52-5c24-4c85-8328-7061a24dd7f9/1c4d969b-881f-80a8-af08-007ac306aa34" alt="notion://custom_emoji/9040cc52-5c24-4c85-8328-7061a24dd7f9/1c4d969b-881f-80a8-af08-007ac306aa34" width="40px" />

. ├── .venv │   ├── bin │   ├── lib │   └── pyvenv.cfg ├── .python-version ├── README.md ├── main.py ├── pyproject.toml └── uv.lock

</aside>