Skip to content

0.23.0

Compare
Choose a tag to compare
@github-actions github-actions released this 12 Jun 17:08
· 616 commits to main since this release
2c28e61

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still experimental; apis are still subject to change

This release introduces two notable changes to bzlmod support:

  • A default toolchain is automatically registered for you. You no longer need to call register_toolchains() yourself. Depending
    on rules_python through bazel_dep is sufficient. Note, however, the Python version used for this default toolchain will change
    frequently/unexpectedly to track the a recent Python version.
  • The name arg of python.toolchain has been removed. The toolchain repo name format is python_X_Y e.g. python_3_11.

Add to your MODULE.bazel file:

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

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

pip.parse(
    name = "pip",
    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 = "8272287b125a23bfc79650ecbbc045ebcaee4d632338b1a50aad34357bcbadce",
    strip_prefix = "rules_python-0.23.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.0/rules_python-0.23.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 = "8272287b125a23bfc79650ecbbc045ebcaee4d632338b1a50aad34357bcbadce",
    strip_prefix = "rules_python-0.23.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.0/rules_python-0.23.0.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

  • feat(bzlmod): Allowing multiple python.toolchain extension calls by @chrislovecnm in #1230
  • build: Upgrade Gazelle to v0.31.0 by @linzhp in #1240
  • fix: make import python.runfiles work with --experimental_python_import_all_repositories=false by @rickeylev in #1243
  • feat(bzlmod): Moving register.toolchains internal by @chrislovecnm in #1238
  • docs(compile_pip_requirements): Add note on requirements.txt VC by @boomanaiden154 in #1245
  • cleanup: Set toolchain target_setting directly instead of via inline ternary by @rickeylev in #1246
  • fix(bzlmod): give precedence to the first seen versioned toolchain by @rickeylev in #1244
  • chore: add a pre-commit hook to maintain deleted packages by @aignas in #1208
  • chore: auto-publish gazelle module to BCR by @kormide in #1247
  • fix(coverage): bump to latest coverage.py and fix import shadowing by @aignas in #1249
  • feat: add ppc64le releases and update to 3.10.11, 3.11.3 for python-build-standalone by @clnperez in #1234
  • fix(bzlmod)!: Remove ability to specify toolchain repo name. by @rickeylev in #1258
  • fix: update correct requirements lock file when using os specific lock files by @Rasrack in #1123
  • fix: use only-binary for download_only pip download by @lpulley in #1219
  • feat: Adding variable support for distribution in py_wheel by @ns-tkonduri in #1251
  • feat(bzlmod): Register a default toolchain by @rickeylev in #1259

New Contributors

Full Changelog: 0.22.0...0.23.0