0.17.3
Note, the prior 0.17 tags (0.17.0, 0.17.1, and 0.17.2) were never published as releases and can be ignored.
Breaking Change
The Gazelle extension for Python has been updated to better integrate with the conventions of Python and Bazel. This includes changes to how test files with the prefix or suffix of "test_" and "*_test" are handled. If a test target is not present, these files will now be added to individual py_test targets. To align your projects with these changes, any test utility files that were previously included in py_library targets and have the aforementioned prefix or suffix, will need to be renamed for consistency.
To use the gazelle extension you must now fetch another external repository, rules_python_gazelle_plugin
, see the snippet below.
Also, change your gazelle binary registration to load from this new repository:
gazelle(
name = "gazelle",
data = GAZELLE_PYTHON_RUNTIME_DEPS,
gazelle = "@rules_python_gazelle_plugin//python:gazelle_binary",
)
Using Bzlmod with Bazel 6
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.17.3")
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 = "8c15896f6686beb5c631a4459a3aa8392daccaab805ea899c9d14215074b60ef",
strip_prefix = "rules_python-0.17.3",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.17.3.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 = "8c15896f6686beb5c631a4459a3aa8392daccaab805ea899c9d14215074b60ef",
strip_prefix = "rules_python-0.17.3/gazelle",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.17.3.tar.gz",
)
What's Changed
- Update runfiles lib by @fmeum in #982
- Refactor poor naming and unused code in wheel_installer by @groodt in #990
- Add new Python versions including 3.11 by @jvolkman in #992
- runfiles: Drop outdated comments about vendoring by @fmeum in #986
- Implement py_proto_library by @comius in #832
- runfiles: Fix usage instructions by @fmeum in #985
- chore: fix red CI - buildifier was broken by #832 by @alexeagle in #996
- runfiles: Import
CurrentRepository
from Bazel by @fmeum in #988 - Fix misleading error message by @suzaku in #927
- runfiles: Apply repo mapping to Rlocation path by @fmeum in #998
- fix(deps): declare our dependency on bazel_skylib by @alexeagle in #1001
- chore: publish a runfiles library as a wheel by @alexeagle in #995
- feat: allow patching the interpreter fetched via toolchains by @mattem in #1004
- Redirect stdout when checking imports. by @aptenodytes-forsteri in #1007
- Fix Python interpreter target labels with @@ prefixes. by @oxidase in #940
- cleanup: remove vendored copy of skylib by @alexeagle in #1003
- generate py_test without test by @linzhp in #999
- Add runtime dependencies to gazelle extension by @linzhp in #993
- fix: allow omitting the
strip_prefix
intool_versions
by @lummax in #975 - refactor(gazelle): Move plugin to a separate directory. by @aignas in #983
- fix: windows
*.lib
interface inpython_headers
by @lummax in #976 - python_repository: Exclude pycache files by @illicitonion in #907
- runfiles: Remove dead code by @fmeum in #1011
- runfiles: Add proper test coverage for an edge case by @fmeum in #1012
- refactor: pull implementations out of packaging.bzl by @alexeagle in #1013
- Fix requirement parser by @tgeng in #1009
- feat(gazelle)!: Move the plugin to a separate workspace by @aignas in #972
- refactor: py_wheel now a macro by @alexeagle in #1014
- fix: ensure 'patches' attr is included for the canonical representation of the toolchain by @mattem in #1018
- feat: produce publishable distribution archives by @alexeagle in #1019
- fix(release): use correct GH workflows syntax by @alexeagle in #1020
- feat: allow absolute urls in
tool_versions
by @lummax in #973 - chore: revert publish wheel on releases by @alexeagle in #1022
New Contributors
- @fmeum made their first contribution in #982
- @comius made their first contribution in #832
- @suzaku made their first contribution in #927
- @oxidase made their first contribution in #940
- @linzhp made their first contribution in #999
- @lummax made their first contribution in #975
- @illicitonion made their first contribution in #907
- @tgeng made their first contribution in #1009
Full Changelog: 0.16.2...0.17.3