Using Bzlmod with Bazel 6:
Add to your MODULE.bazel
file:
bazel_dep(name = "aspect_rules_py", version = "1.1.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 = "0dcde9c64a0cf914fae2b785abd3c5b057b61ef208b4b3af225f311d01a0114f",
strip_prefix = "rules_py-1.1.0",
url = "https://github.com/aspect-build/rules_py/releases/download/v1.1.0/rules_py-v1.1.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
- Revert "Add types to file generated by test.py" by @mattem in #435
- Add backwards compatible types to file generated by test.py by @hofbi in #441
- example: Add example for pybind11 by @hofbi in #375
- chore: downstream https://github.com/bazel-contrib/rules-template/pul… by @alexeagle in #445
- Revert "example: Add example for pybind11" by @alexeagle in #444
- docs: document virtual_deps and resolutions by @alexeagle in #448
- Don't bake env into binary by @keith in #464
- Add env_inherit to py_test by @keith in #459
- feat: add ability to pass user flags to python interpreter by @muravev-vasilii in #442
- chore(deps): update dependency bazel_skylib to v1.7.1 by @renovate in #472
- ci(pre-commit): Autoupdate by @hofbi in #474
- fix: Compatibility with symbolic macros by @dzbarsky in #488
- pytest - add suite name to junit.xml report by @vinnybod in #486
- chore: update bcr maintainer info by @kormide in #489
- Update release.yml by @alexeagle in #490
New Contributors
- @keith made their first contribution in #464
- @muravev-vasilii made their first contribution in #442
- @vinnybod made their first contribution in #486
- @kormide made their first contribution in #489
Full Changelog: v1.0.0...v1.1.0