1.8.0
For more detailed setup instructions, see https://rules-python.readthedocs.io/en/latest/getting-started.html
For the user-facing changelog see here
Using Bzlmod
Add to your MODULE.bazel file:
bazel_dep(name = "rules_python", version = "1.8.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.13",
)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pypi",
python_version = "3.13",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pypi")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 = "0558021abbd244f3e2b51120a7ec4bded37c6cb02c372aaa188da9ba375560d8",
strip_prefix = "rules_python-1.8.0",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.8.0/rules_python-1.8.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 = "0558021abbd244f3e2b51120a7ec4bded37c6cb02c372aaa188da9ba375560d8",
strip_prefix = "rules_python-1.8.0/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.8.0/rules_python-1.8.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
- chore: remove bcr app settings by @rickeylev in #3370
- chore: make pypi release workflow perform checkout by @rickeylev in #3371
- fix(gazelle) Delete python targets with invalid srcs by @yushan26 in #3046
- revert(pypi): revert the default for pipstar by @aignas in #3373
- fix: Add linux_riscv64 to _pip_repository_impl by @kxxt in #3350
- feat: Add libpython QNX platform support by @lalten in #3372
- build: change gazelle rules_python override to use bazelrc by @rickeylev in #3382
- gazelle: set min rules_python version as 1.4 by @rickeylev in #3383
- chore(toolchain): drop all but the latest 3.9 toolchain by @aignas in #3377
- fix: make CI pass with the next version of Bazel (9.0.0rc1) by @jsing-canva in #3393
- Add batch_commands to presubmit.yml by @meteorcloudy in #3389
- fix(runfiles): correct Python runfiles path assumption by @jsing-canva in #3086
- chore: Bazel 9 is rc now by @alexeagle in #3394
- chore: update to latest buildifier by @aignas in #3386
- chore: switch bcr to 8.x instead of last_rc by @aignas in #3395
- fix(local): Fix local_runtime use with free-threaded python by @laramiel in #3399
- refactor: defer zip manifest building to execution phase to improve analysis phase performance by @tobyh-canva in #3381
- fix(pip): allow for different extras for different target platforms by @aignas in #3385
- chore: make doc building use bootstrap script and venv site packages by @rickeylev in #3403
- fix: use runfiles symlinks for venv symlink creation to reduce action count by @rickeylev in #3402
- fix(gazelle): correct runfiles path handling in gazelle_python_manifest test by @timfallmk in #3398
- tests: set --windows_enable_symlinks in bzlmod example by @rickeylev in #3409
- docs: Explain why the
lockrule has no implicit test target by @martis42 in #3411 - refactor(gazelle): Generate a modules map per wheel, then merge by @thejcannon in #3415
- docs: fix markdown by @dizzy57 in #3417
- feat(toolchain): drop 3.8 and print info level messages about it by @aignas in #3387
- fix: Avoid C++ toolchain requirement if possible by @fmeum in #2919
- doc: add documentation to the changelog about the removal of 3.8 by @aignas in #3418
- fix: make python_headers targets compatible with layering checks by @keith in #3420
- fix(local) Add api3 targets and additional defines. by @laramiel in #3408
- chore: start cleaning up 3.9 usage from examples by @aignas in #3419
- chore: enable disk cache for faster local builds by @rickeylev in #3424
- chore(bazelrc): fix the update-deleted-packages script by @aignas in #3425
- chore(toolchain): remove chmod and disable ignore_root_error by @aignas in #3421
- ci: switch our jobs to mac arm64 by @aignas in #3426
- docs: enable pipstar for doc building by @rickeylev in #3427
- fix: add runfiles root for system_python bootstrap by @rickeylev in #3423
- refactor(pypi): parse entry_points without Python by @aignas in #3429
- chore: enable pipstar for experimental_index_url users by @aignas in #3428
- fix(pip): do not add a pip-fallback when there is no sdist by @aignas in #3432
- build(deps): bump actions/checkout from 5 to 6 by @dependabot[bot] in #3433
- refactor(pypi): extract the wheel without python by @aignas in #3430
- chore: remove extraneous dep from sys_path_order test by @rickeylev in #3435
- refactor: remove gazelle plugin as dev dependency by @rickeylev in #3436
- ci: add ci config to test 7 and 8 for bcr like setup by @aignas in #3404
- feat(pip.parse): limit the target platforms we parse requirements for by @aignas in #3441
- refactor(core): get_zip_runfiles_path should call startswith less by @aignas in #3442
- ci: start testing BCR tests with bazel 9 by @aignas in #3443
- doc: target_platforms by @aignas in #3445
- chore(bzlmod): assume that we can always mark the extension as reproducible by @aignas in #3444
- refactor: avoid conflict merging when shared libraries are present by @rickeylev in #3448
- refactor: add mnemonics to some gazelle and sphinxdocs actions by @tyler-french in #3449
- fix(pip): Only directly extract .whl files in Bazel >9 by @armandomontanez in #3452
- feat(toolchains): Add 3.13.10, 3.13.11, 3.14.1, 3.14.2, 3.15.0a2 by @pjjw in #3451
- chore(pip): Check for whl extract compatibility in internal_config_repo.bzl by @armandomontanez in #3456
- fix(pip): set better defaults for the new target_platforms attr by @aignas in #3447
- fix: correctly merge conflicting paths when files (instead of dirs) are being linked by @rickeylev in #3458
- refactor(repo_utils): create a helper for extracting files by @aignas in #3459
- refactor: optimize venv building for namespace packages by @rickeylev in #3454
- chore: add missing py_internal dep to venv_runfiles by @rickeylev in #3462
- fix: allow pypi packages with empty data attribute by @rickeylev in #3463
- docs: Fix broken links to bzlmod build_file_generation example by @willstranton in #3464
- docs: fix link to releases page by @willstranton in #3467
- refactor: optimize venv creation for nvidia and pkgutil style namespace packages by @rickeylev in #3460
- fix(pipstar): actually pass the extras down the call stack by @aignas in #3468
- fix(pipstar): fix whl extraction and flip pipstar=true by @aignas in #3461
- build(deps): bump bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml from 1.0.0 to 1.1.0 by @dependabot[bot] in #3465
- chore: update version markers for 1.8 release by @rickeylev in #3472
- fix(venv): Fix all .so files missing when py_binary lives at //:BUILD by @shayanhoshyari in #3474
New Contributors
- @jsing-canva made their first contribution in #3393
- @tobyh-canva made their first contribution in #3381
- @timfallmk made their first contribution in #3398
- @tyler-french made their first contribution in #3449
- @pjjw made their first contribution in #3451
- @willstranton made their first contribution in #3464
Full Changelog: 1.7.0...1.8.0