Skip to content

2.0.0-rc0

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 14 Apr 02:02
· 52 commits to main since this release

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.0.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 = "e91c374f6821fb963abb674cfd3780cd3310a62c54d8990e22d66571df5d7ed0",
    strip_prefix = "rules_python-2.0.0-rc0",
    url = "https://github.com/bazel-contrib/rules_python/releases/download/2.0.0-rc0/rules_python-2.0.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 = "e91c374f6821fb963abb674cfd3780cd3310a62c54d8990e22d66571df5d7ed0",
    strip_prefix = "rules_python-2.0.0-rc0/gazelle",
    url = "https://github.com/bazel-contrib/rules_python/releases/download/2.0.0-rc0/rules_python-2.0.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

New Contributors

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