0.18.0
Using Bzlmod with Bazel 6
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.18.0")
pip = use_extension("@rules_python//python:extensions.bzl", "pip")
pip.parse(
name = "pip",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")
# (Optional) Register a specific python toolchain instead of using the host version
python = use_extension("@rules_python//python:extensions.bzl", "python")
python.toolchain(
name = "python3_9",
python_version = "3.9",
)
use_repo(python, "python3_9_toolchains")
register_toolchains(
"@python3_9_toolchains//:all",
)
Using WORKSPACE
Paste this snippet into your WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "36362b4d54fcb17342f9071e4c38d63ce83e2e57d7d5599ebdde4670b9760664",
strip_prefix = "rules_python-0.18.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.18.0/rules_python-0.18.0.tar.gz",
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
Gazelle plugin
Paste this snippet into your WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python_gazelle_plugin",
sha256 = "36362b4d54fcb17342f9071e4c38d63ce83e2e57d7d5599ebdde4670b9760664",
strip_prefix = "rules_python-0.18.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.18.0/rules_python-0.18.0.tar.gz",
)
Relevant Changes
Post-release notes
- bug #1056: This release does not work with Bazel 5. Please upgrade to 0.18.1
Coverage
rules_python
now includes coverage as part of the toolchain as an opt-in feature. To get started, pass register_coverage_tool = True
to python_register_toolchains
or python_register_multi_toolchains
.
runfiles wheel
The bazel-runfiles
wheel is now published to https://pypi.org/project/bazel-runfiles/.
What's Changed
- Using label as id for py targets by @linzhp in #1023
- Handling imports from sibling modules by @linzhp in #1027
- Add missing copyright headers by @rickeylev in #1030
- feat: allow extra dependencies to be passed to pip-compile by @f0rmiga in #1026
- feat(coverage): Register coverage.py to hermetic toolchains by @aignas in #977
- Manually generate distribution archives by @rickeylev in #1032
- fix: use 'repo' as prefix when constructing annotations label by @mattem in #1033
- Resolving sibling modules with absolute imports by @linzhp in #1029
- fix: reorder imports by @f0rmiga in #1034
- Revert "Resolving sibling modules with absolute imports" by @f0rmiga in #1035
- Fix glob includes/exclues by @illicitonion in #1038
- Fixed glob includes for ignore_root_user_error by @linzhp in #1037
- Pass cpp flags through in all cases to repository rule compilations by @shs96c in #1040
- feat: add logic from #1029 back with fix by @f0rmiga in #1039
- clean up UUID by @linzhp in #1028
- Use go_test to verify manifest by @linzhp in #1044
- fix: move coverage pkg to end of sys.path to avoid collisions by @f0rmiga in #1045
- fix(release): minimum needed to run twine to publish by @alexeagle in #1021
- release: publish our runfiles wheel to pypi by @alexeagle in #1048
- Add requires-network to pip requirements update. by @matts1 in #1050
- Document the pypi user and how to manage it. by @rickeylev in #1049
- fix(release): wrong replacement for $(location) during code review by @alexeagle in #1051
New Contributors
Full Changelog: 0.17.3...0.18.0