Linux command
uv-build 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Build package
uv build
Build wheel only
uv build --wheel
Build sdist only
uv build --sdist
Build to specific directory
uv build --out-dir [dist]
Build both sdist and wheel
uv build --sdist --wheel
Build a specific package
uv build --package [mypackage]
Build from a specific source directory
uv build [src/]
说明
uv build builds Python packages from source into distributable wheel and/or source distribution packages. It supports PEP 517/518 build systems. By default, uv build builds the project in the current directory and places artifacts in a dist/ subdirectory. Both wheel and sdist are produced by default; use --wheel or --sdist to build only one. Build isolation is enabled by default, installing build dependencies in an isolated environment. Use --no-build-isolation to build using the existing environment instead.
参数
- --wheel
- Build wheel (binary distribution) only.
- --sdist
- Build source distribution only.
- --out-dir _dir_
- Output directory. Default: dist/.
- --no-build-isolation
- Disable build isolation (use existing environment).
- --package _name_
- Build a specific package within the current workspace.
- --build-constraint _requirement_
- Constrain versions of build requirements.
- --require-hashes
- Require hashes for build dependencies for reproducibility.
- --python _version_
- Python interpreter to use for build.
- --config-setting _KEY=VALUE_
- Pass settings to the PEP 517 build backend.
- --all-packages
- Build all packages in the workspace.
FAQ
What is the uv-build command used for?
uv build builds Python packages from source into distributable wheel and/or source distribution packages. It supports PEP 517/518 build systems. By default, uv build builds the project in the current directory and places artifacts in a dist/ subdirectory. Both wheel and sdist are produced by default; use --wheel or --sdist to build only one. Build isolation is enabled by default, installing build dependencies in an isolated environment. Use --no-build-isolation to build using the existing environment instead.
How do I run a basic uv-build example?
Run `uv build` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --wheel do in uv-build?
Build wheel (binary distribution) only.