Skip to content

2.1.0-rc0

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 18 Jun 03:38
· 1 commit to main since this release
5c32fa9

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 = "2.1.0-rc0")

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 = "8c8c28f9fc1cc8fd2a24df47deb9da8dc0d5567fa5ab48085515fa92c8cb56d0",
    strip_prefix = "rules_python-2.1.0-rc0",
    url = "https://github.com/bazel-contrib/rules_python/releases/download/2.1.0-rc0/rules_python-2.1.0-rc0.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 = "8c8c28f9fc1cc8fd2a24df47deb9da8dc0d5567fa5ab48085515fa92c8cb56d0",
    strip_prefix = "rules_python-2.1.0-rc0/gazelle",
    url = "https://github.com/bazel-contrib/rules_python/releases/download/2.1.0-rc0/rules_python-2.1.0-rc0.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

  • refactor: remove most of semantics by @rickeylev in #3475
  • feat: add --debugger flag by @rickeylev in #3478
  • fix(--debugger): Ensure that imports or venv_site_package files are propagated for debugger target by @shayanhoshyari in #3483
  • build: Export runtime_env_toolchain_interpreter.sh file by @hofbi in #3471
  • fix(coverage): Disable certain coverage warnings. by @phst in #3191
  • feat: basic build data with stamping by @rickeylev in #3484
  • fix: prevent a 404 error when serving Sphinx docs and Bazel is configured with a --symlink_prefix option by @laurenshobert in #3492
  • build: Enable incompatible_no_implicit_file_export in bazelrc by @hofbi in #3477
  • fix(pipstar): correctly handle platlib and purelib in .data by @aignas in #3501
  • doc: Add a snippet on how people can use 3.8 now onwards by @aignas in #3502
  • refactor(pypi): print a better error message for duplicate repos by @aignas in #3487
  • chore: create bcr prs as non-draft so bazel-io processes the bot-created PRs by @rickeylev in #3504
  • fix (venv_site_packages): Fix wrong runfiles.symlinks when py_binary is not in root module by @shayanhoshyari in #3505
  • test(whl_library): test a recent fix for pipstar by @aignas in #3469
  • feat(gazelle): Add ancestor conftest.py files by @thejcannon in #3498
  • fix(pipstar): Handle dep appearing in extra both conditionally and unconditionally by @thirtyseven in #3513
  • Add missing #3046 reference to 1.8.0 changelog by @dougthor42 in #3516
  • chore: remove unused which.bzl helper by @rickeylev in #3509
  • chore: remove py_proto_library from bzlmod example by @rickeylev in #3508
  • chore: remove defunct runtime distinction logic by @rickeylev in #3506
  • chore: make builtin build_python_zip flag optional for tests (bazel 10 compatibility) by @rickeylev in #3507
  • chore (py_internal): Remove roundtrip of putting py_internal in the config repo by @shayanhoshyari in #3522
  • chore: remove mention of py_proto_library from readme by @shayanhoshyari in #3525
  • fix: Quote all files if original RECORD had all files quoted by @lalten in #3515
  • fix(pipstar): correctly handle complex self deps by @aignas in #3527
  • doc: bazel downloader (#3519) by @romanofski in #3530
  • feat(python): add arm64e-apple-darwin platform support by @ma-oli in #3535
  • feat(gazelle): Add python_generate_pyi_srcs directive by @dougthor42 in #3356
  • fix: explicitly symlink all .so files, not just ones with lib prefix by @gfrankliu in #3538
  • fix: handle unsubstituted template placeholders for external native py_binary by @thomasdesr in #3495
  • refactor: rename files_to_build to default_outputs by @rickeylev in #3542
  • refactor: clarify %main% is runfiles-root-relative path by @rickeylev in #3537
  • fix: Mark internal config repo as reproducible for Bzlmod by @aaronsky in #3544
  • docs (debugger): Update using debuggers how to guide on using debugpy (e.g. vscode) by @shayanhoshyari in #3547
  • chore: remove workspace py_proto_library example by @rickeylev in #3546
  • chore: update rbe ci config to 8.x by @rickeylev in #3548
  • fix(pip): simply extract whl contents to the current directory by @aignas in #3549
  • fix: use powershell.exe instead of pwsh.exe for build_data_writer by @vadikmironov in #3553
  • fix: remove CONFIG_ID write from build_data_writer.ps1 by @vadikmironov in #3556
  • fix(pip): add read permissions when extracting wheels by @thirtyseven in #3555
  • feat: add py_zipapp_binary and test rules for zipapp support by @rickeylev in #3539
  • chore: remove defunct _py_toolchain_type py_binary attribute by @rickeylev in #3560
  • chore: add some type information about hub builder by @rickeylev in #3558
  • feat(zipapp): add windows support by @rickeylev in #3561
  • docs: doc the imports attribute as a target-relative path by @rickeylev in #3571
  • docs: mention PyRuntimeInfo in PyExecutableInfo by @rickeylev in #3573
  • feat(zipapp): Add python_zip_file output group for better compatibility by @rickeylev in #3574
  • chore(py_executable): print warning if build zip is enabled by @rickeylev in #3568
  • fix: fallback to /usr/bin/env if env is not in PATH by @rickeylev in #3577
  • fix: make imports attribute target-relative for venv mode by @rickeylev in #3572
  • feat: handle url req in wheelmaker by @martin4861 in #3569
  • fix(pip): preserve PEP 508 URL-based requirements when extract_url_srcs=False by @jsharpe in #3582
  • fix(pipstar): handle a corner case for compatible version evaluation by @aignas in #3583
  • fix(runfiles): assume main repository on Windows by @rdesgroppes in #3578
  • fix(pypi): normalize extras in requirement strings per PEP 685 by @kevinpark1217 in #3588
  • chore: print zipapp deprecation for non-windows platforms by @rickeylev in #3591
  • fix: Return repo_metadata from uv repository rule by @mortenmj in #3597
  • fix: Return repo_metadata from python repository rule by @mortenmj in #3598
  • perf(py_wheel): defer depset expansion to execution time by @bd-dstodolsky in #3599
  • feat(gazelle): Directive controlling pytest ancestor dependencies by @dougthor42 in #3596
  • docs: document current_py_cc_headers and related toolchain targets by @Saish-3 in #3602
  • test(gazelle): Update remove_invalid_(binary|library) gazelle tests. by @dougthor42 in #3601
  • chore: better build data error handling by @rickeylev in #3606
  • fix: build_data_writer.ps1 encoding and ACLs by @rickeylev in #3604
  • docs: Fix nearly all xref errors and other doc warnings by @rickeylev in #3615
  • fix: use forward slashes for initial Rlocation lookup of build data by @rickeylev in #3616
  • chore: ignore rmtree errors in wheel_installer_test by @rickeylev in #3607
  • test: add system_python_nodeps_test by @rickeylev in #3609
  • fix: use runfiles_root_path in stage2 bootstrap by @rickeylev in #3605
  • chore: better bootstrap logging by @rickeylev in #3608
  • build(deps): bump the pip group across 2 directories with 2 updates by @dependabot[bot] in #3617
  • feat: command_line_option transition support, default windows to enable_runfiles=true by @rickeylev in #3610
  • chore: prepare 1.9.0 release by @rickeylev in #3623
  • docs(gazelle): Add versionadded details to some Gazelle directives.md by @dougthor42 in #3624
  • chore: replace version marker in features.bzl by @rickeylev in #3627
  • chore: update changelog with 1.8.5 notes, fix 1.8 links by @rickeylev in #3626
  • feat(pypi): make whl_library reproducible under pipstar by @aignas in #3589
  • fix(pypi): handle unnormalized package names when extracting sdist version by @aignas in #3635
  • fix: replace 2 bare except clauses with except Exception by @haosenwang1018 in #3637
  • chore: simplify support policy description by @rickeylev in #3638
  • refactor(pypi): factor out a simple implementation of the PyPI cache by @aignas in #3639
  • fix(pypi): update pypi tooling deps to setuptools 82, packaging 26 by @Danielkonge in #3593
  • build: add flag_alias definition for Starlarkification of python flags by @aranguyen in #3450
  • fix: remove flag_aliases to unbreak bazel 9 by @rickeylev in #3649
  • chore: cleanup the usage of rctx.getenv by @aignas in #3640
  • ci: soft fail for upcoming bazel job by @rickeylev in #3651
  • fix: Fix zipapp compression support for new py_zipapp_binary target by @nate-england in #3653
  • fix(toolchain): Also set Make variables for local toolchains by @jwnimmer-tri in #3641
  • refactor(pypi): move absolute_url to whl_library by @aignas in #3652
  • tests: add bazel 9 testing, use latest released (not rc) for bazel by @rickeylev in #3650
  • chore: use bazel 9 by default by @rickeylev in #3662
  • Link a quickstart screen recording for rules_python beginners into docs by @blockjon in #3658
  • chore!: enable --windows_enable_symlinks by default by @rickeylev in #3663
  • fix(pypi): return yank reason from SimpleAPI HTML by @aignas in #3656
  • feat(pypi): store PyPI results as facts v2 by @aignas in #3654
  • chore: remove pip_repository_annotations example by @rickeylev in #3622
  • chore: factor release note checking into separate script by @rickeylev in #3628
  • fix: prevent stdlib pyc files from invalidating runtime repos by @rickeylev in #3661
  • chore: split sphinxdocs into its own module by @rickeylev in #3629
  • chore: use term runfiles root instead of module space by @rickeylev in #3664
  • chore: clarify type of paths for some system_python variables by @rickeylev in #3665
  • feat: Allow files in wheels to be installed to directories by @Ahajha in #3233
  • fix(bootstrap): manual runfiles path construction when using submodules by @faximan in #3636
  • chore(system_python): use snake_case, add some debugging by @rickeylev in #3667
  • fix(pypi): propagate fails if overrides are passed only one index is used by @aignas in #3666
  • fix(pypi) Correct likely _BAZEL_REPO_FILE_GLOBS typo by @michaelm-openai in #3670
  • refactor!: create full venv for bootstrap=system_python by @rickeylev in #3473
  • build(deps): bump the pip group across 2 directories with 1 update by @dependabot[bot] in #3675
  • build(deps): bump cryptography from 46.0.5 to 46.0.6 in /tools/publish in the pip group across 1 directory by @dependabot[bot] in #3677
  • feat(pypi): first check index contents before downloading metadata about distributions by @aignas in #3657
  • fix(uv): drop powerpc64 support to fix latest version downloads by @aignas in #3678
  • fix(bootstrap) handle when the runfiles env vars are not correct by @adhoc-bobcat in #3644
  • feat(zipapp): support EXTRACT_ROOT env var for main.py invocations by @rickeylev in #3682
  • feat(zipapp): add content hash support to main-based invocations by @rickeylev in #3683
  • chore: finish removing pip_repository_annotations by @rickeylev in #3684
  • feat!: make windows use venvs by @rickeylev in #3680
  • feat(wheel): Add support for add_path_prefix by @antoniojkim in #3679
  • chore: update changelog, version markers, for 2.0 release by @rickeylev in #3689
  • sphinxdoc: move tests and docs to module-root directory by @rickeylev in #3690
  • feat!(pypi): enable bazel downloader by default by @aignas in #3691
  • fix: namespace package calculation on windows by @rickeylev in #3693
  • chore: add some skills and update agents doc by @rickeylev in #3696
  • test(pypi): check index url precedence in various combinations by @aignas in #3698
  • test(pypi): add argparse.bzl tests by @aignas in #3697
  • chore: make buildkite-get-results skill work with large job numbers by @rickeylev in #3699
  • chore: factor mock mctx/rctx functionality into separate file by @rickeylev in #3700
  • refactor: split create_providers into separate functions by @rickeylev in #3695
  • chore: populate 2.0 for VERSION_NEXT_FEATURE for py_wheel add_path_prefix by @rickeylev in #3703
  • chore: have no-matching-distribution error message hint about target_platforms vs requirements_by_platform by @rickeylev in #3701
  • feat(runfiles): create pathlib api for runfiles library by @rickeylev in #3694
  • fix(sphinxdocs): update MODULE.bazel to depend on a released version by @aignas in #3704
  • sphinxdocs: remove local rules_python dev overrides by @rickeylev in #3705
  • tests: better simulate BCR environment by @rickeylev in #3706
  • build(deps): bump cryptography from 46.0.6 to 46.0.7 in /tools/publish in the pip group across 1 directory by @dependabot[bot] in #3687
  • fix(pypi): skip index lookups when all package overrides are specified by @aignas in #3710
  • feat(toolchains): Add 3.10.20, 3.11.15, 3.12.13, 3.13.{12,13} 3.14.{3,4}, 3.15.0a8 by @pjjw in #3708
  • deps(gazelle): Bump WORKSPACE gazelle version 0.36.0 --> 0.47.0 (to match MODULE.bazel) by @dougthor42 in #3717
  • fix(pypi): correctly write the used facts back by @aignas in #3719
  • fix(pypi): build the environment on the fly by @aignas in #3720
  • feat(windows): site-packages venv support by @rickeylev in #3718
  • doc: add notes on the design by @aignas in #3722
  • deps(gazelle): Finish bazel-gazelle version bump from #3717 by @dougthor42 in #3724
  • feat(runfiles): implement runfiles.Path io methods by @rickeylev in #3716
  • fix(pypi): don't resolve python interpreter when not necessary by @rickeylev in #3727
  • fix(gazelle): handle auto-included init.py when generating py_binary targets. by @jvolkman in #3730
  • feat(toolchains): add add_target_settings to python.override by @novas0x2a in #3731
  • refactor(pypi): extract a function for deleting files recursively by @aignas in #3733
  • fix(entry_point): ignore type lints on the generated files by @aignas in #3736
  • refactor(twine): use py_binary for publishing in WORKSPACE by @aignas in #3734
  • chore: enable platform-specific configs and silence C++ warnings in .bazelrc by @rickeylev in #3738
  • tests: support whl_from_dir_repo on Windows by @rickeylev in #3740
  • docs: give guidance on pr body content by @rickeylev in #3742
  • chore(entry_point): remove all repository_rule entry_point code and docs by @aignas in #3735
  • feat(venv): support data, include, and scripts schemes by @rickeylev in #3726
  • chore: remove groodt from codeowners by @rickeylev in #3741
  • chore: make pipstar non-switchable by @aignas in #3737
  • feat(pypi): support isolated pip.parse by @ouillie in #3669
  • fix(uv): use astral urls for uv primary source, github as secondary by @jwnimmer-tri in #3746
  • build(deps): bump softprops/action-gh-release from 2 to 3 by @dependabot[bot] in #3702
  • fix(pypi): harden the WORKSPACE python detection in pip_repository by @aignas in #3744
  • feat: add package metadata for wheel libraries by @stevebarrau in #3531
  • feat(venv): make wheel scripts runnable in venv by @rickeylev in #3743
  • feat: Add alias_kind directive support to Gazelle plugin. by @canislupaster in #3713
  • chore: always use starlark-based extraction for wheels by @rickeylev in #3748
  • docs: rewrite multi-version dependency track guide using custom platforms by @rickeylev in #3751
  • fix(pypi): include RECORD file in installed wheel targets by @rickeylev in #3752
  • feat(gazelle): enable pyi attrs by default by @amartani in #3753
  • chore(pypi): remove unused config settings code by @aignas in #3739
  • fix(toolchains): add releases.astral.sh mirror for python-build-standalone by @rickeylev in #3761
  • feat(coverage): add Python 3.14 support and bump coverage.py to 7.10.7 by @Syndic in #3764
  • fix(pypi): pass the correct versions to get_index_urls and fix cache invalidation by @aignas in #3758
  • fix(logger): do not output WARN level logs for non-root modules by @aignas in #3760
  • ci: update RBE toolchain version from ubuntu2204 to ubuntu2404 by @meteorcloudy in #3778
  • docs: split toolchain bumps from #3708 into 2.0.2 and 1.9.1 changelog sections by @kevinpark1217 in #3777
  • fix(rules): allow path separators in 'main' attribute by @titusfortner in #3790
  • feat(coverage): warn when bundled coverage tool has no wheel for requested python_version/platform by @Syndic in #3766
  • fix(pip_compile): Forward target compatibility to *.update by @castler in #3787
  • fix(system_python): Remove printing of not always present attribute by @limdor in #3781
  • refactor(pypi): cleanup marker evaluation code in requirement parsing by @aignas in #3765
  • chore: use ruff to lint and format files and apply fixes by @aignas in #3779
  • fix: avoid ln race condition in bootstrap script by @rickeylev in #3797
  • chore: use direct @dev_pip targets instead of requirement() by @rickeylev in #3798
  • fix(pypi): do not fail on indexes without root index by @aignas in #3799
  • fix(build-data): remove CONFIG_MODE from build data by @rickeylev in #3801
  • chore: tell agents to not amend or rebase PRs by @rickeylev in #3804
  • test(mocks): extract mock python extension helper by @rickeylev in #3803
  • fix(uv): allow environment setting for the update action by @aignas in #3800
  • refactor: use python_ext mock helpers in python_tests.bzl by @rickeylev in #3813
  • feat: add //command_line_option:extra_toolchains pseudo-flag by @rickeylev in #3810
  • build: configure secondary mirror fallback by @rickeylev in #3814
  • fix(uv): respect uv.tool settings in pyproject.toml by @aignas in #3811
  • feat(toolchains): support runtime registration from manifest by @rickeylev in #3802
  • Gazelle: Delete stale py_library and py_test targets by @taowang487 in #3817
  • refactor(toolchains): register runtimes using manifest by @rickeylev in #3812
  • docs: update changelog for 2.0.3 release by @udaya2899 in #3820
  • fix(coverage): handle nested coverage collection by @gergondet-woven in #3823
  • feat: expose interpreter files-to-run on PyRuntimeInfo by @jsun-splunk in #3795
  • chore: prepare 2.1 release by @rickeylev in #3829

New Contributors

Full Changelog: 1.8.0-rc1...2.1.0-rc0