Skip to content

0.32.1

Compare
Choose a tag to compare
@github-actions github-actions released this 13 May 06:54
· 19 commits to main since this release
9fa38df

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.32.1")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

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 = "b289b0b023c71b80f26d39476e5e2c3cf72d21cb2759bcf02638ba3cc480e9df",
    strip_prefix = "rules_python-0.32.1",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.32.1/rules_python-0.32.1.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 = "b289b0b023c71b80f26d39476e5e2c3cf72d21cb2759bcf02638ba3cc480e9df",
    strip_prefix = "rules_python-0.32.1/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.32.1/rules_python-0.32.1.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

Changed

  • (bzlmod): The MODULE.bazel.lock whl_library rule attributes are now
    sorted in the attributes section. We are also removing values that are not
    default in order to reduce the size of the lock file.
  • (coverage) Bump coverage.py to 7.4.3.
  • (deps): Bumped bazel_features to 1.9.1 to detect optional support
    non-blocking downloads.
  • (deps): Updated pip_tools to >= 7.4.0
  • (toolchains): Change some old toolchain versions to use 20240224 release to
    include security fixes 3.8.18, 3.9.18 and 3.10.13
  • (toolchains): Bump default toolchain versions to:
    • 3.8 -> 3.8.19
    • 3.9 -> 3.9.19
    • 3.10 -> 3.10.14
    • 3.11 -> 3.11.9
    • 3.12 -> 3.12.3

Fixed

  • (whl_library): Fix the experimental_target_platforms overriding for platform
    specific wheels when the wheels are for any python interpreter version. Fixes
    #1810.
  • (whl_library): Stop generating duplicate dependencies when encountering
    duplicates in the METADATA. Fixes
    #1873.
  • (gazelle) In project or package generation modes, do not generate py_test
    rules when there are no test files and do not set main = "__test__.py" when
    that file doesn't exist.
  • (whl_library) The group redirection is only added when the package is part of
    the group potentially fixing aspects that want to traverse a py_library graph.
    Fixes #1760.
  • (bzlmod) Setting a particular micro version for the interpreter and the
    pip.parse extension is now possible, see the
    examples/pip_parse/MODULE.bazel for how to do it.
    See #1371.
  • (refactor) The pre-commit developer workflow should now pass isort and black
    checks (see #1674).

Added

  • (toolchains) Added armv7 platform definition for python toolchains.
  • (toolchains) New Python versions available: 3.11.8, 3.12.2 using the 20240224 release.
  • (toolchains) New Python versions available: 3.8.19, 3.9.19, 3.10.14, 3.11.9, 3.12.3 using
    the 20240415 release.
  • (gazelle) Added a new python_visibility directive to control visibility
    of generated targets by appending additional visibility labels.
  • (gazelle) Added a new python_default_visibility directive to control the
    default visibility of generated targets. See the docs
    for details.
  • (gazelle) Added a new python_test_file_pattern directive. This directive tells
    gazelle which python files should be mapped to the py_test rule. See the
    original issue and the docs
    for details.
  • (wheel) Add support for data_files attributes in py_wheel rule
    (#1777)
  • (py_wheel) bzlmod installations now provide a twine setup for the default
    Python toolchain in rules_python for version 3.11.
  • (bzlmod) New experimental_index_url, experimental_extra_index_urls and
    experimental_index_url_overrides to pip.parse for using the bazel
    downloader. If you see any issues, report in
    #1357. The URLs for
    the whl and sdist files will be written to the lock file. Controlling whether
    the downloading of metadata is done in parallel can be done using
    parallel_download attribute.
  • (gazelle) Add a new annotation include_dep. Also add documentation for
    annotations to gazelle/README.md.
  • (deps): rules_python depends now on rules_cc 0.0.9
  • (pip_parse): A new flag use_hub_alias_dependencies has been added that is going
    to become default in the next release. This makes use of dep_template flag
    in the whl_library rule. This also affects the
    experimental_requirement_cycles feature where the dependencies that are in
    a group would be only accessible via the hub repo aliases. If you still
    depend on legacy labels instead of the hub repo aliases and you use the
    experimental_requirement_cycles, now is a good time to migrate.

Full Changelog: 0.32.0...0.32.1