Using Bzlmod with Bazel 6:
Add to your MODULE.bazel
file:
bazel_dep(name = "aspect_rules_py", version = "1.0.0")
And also register a Python toolchain, see rules_python. For example:
# Minimum version needs:
# feat: add interpreter_version_info to py_runtime by @mattem in #1671
bazel_dep(name = "rules_python", dev_dependency = True, version = "0.29.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.11",
)
Using WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "aspect_rules_py",
sha256 = "2ce48e0f3eaaf73204b623f99f23d45690b862a994b5b3c2464a2e361b0fc4ae",
strip_prefix = "rules_py-1.0.0",
url = "https://github.com/aspect-build/rules_py/releases/download/v1.0.0/rules_py-v1.0.0.tar.gz",
)
# Fetches the rules_py dependencies.
# If you want to have a different version of some dependency,
# you should fetch it *before* calling this.
# Alternatively, you can skip calling this function, so long as you've
# already fetched all the dependencies.
load("@aspect_rules_py//py:repositories.bzl", "rules_py_dependencies")
rules_py_dependencies()
load("@aspect_rules_py//py:toolchains.bzl", "rules_py_toolchains")
rules_py_toolchains()
# "Installation" for rules_python
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
python_register_toolchains(
name = "python_toolchain",
python_version = "3.9",
)
py_repositories()
What's Changed
- fix: include default layer groups. by @thesayyn in #410
- fix: Handle single-file module pypi-deps in py_pex_binary by @ekfeet in #392
- fix: split on site-packages path segment when reporting conflicts by @mattem in #413
- chore: bump bazel to 7.4.0 by @mattem in #416
- chore: test on Bazel 8 rather than Bazel 6 by @alexeagle in #421
- chore: run CI for all pull requests by @mattem in #419
- chore: bump rules_rust to 0.53.0 by @mattem in #417
- chore: trigger PRs on synchronize by @mattem in #422
- chore: bump rust version to 1.81.0 by @mattem in #418
- feat: drop rattler_installs_packages for uv crates by @mattem in #412
- chore: disable broken test by @alexeagle in #429
- Add types to file generated by test.py by @antspy in #428
- fix: flip unused_inputs=1 by default by @thesayyn in #432
New Contributors
Full Changelog: v0.9.1...v1.0.0