uv 0.12.0 发布:uv init 默认改为 src 布局

uv 0.12.0

精选理由

uv 新版把项目默认改成 src 布局了,还自动配好构建后端,想跟上最佳实践的话可以试试。

AI 摘要

uv 0.12.0 版本包含多项破坏性变更,其中 uv init 命令的默认项目结构从根目录的 main.py 改为 src/ 布局。新版本还会自动配置 uv_build 后端,用于构建 wheel 和 .tar.gz 分发包。uv init 同时设置了脚本别名,通过 uv run uv-init 可执行 src/uv_init/__init__.py 中的 main() 函数。该版本提升了项目结构规范性和构建流程自动化。

原文 · Simon Willison’s Weblog

uv 0.12.0

uv 0.12.0 Some interesting breaking changes in this release of uv , in particular to the default project produced by the uv init command. uv init is the uv shortcut for creating a new project. The previous version of uv , version 0.11.x, produced this directory when you ran uv init uv-init . Here's what you get with uv 0.12 . I have a GitHub repository that automatically snapshots the output of uv init , so you can also see the full diff : uv init now defaults to a src/ shaped package, instead of dropping main.py in the root of the project. It also configures the uv_build backend for building wheels and .tar.gz distribution files when you run uv build . Finally, it sets up uv-init as a script alias which, when run with uv run uv-init , executes a new main() function in src/uv_init/__init__.py . I've so far avoided using src layout in my own projects just out of inertia. I think it's time I switched. Tags: packaging , python , uv