Releases: bazel-contrib/rules_python
1.5.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.5.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 = "7b9039c31e909cf59eeaea8ccbdc54f09f7ebaeb9609b94371c7de45e802977c",
strip_prefix = "rules_python-1.5.0",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0/rules_python-1.5.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 = "7b9039c31e909cf59eeaea8ccbdc54f09f7ebaeb9609b94371c7de45e802977c",
strip_prefix = "rules_python-1.5.0/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0/rules_python-1.5.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
- fix: declare PyInfo as provided by test/binary/library by @layus in #2777
- fix: load target_platforms through the hub by @aignas in #2781
- chore: remove a stray file by @aignas in #2795
- build(deps): bump sphinx-rtd-theme from 3.0.1 to 3.0.2 in /docs by @dependabot in #2802
- build(deps): bump astroid from 3.3.6 to 3.3.9 in /docs by @dependabot in #2803
- build(deps): bump packaging from 24.2 to 25.0 in /docs by @dependabot in #2804
- fix: fixes to prepare for making bootstrap=script the default for Linux by @rickeylev in #2760
- fix: escape more invalid repo string characters by @keith in #2801
- fix: parsing metadata with inline licenses by @keith in #2806
- test(pypi): add a test case for simpleapi html parsing with % by @aignas in #2811
- build: Run pre-commit everywhere by @brandonchinn178 in #2808
- refactor/docs: improve compile_pip_requirements error message and docs by @brandonchinn178 in #2792
- feat: Have
pip_compile
generate a*.test
target; deprecate*_test
by @dougthor42 in #2812 - fix: try multiple times to get win32 version to handle flakes by @rickeylev in #2814
- refactor: Add log_std(out|err) bools to repo_utils that execute a subprocess by @dougthor42 in #2817
- fix: use the python micro version to parse whl metadata in bzlmod by @aignas in #2793
- fix(pypi): call python --version before marker eval by @aignas in #2819
- docs: add xrefs for local toolchains rules by @rickeylev in #2823
- docs: Improve bazel-runfiles docs by @fmeum in #2824
- revert(pypi): bring back Python PEP508 code with tests by @aignas in #2831
- fix(pypi) backport python_full_version fix to Python by @aignas in #2833
- revert(pypi): use Python for marker eval and METADATA parsing by @aignas in #2834
- feat: implement less/greater operators for string for env marker evaluation by @rickeylev in #2827
- docs: doc version when RULES_PYTHON_ENABLE_PYSTAR was introduced by @rickeylev in #2838
- fix(pypi): handle more URL patterns for requirement sources by @aignas in #2843
- docs: document some of our project styles/conventions by @rickeylev in #2816
- fix: requires_file preserves extras that package depends on by @skongum02 in #2807
- refactor: add rule to do analysis time evaluation of environment markers by @rickeylev in #2832
- py_wheel: always generate zip64-capable wheels by @devtbi in #2711
- feat: allow specifying arbitrary constraints for local toolchains by @rickeylev in #2829
- feat: add an env variable to toggle pipstar by @aignas in #2855
- fix: add target platform to extra exec platforms in analysis tests by @fmeum in #2861
- fix: configure coverage helpers for test exec group by @fmeum in #2857
- fix: fix test analysis error on macOS arm64 by @fmeum in #2860
- refactor: make env marker config available through target and flag by @rickeylev in #2853
- feat: default to bootstrap script for non-windows by @rickeylev in #2858
- fix(pypi): fix a typo in parse_simpleapi_html by @aignas in #2866
- build(deps): bump more-itertools from 10.5.0 to 10.7.0 in /tools/publish by @dependabot in #2841
- fix(pypi): finish PEP508/PEP440 impl for version matching by @aignas in #2856
- tests: make some analysis tests work for when test's exec platform is required by @fmeum in #2869
- fix(pypi): make the URL/filename extraction from requirement more robust by @aignas in #2871
- feat(pypi): actually start using env_marker_setting by @aignas in #2873
- refactor: make python extension generate platform toolchains by @rickeylev in #2875
- Fix whl_library file path inference by @gholms in #2876
- refactor: consolidate version parsing by @aignas in #2874
- feat: Add support for REPLs by @philsc in #2723
- cleanup: remove unused sanitize_platform_name function by @rickeylev in #2887
- refactor: move inline code strings to top-level constants by @rickeylev in #2886
- dev: add .python-version file so pyenv isn't user/system specific by @rickeylev in #2883
- refactor: have bzlmod pass platforms to python_register_toolchains by @rickeylev in #2884
- sphinxdocs: close repo rule directives by @rickeylev in #2892
- sphinxdocs: make xrefs to bzl:obj in inventories work by @rickeylev in #2894
- sphinxdocs: make xrefs to tag class attributes using attr role work by @rickeylev in #2895
- sphinxdocs: allow unqualified arg/attr name for xref by @rickeylev in #2896
- docs: fix xref to toolchain docs from getting starting by @rickeylev in #2899
- sphinxdocs: allow files to be xref by @rickeylev in #2897
- docs: move devguide to sphinx for more powerful markup by @rickeylev in #2898
- sphinxdocs: make bazel package xrefs work by @rickeylev in #2903
- docs: fix most broken xrefs in changelog by @rickeylev in #2902
- tests: move py_reconfig rules to their own file by @rickeylev in #2900
- docs: fix link to py_reconfig and sh_py_run_test files by @rickeylev in #2901
- sphinxdocs: make Any and object types no-ops to avoid missing xrefs by @rickeylev in https://githu...
1.5.0-rc4
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.5.0-rc4")
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 = "8b98bfab75cd469bd5f9b63dc48a2f652b0348880006e5cb8299f4ee04292a95",
strip_prefix = "rules_python-1.5.0-rc4",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc4/rules_python-1.5.0-rc4.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 = "8b98bfab75cd469bd5f9b63dc48a2f652b0348880006e5cb8299f4ee04292a95",
strip_prefix = "rules_python-1.5.0-rc4/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc4/rules_python-1.5.0-rc4.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()
Full Changelog: 1.5.0-rc3...1.5.0-rc4
1.5.0-rc3
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.5.0-rc3")
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 = "9f04b942a09ef0a89066547fa06a94122e3f5e02fa640be2b44f985710b7fbdd",
strip_prefix = "rules_python-1.5.0-rc3",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc3/rules_python-1.5.0-rc3.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 = "9f04b942a09ef0a89066547fa06a94122e3f5e02fa640be2b44f985710b7fbdd",
strip_prefix = "rules_python-1.5.0-rc3/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc3/rules_python-1.5.0-rc3.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()
Full Changelog: 1.5.0-rc2...1.5.0-rc3
1.5.0-rc2
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.5.0-rc2")
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 = "4de9058c51b2b0f2494a38bd8630d8fb7f6d43278d10e95aa784b1f161f67e2b",
strip_prefix = "rules_python-1.5.0-rc2",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc2/rules_python-1.5.0-rc2.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 = "4de9058c51b2b0f2494a38bd8630d8fb7f6d43278d10e95aa784b1f161f67e2b",
strip_prefix = "rules_python-1.5.0-rc2/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc2/rules_python-1.5.0-rc2.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()
Full Changelog: 1.5.0-rc1...1.5.0-rc2
1.5.0-rc1
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.5.0-rc1")
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 = "09f146ef40a831cc28865c2b0345698b8b9e3d75ca8c10ec21a4b26766169947",
strip_prefix = "rules_python-1.5.0-rc1",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc1/rules_python-1.5.0-rc1.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 = "09f146ef40a831cc28865c2b0345698b8b9e3d75ca8c10ec21a4b26766169947",
strip_prefix = "rules_python-1.5.0-rc1/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc1/rules_python-1.5.0-rc1.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()
Full Changelog: 1.5.0-rc0...1.5.0-rc1
1.5.0-rc0
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.5.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 = "5daabe07910d11b6d245134403a484d6d69813e7a237b85f6cac982c9e42a8ea",
strip_prefix = "rules_python-1.5.0-rc0",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc0/rules_python-1.5.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 = "5daabe07910d11b6d245134403a484d6d69813e7a237b85f6cac982c9e42a8ea",
strip_prefix = "rules_python-1.5.0-rc0/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0-rc0/rules_python-1.5.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
- docs: add steps for creating release candidates by @rickeylev in #2687
- fix(toolchain): no chmod on windows when downloading hermetic toolchain by @aignas in #2693
- fix: correctly find runfiles root for symlinks by @lpulley in #2665
- feat: add riscv64 linux support by @kxxt in #2694
- build(deps): bump urllib3 from 2.2.3 to 2.3.0 in /docs by @dependabot in #2698
- build(deps): bump urllib3 from 2.2.3 to 2.3.0 in /tools/publish by @dependabot in #2699
- build(deps): bump babel from 2.16.0 to 2.17.0 in /docs by @dependabot in #2696
- build(deps): bump keyring from 25.4.1 to 25.5.0 in /tools/publish by @dependabot in #2355
- build(deps): bump django from 4.2.17 to 4.2.20 in /examples/bzlmod_build_file_generation by @dependabot in #2689
- fix: Correctly resolve macOS SDK paths by @shs96c in #2478
- chore: remove old versions of Python 3.8 by @aignas in #2700
- feat: uv lock rule instead of genrule by @aignas in #2657
- feat(python.toolchain): support file-based default Python version by @vonschultz in #2588
- fix(pypi): output only necessary target_platforms by @aignas in #2710
- refactor(pypi): implement PEP508 compliant marker evaluation by @aignas in #2692
- fix(docs): CHANGELOG "astral" typo by @lpulley in #2715
- build(deps): bump sphinx-reredirects from 0.1.5 to 0.1.6 in /docs by @dependabot in #2716
- build(deps): bump certifi from 2024.8.30 to 2025.1.31 in /docs by @dependabot in #2718
- build(deps): bump certifi from 2024.8.30 to 2025.1.31 in /tools/publish by @dependabot in #2719
- build(deps): bump pygments from 2.18.0 to 2.19.1 in /docs by @dependabot in #2720
- fix: Fix Python 3.4.x compatibilty with bootstrap (#2709) by @armandomontanez in #2714
- build(deps): bump packaging from 24.1 to 24.2 in /docs by @dependabot in #2721
- chore: remove semantics.bzl by @rickeylev in #2725
- chore: remove defunct comment about py2 compatibility by @rickeylev in #2724
- feat(pypi/parse_requirements): get dists by version when no hash provied by @Yanpei-Wang in #2695
- fix(toolchains): correctly order the toolchains by @aignas in #2735
- fix: allow warn logging to be disabled via RULES_PYTHON_REPO_DEBUG_VERBOSITY by @mattem in #2737
- fix: run check on interpreter in isolated mode by @mattem in #2738
- fix(pypi): correctly fallback to pip for git direct URLs by @aignas in #2732
- fix: support gazelle generation_mode:update_only by @jbedard in #2708
- fix(pypi): mark the extension reproducible by @aignas in #2730
- feat: allow populating binary's venv site-packages with symlinks by @rickeylev in #2617
- docs: fix a few xrefs by @rickeylev in #2740
- fix: treat ignore_root_user_error either ignored or warning by @mattem in #2739
- fix: Ensure temporary .pyc & .pyo files are excluded from the interpreters repository files by @mattem in #2743
- chore: remove unnecessary DEFAULT_BOOTSTRAP_TEMPLATE global by @rickeylev in #2744
- build(deps): bump jinja2 from 3.1.4 to 3.1.6 in /docs by @dependabot in #2750
- build(deps): bump absl-py from 2.1.0 to 2.2.2 in /docs by @dependabot in #2751
- build(deps): bump charset-normalizer from 3.4.0 to 3.4.1 in /docs by @dependabot in #2752
- build(deps): bump charset-normalizer from 3.4.0 to 3.4.1 in /tools/publish by @dependabot in #2753
- build(deps): bump jinja2 from 3.1.4 to 3.1.6 in /examples/pip_parse by @dependabot in #2754
- build(deps): bump cryptography from 43.0.3 to 44.0.1 in /tools/publish by @dependabot in #2756
- feat(toolchains): create toolchains from locally installed python by @rickeylev in #2742
- fix: run python version call in isolated mode by @mattem in #2761
- fix(pypi): fixes to the marker evaluation and utils by @aignas in #2767
- fix: Prevent absolute path creation in uv lock template by @asa in #2769
- fix: Resolve incorrect platform specific dependency by @ewianda in #2766
- fix(rules): make the srcs trully optional by @aignas in #2768
- refactor(pypi): translate wheel METADATA parsing to starlark by @aignas in #2629
- fix: replace string with modern providers in tests by @comius in #2773
- feat(toolchain): Add new make vars for Python interpreter path compliant with
--no_legacy_external_runfiles
by @FrankPortman in #2772 - fix(packaging): Format
METADATA
correctly if given emptyrequires_file
by @FrankPortman in #2771 - build(deps): bump typing-extensions from 4.12.2 to 4.13.2 in /docs by @dependabot in #2776
- build(deps): bump urllib3 from 2.3.0 to 2.4.0 in /tools/publish by @dependabot in #2775
- build(deps): bump urllib3 from 2.3.0 to 2.4.0 in /docs by @dependabot in #2774
- refactor(bzlmod): stop using 'repo' attr in whl_library by @aignas in #2779
- perf: lazily load gazelle manifest files by @mattem in #2746
- fix(ci): use ubuntu-latest for mypy action by @aignas in #2784
- doc: better document supported platform tiers by @aignas in #2783
- fix(rules): copy_propagating_kwargs() now also copies target_compatible_with by @dws in #2788
- release: 1.4.0 release prep by @rickeylev in #2789
- fix: declare PyInfo as provided by test/binary/library by @layus ...
1.4.1
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.4.1")
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 = "9f9f3b300a9264e4c77999312ce663be5dee9a56e361a1f6fe7ec60e1beef9a3",
strip_prefix = "rules_python-1.4.1",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.1/rules_python-1.4.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 = "9f9f3b300a9264e4c77999312ce663be5dee9a56e361a1f6fe7ec60e1beef9a3",
strip_prefix = "rules_python-1.4.1/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.1/rules_python-1.4.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()
Full Changelog: 1.4.0...1.4.1
1.4.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.4.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 = "a837679f1382f26968c1ee6f839c7daf9079aa53128069a1f2815decaa637304",
strip_prefix = "rules_python-1.4.0",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.0/rules_python-1.4.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 = "a837679f1382f26968c1ee6f839c7daf9079aa53128069a1f2815decaa637304",
strip_prefix = "rules_python-1.4.0/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.0/rules_python-1.4.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
- docs: add steps for creating release candidates by @rickeylev in #2687
- fix(toolchain): no chmod on windows when downloading hermetic toolchain by @aignas in #2693
- fix: correctly find runfiles root for symlinks by @lpulley in #2665
- feat: add riscv64 linux support by @kxxt in #2694
- build(deps): bump urllib3 from 2.2.3 to 2.3.0 in /docs by @dependabot in #2698
- build(deps): bump urllib3 from 2.2.3 to 2.3.0 in /tools/publish by @dependabot in #2699
- build(deps): bump babel from 2.16.0 to 2.17.0 in /docs by @dependabot in #2696
- build(deps): bump keyring from 25.4.1 to 25.5.0 in /tools/publish by @dependabot in #2355
- build(deps): bump django from 4.2.17 to 4.2.20 in /examples/bzlmod_build_file_generation by @dependabot in #2689
- fix: Correctly resolve macOS SDK paths by @shs96c in #2478
- chore: remove old versions of Python 3.8 by @aignas in #2700
- feat: uv lock rule instead of genrule by @aignas in #2657
- feat(python.toolchain): support file-based default Python version by @vonschultz in #2588
- fix(pypi): output only necessary target_platforms by @aignas in #2710
- refactor(pypi): implement PEP508 compliant marker evaluation by @aignas in #2692
- fix(docs): CHANGELOG "astral" typo by @lpulley in #2715
- build(deps): bump sphinx-reredirects from 0.1.5 to 0.1.6 in /docs by @dependabot in #2716
- build(deps): bump certifi from 2024.8.30 to 2025.1.31 in /docs by @dependabot in #2718
- build(deps): bump certifi from 2024.8.30 to 2025.1.31 in /tools/publish by @dependabot in #2719
- build(deps): bump pygments from 2.18.0 to 2.19.1 in /docs by @dependabot in #2720
- fix: Fix Python 3.4.x compatibilty with bootstrap (#2709) by @armandomontanez in #2714
- build(deps): bump packaging from 24.1 to 24.2 in /docs by @dependabot in #2721
- chore: remove semantics.bzl by @rickeylev in #2725
- chore: remove defunct comment about py2 compatibility by @rickeylev in #2724
- feat(pypi/parse_requirements): get dists by version when no hash provied by @Yanpei-Wang in #2695
- fix(toolchains): correctly order the toolchains by @aignas in #2735
- fix: allow warn logging to be disabled via RULES_PYTHON_REPO_DEBUG_VERBOSITY by @mattem in #2737
- fix: run check on interpreter in isolated mode by @mattem in #2738
- fix(pypi): correctly fallback to pip for git direct URLs by @aignas in #2732
- fix: support gazelle generation_mode:update_only by @jbedard in #2708
- fix(pypi): mark the extension reproducible by @aignas in #2730
- feat: allow populating binary's venv site-packages with symlinks by @rickeylev in #2617
- docs: fix a few xrefs by @rickeylev in #2740
- fix: treat ignore_root_user_error either ignored or warning by @mattem in #2739
- fix: Ensure temporary .pyc & .pyo files are excluded from the interpreters repository files by @mattem in #2743
- chore: remove unnecessary DEFAULT_BOOTSTRAP_TEMPLATE global by @rickeylev in #2744
- build(deps): bump jinja2 from 3.1.4 to 3.1.6 in /docs by @dependabot in #2750
- build(deps): bump absl-py from 2.1.0 to 2.2.2 in /docs by @dependabot in #2751
- build(deps): bump charset-normalizer from 3.4.0 to 3.4.1 in /docs by @dependabot in #2752
- build(deps): bump charset-normalizer from 3.4.0 to 3.4.1 in /tools/publish by @dependabot in #2753
- build(deps): bump jinja2 from 3.1.4 to 3.1.6 in /examples/pip_parse by @dependabot in #2754
- build(deps): bump cryptography from 43.0.3 to 44.0.1 in /tools/publish by @dependabot in #2756
- feat(toolchains): create toolchains from locally installed python by @rickeylev in #2742
- fix: run python version call in isolated mode by @mattem in #2761
- fix(pypi): fixes to the marker evaluation and utils by @aignas in #2767
- fix: Prevent absolute path creation in uv lock template by @asa in #2769
- fix: Resolve incorrect platform specific dependency by @ewianda in #2766
- fix(rules): make the srcs trully optional by @aignas in #2768
- refactor(pypi): translate wheel METADATA parsing to starlark by @aignas in #2629
- fix: replace string with modern providers in tests by @comius in #2773
- feat(toolchain): Add new make vars for Python interpreter path compliant with
--no_legacy_external_runfiles
by @FrankPortman in #2772 - fix(packaging): Format
METADATA
correctly if given emptyrequires_file
by @FrankPortman in #2771 - build(deps): bump typing-extensions from 4.12.2 to 4.13.2 in /docs by @dependabot in #2776
- build(deps): bump urllib3 from 2.3.0 to 2.4.0 in /tools/publish by @dependabot in #2775
- build(deps): bump urllib3 from 2.3.0 to 2.4.0 in /docs by @dependabot in #2774
- refactor(bzlmod): stop using 'repo' attr in whl_library by @aignas in #2779
- perf: lazily load gazelle manifest files by @mattem in #2746
- fix(ci): use ubuntu-latest for mypy action by @aignas in #2784
- doc: better document supported platform tiers by @aignas in #2783
- fix(rules): copy_propagating_kwargs() now also copies target_compatible_with by @dws in #2788
- release: 1.4.0 release prep by @rickeylev in #2789
New Contributors
- @kxxt made their first contribution in https://github.com/bazel-contrib/rule...
1.4.0-rc4
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.4.0-rc4")
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 = "c21b61d42c5f208cff59647d6a4ad23104c97612e67c117fe58f8c154b5b3821",
strip_prefix = "rules_python-1.4.0-rc4",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.0-rc4/rules_python-1.4.0-rc4.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 = "c21b61d42c5f208cff59647d6a4ad23104c97612e67c117fe58f8c154b5b3821",
strip_prefix = "rules_python-1.4.0-rc4/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.0-rc4/rules_python-1.4.0-rc4.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()
Full Changelog: 1.4.0-rc3...1.4.0-rc4
1.4.0-rc3
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.4.0-rc3")
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 = "89510b9b8bb2689bc62bd08feb5f9220c1dbbd19e05a46de74518240f3da17f3",
strip_prefix = "rules_python-1.4.0-rc3",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.0-rc3/rules_python-1.4.0-rc3.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 = "89510b9b8bb2689bc62bd08feb5f9220c1dbbd19e05a46de74518240f3da17f3",
strip_prefix = "rules_python-1.4.0-rc3/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.0-rc3/rules_python-1.4.0-rc3.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()
Full Changelog: 1.4.0-rc2...1.4.0-rc3