跳至内容

构建

构建用于分发的包。

在正常情况下,Rye 会自动为本地开发构建包。但是,如果您想要发布包,则需要先将它们构建成源发行版 (sdist) 和二进制/可移植发行版 (wheel)。

有关更多信息,请参阅 构建和发布

示例

这会同时构建轮子包和源发行版

$ rye build
building my-project
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for wheel...
* Building wheel...
Successfully built my_project-0.1.0.tar.gz and my_project-0.1.0-py3-none-any.whl

默认情况下,您会在 dist 文件夹中找到工件。

参数

无参数

选项

  • --sdist: 构建 sdist

  • --wheel: 构建轮子包

  • -a, --all: 构建所有包

  • -p, --package <PACKAGE>: 构建特定包

  • -o, --out <OUT>: 输出目录(默认为 workspace/dist

  • --pyproject <PYPROJECT_TOML>: 使用此 pyproject.toml 文件

  • -c, --clean: 首先清理输出目录

  • -v, --verbose: 启用详细诊断

  • -q, --quiet: 关闭所有输出

  • -h, --help: 打印帮助信息