@@ -11,23 +11,22 @@ It provides drop-in replacements for `py_binary`, `py_library`, and `py_test` th
1111- ** Seamless IDE compatibility** via virtualenv-native structures
1212- ** Production-ready containers** with optimized OCI image layers
1313
14- Unlike ` rules_python ` , which maintains strict compatibility with Google's internal monorepo semantics (google3),
1514` aspect_rules_py ` optimizes for modern Python development workflows, large-scale monorepos, and Remote Build Execution (
1615RBE) environments.
1716
1817## Advantages Over ` rules_python `
1918
20- | Feature | rules_python | rules_py |
21- | :---| :---| : ---|
22- | Dependency resolution | ` pip.parse ` (repo rules, loading phase) | Build-action wheel installs (` whl_install ` ) |
23- | uv integration | ` uv pip compile ` → ` requirements.txt ` → ` pip.parse ` | Native ` uv.lock ` consumption |
24- | Cross-platform lockfile | Per-platform ` requirements_* .txt` | Single ` uv.lock ` for all platforms |
25- | sdist / PEP 517 builds | Not supported ([ #2410 ] ( https://github.com/bazel-contrib/rules_python/issues/2410 ) , open since Nov 2024) | Build actions (` pep517_whl ` , ` pep517_native_whl ` ) |
26- | Interpreter provisioning | Download via rules_python extension | Own [ python-build-standalone] ( https://github.com/astral-sh/python-build-standalone ) extension — no rules_python required |
27- | Site-packages layout | ` sys.path ` / ` PYTHONPATH ` manipulation | Standard ` site-packages ` symlink tree |
28- | Cross-compilation | Limited | Native platform transitions (e.g. arm64 image on amd64 host) |
29- | Virtual dependencies | No | ` virtual_deps ` — swap implementations at binary level |
30- | PEP 735 dependency groups | No | ` --@pypi//venv=prod ` flag |
19+ | Feature | rules_python | rules_py |
20+ | :-------------------------- | :-------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------- ---|
21+ | Dependency resolution | ` pip.parse ` (repo rules, loading phase) | Build-action wheel installs (` whl_install ` ) |
22+ | uv integration | ` uv pip compile ` → ` requirements.txt ` → ` pip.parse ` | Native ` uv.lock ` consumption |
23+ | Cross-platform lockfile | ` requirements .txt` ( ` uv.lock ` via ` uv pip compile ` ) | Native single ` uv.lock ` consumption |
24+ | sdist / PEP 517 builds | Not supported ([ #2410 ] ( https://github.com/bazel-contrib/rules_python/issues/2410 ) , open since Nov 2024) | Build actions (` pep517_whl ` , ` pep517_native_whl ` ) |
25+ | Interpreter provisioning | Download via rules_python extension | Own [ python-build-standalone] ( https://github.com/astral-sh/python-build-standalone ) extension — no rules_python required |
26+ | Site-packages layout | Standard ` site-packages ` layout (flag-enabled) | Standard ` site-packages ` symlink tree |
27+ | Cross-compilation | Limited | Native platform transitions (e.g. arm64 image on amd64 host) |
28+ | Virtual dependencies | No | ` virtual_deps ` — swap implementations at binary level |
29+ | PEP 735 dependency groups | No | ` --@pypi//venv=prod ` flag |
3130
3231> [ !NOTE]
3332> ** rules_python's uv support** : ` rules_python ` 's uv integration runs ` uv pip compile ` as a build action to
@@ -41,12 +40,11 @@ Instead of relying on legacy `pip` machinery, we provide native integration with
4140a Rust-native Python package resolver.
4241
4342- ** Build-action installs** : Wheel extraction runs as Bazel execution-phase actions—not repo rules—so they are
44- cacheable, sandboxed, and compatible with RBE. Crucially, wheels are no longer resolved against the host machine
43+ sandboxed and compatible with RBE. Crucially, wheels are no longer resolved against the host machine
4544 architecture: a single build can fetch and extract wheels for any exec or target platform, enabling true
4645 cross-platform builds (e.g. building Linux ` aarch64 ` wheels on a macOS ` x86_64 ` host)
4746- ** Native ` uv.lock ` parsing** : Consumes ` uv.lock ` directly; no ` requirements.txt ` generation step
48- - ** Universal lockfiles** : A single ` uv.lock ` works across all platforms—no more ` requirements_linux.txt ` ,
49- ` requirements_mac.txt ` , ` requirements_windows.txt `
47+ - ** Universal lockfiles** : A single ` uv.lock ` works across all platforms
5048- ** sdist / PEP 517 builds** : Build source distributions as Bazel actions (rules_python has no equivalent;
5149 [ #2410 ] ( https://github.com/bazel-contrib/rules_python/issues/2410 ) open since November 2024)
5250- ** PEP 735 dependency groups** : Define ` prod ` , ` dev ` , ` test ` dependency groups and switch between them with a flag
@@ -399,12 +397,12 @@ For detailed migration guidance, see [docs/migrating.md](docs/migrating.md).
399397
400398## Architecture
401399
402- | Layer | Implementation | Description |
403- | :---------------| :---------------------------------- | :-------------------------------------------------------------------------------------|
404- | ** Toolchains** | ` @aspect_rules_py//py ` | Own python-build-standalone interpreter provisioning; ` @rules_python ` optional |
405- | ** Resolution** | ` @aspect_rules_py//uv ` | Fast, lockfile-backed dependency resolution with ` uv ` |
406- | ** Execution** | ` @aspect_rules_py//py ` | Drop-in replacements for ` py_binary ` , ` py_library ` , ` py_test ` with sandbox isolation |
407- | ** Generation** | ` aspect-gazelle ` | Pre-compiled Gazelle extension—no CGO toolchain required |
400+ | Layer | Implementation | Description |
401+ | :---------------| :-----------------------| :-------------------------------------------------------------------------------------|
402+ | ** Toolchains** | ` @aspect_rules_py//py ` | Own python-build-standalone interpreter provisioning; ` @rules_python ` optional |
403+ | ** Resolution** | ` @aspect_rules_py//uv ` | Fast, lockfile-backed dependency resolution with ` uv ` |
404+ | ** Execution** | ` @aspect_rules_py//py ` | Drop-in replacements for ` py_binary ` , ` py_library ` , ` py_test ` with sandbox isolation |
405+ | ** Generation** | ` aspect-gazelle ` | Pre-compiled Gazelle extension—no CGO toolchain required |
408406
409407## License
410408
0 commit comments