Releases: bazelbuild/rules_python
0.39.0
For more detailed setup instructions, see https://rules-python.readthedocs.io/en/latest/getting-started.html
Using Bzlmod
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.39.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "62ddebb766b4d6ddf1712f753dac5740bea072646f630eb9982caa09ad8a7687",
strip_prefix = "rules_python-0.39.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.39.0/rules_python-0.39.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 = "62ddebb766b4d6ddf1712f753dac5740bea072646f630eb9982caa09ad8a7687",
strip_prefix = "rules_python-0.39.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.39.0/rules_python-0.39.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: improve the CHANGELOG for the new release by @aignas in #2385
- chore(deps): upgrade some dependencies that will eventually be required by Bazel 8 by @rickeylev in #2383
- feat(toolchain): support freethreaded toolchains by @aignas in #2372
- chore: change the parse_all_requirements_files default value by @aignas in #2389
- feat: add attrs/fields for the runtime's ABI flags by @rickeylev in #2390
- deps: updates for bazel 8 compatibility by @rickeylev in #2379
- chore: remove references to @rules_cc//cc:defs.bzl by @comius in #2293
- fix: Bazel version check by @comius in #2393
- tests: use $(rootpaths) to get executable files paths for Bazel 8 compatibility by @rickeylev in #2395
- fix: skip precompiling if using Bazel-builtin PyRuntimeInfo by @rickeylev in #2394
- chore: remove Thulio from BCR app configs by @aignas in #2397
- chore: update changelog for 0.39.0 by @rickeylev in #2398
Full Changelog: 0.38.0...0.39.0
0.38.0
For more detailed setup instructions, see https://rules-python.readthedocs.io/en/latest/getting-started.html
Using Bzlmod
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.38.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34",
strip_prefix = "rules_python-0.38.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.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 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34",
strip_prefix = "rules_python-0.38.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.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: give user-friendly permalinks in changelog by @rickeylev in #2315
- ci: upgrade to rbe_ubuntu2004 by @rickeylev in #2316
- chore: set 7.x in bazelversion by @rickeylev in #2317
- docs: rules_python bzlmod GA and 1.0 prep by @aignas in #2296
- test(bzlmod): refactor pip_parse to make it more testable by @aignas in #2314
- build(deps): bump sphinx from 8.0.2 to 8.1.3 in /docs by @dependabot in #2322
- build(deps): bump charset-normalizer from 3.3.2 to 3.4.0 in /tools/publish by @dependabot in #2323
- build(deps): bump charset-normalizer from 3.3.2 to 3.4.0 in /docs by @dependabot in #2321
- docs: fix typo in precompiling docs by @rickeylev in #2324
- fix(rules): remove rules_python --incompatible_python_disallow_native_rules checking by @rickeylev in #2327
- fix: fix errors with bazel@head by @rickeylev in #2332
- docs: update changelog for 0.37.1 by @rickeylev in #2330
- docs: tell how to setup readthedocs integration with sphinxdocs by @rickeylev in #2331
- deps: use rules_cc 0.0.13 to support newer bazel versions by @rickeylev in #2335
- docs: link to main docs in generated release notes by @rickeylev in #2338
- chore: bump twine dependencies and cleanup for 1.0 by @aignas in #2333
- chore: remove an accidental file by @aignas in #2348
- fix(bzlmod): generate config_setting values for all python toolchains by @aignas in #2350
- docs: document the is_python config settings by @rickeylev in #2336
- docs: tell how to create a release branch for patch releases by @rickeylev in #2329
- chore: add aignas to the BCR maintainers by @aignas in #2352
- fix: breakages in unused codepaths after recent refactors by @oprypin in #2353
- refactor(pypi): use a macro to define whl_library targets by @aignas in #2347
- feat: add features.version value by @rickeylev in #2357
- refactor: fold bazel-specific code into main files by @rickeylev in #2358
- fix: allow spaces in whl_librarys by @mark-thm in #2334
- tests: don't restrict python versions in bzlmod example by @rickeylev in #2362
- fix: Remove --no-build-isolation from pip install command by @mark-thm in #2360
- docs: clarify that PyInfo.transitive_sources may not include py files by @rickeylev in #2367
- fix(pypi): correctly pass
extra_pip_args
when building sdists by @aignas in #2368 - fix(pypi): use local version specifiers for patched whl output by @aignas in #2365
- fix(bzlmod): allow users to specify extra targets to be added to hub repos by @aignas in #2369
- fix: make sphinxdocs support directory inputs by @rickeylev in #2375
- feat(bzlmod): cross-platform builds without experimental_index_url by @aignas in #2325
- chore: cleanup and fix some bzl_library deps in //python/private by @rickeylev in #2381
- tests: fix the job name for the debian bzlmod gazelle job by @rickeylev in #2382
- chore: move code out of WORKSPACE.bzlmod and into MODULE by @rickeylev in #2380
- chore: prepare CHANGELOG for 0.38.0 release by @aignas in #2384
Full Changelog: 0.37.0...0.38.0
0.37.2
Using Bzlmod
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.37.2")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "c6fb25d0ba0246f6d5bd820dd0b2e66b339ccc510242fd4956b9a639b548d113",
strip_prefix = "rules_python-0.37.2",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.2/rules_python-0.37.2.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 = "c6fb25d0ba0246f6d5bd820dd0b2e66b339ccc510242fd4956b9a639b548d113",
strip_prefix = "rules_python-0.37.2/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.2/rules_python-0.37.2.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: 0.37.1...0.37.2
0.37.1
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.37.1")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "bd4797821b72b80b69e3c5ab4ad037e7fd1e6a0a27aebf42424c7ab0ce32e254",
strip_prefix = "rules_python-0.37.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.1/rules_python-0.37.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 = "bd4797821b72b80b69e3c5ab4ad037e7fd1e6a0a27aebf42424c7ab0ce32e254",
strip_prefix = "rules_python-0.37.1/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.1/rules_python-0.37.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: 0.37.0...0.37.1
0.37.0
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.37.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "0cc05ddb27614baecace068986931e2a6e9f69114e6115fc5dc58250faf56e0f",
strip_prefix = "rules_python-0.37.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.0/rules_python-0.37.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 = "0cc05ddb27614baecace068986931e2a6e9f69114e6115fc5dc58250faf56e0f",
strip_prefix = "rules_python-0.37.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.0/rules_python-0.37.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
- refactor: move PyInfo into separate file by @rickeylev in #2249
- Remove absolute path from libpython.dylib by @keith in #2256
- chore: don't add migration tag if Starlark implementation is enabled by @rickeylev in #2257
- fix(whl_filegroup): Make RECORD from wheel available by @TimotheusBachinger in #2238
- refactor: add builders to make creating PyInfo/depset/runfiles easier by @rickeylev in #2251
- feat: add py_wheel.compress to control using compression by @keith in #2260
- chore: delete stale bot by @alexeagle in #2264
- fix(bzlmod): correctly wire the extra_pip_args by @aignas in #2258
- build(deps): bump idna from 3.8 to 3.10 in /docs by @dependabot in #2227
- feat(toolchains): default py_runtime.implementation_name to cpython by @rickeylev in #2272
- fix(bzlmod): set the default_version to the python_version flag by @aignas in #2253
- feat(toolchains): expose the //python/config_settings:python_version_major_minor by @aignas in #2275
- feat: add public API for analysis-phase logic by @rickeylev in #2252
- fix(py_wheel): Quote wheel RECORD file entry elements if needed by @kcon-stackav in #2269
- chore: support removal of builtin providers by @comius in #2274
- fix(whl_library): avoid excessive report_progress() messages by @mattnworb in #2280
- docs: clarify that the runtime env toolchains don't provide build info by @rickeylev in #2279
- feat(toolchain): add python 3.13.0, updated other versions and bumped coverage to 7.6.1 by @vfdev-5 in #2265
- fix: pass kwargs
env
to both update and test targets by @lpulley in #2277 - build(deps): bump zipp from 3.17.0 to 3.19.1 in /examples/pip_parse by @dependabot in #2266
- build(deps): bump idna from 3.7 to 3.10 in /tools/publish by @dependabot in #2228
- build(deps): bump docutils from 0.19 to 0.21.2 in /tools/publish by @dependabot in #2159
- build(deps): bump certifi from 2024.7.4 to 2024.8.30 in /tools/publish by @dependabot in #2211
- fix(bzlmod): let workspace-invoked python_register_toolchains to register toolchains by @rickeylev in #2289
- build(deps): bump certifi from 2023.7.22 to 2024.7.4 in /examples/bzlmod_build_file_generation by @dependabot in #2287
- build(deps): bump certifi from 2023.7.22 to 2024.7.4 in /examples/pip_parse by @dependabot in #2291
- feat(bzlmod): enable download_only for experimental_index_url by @aignas in #2290
- fix(precompiling)!: make binary-level precompile opt-in/opt-opt work by @rickeylev in #2243
- fix(pip): skip wheel patching with empty patches by @keith in #2294
- build(deps): bump urllib3 from 2.2.2 to 2.2.3 in /docs by @dependabot in #2301
- build(deps): bump markupsafe from 2.1.5 to 3.0.1 in /docs by @dependabot in #2302
- build(deps): bump sphinx-rtd-theme from 2.0.0 to 3.0.1 in /docs by @dependabot in #2303
- fix(sphinxdocs),deps: allow using sphinx_stardoc with bzlmod; add stardoc 0.6.2 as dependency by @rickeylev in #2295
- chore: move files out of private/common by @rickeylev in #2285
- fix(precompiling): only add pyc to default outputs if precompiling explicitly enabled for target by @rickeylev in #2307
- chore: use rules_shell by @aignas in #2305
- sphinxdocs: add typedef directive for documenting user-defined types by @rickeylev in #2300
- chore: enable exec tools toolchain by default by @rickeylev in #2308
- docs: add stubs so Bazel docs link to a valid file by @rickeylev in #2309
- sphinxdocs: fix rendering of args in directives with empty doc by @rickeylev in #2313
- docs: fix rendering of python extension by @rickeylev in #2312
- chore: update changelog for 0.37.0 by @rickeylev in #2311
New Contributors
- @TimotheusBachinger made their first contribution in #2238
- @kcon-stackav made their first contribution in #2269
- @vfdev-5 made their first contribution in #2265
Full Changelog: 0.36.0...0.37.0
0.36.0
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.36.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
strip_prefix = "rules_python-0.36.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.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 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
strip_prefix = "rules_python-0.36.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.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
- sphinxdocs: add docs; support sources from other directories by @rickeylev in #2128
- build(deps): bump myst-parser from 3.0.1 to 4.0.0 in /docs/sphinx by @dependabot in #2109
- refactor: move docs/sphinx -> docs by @rickeylev in #2130
- fix: formatting directive bugs in test by @tokongs in #2134
- feat(gazelle): Update resolve.go to provide more human-friendly error output by @alex-torok in #2120
- fix: Exclude external directory when generating python report by @ewianda in #2136
- fix(bzlmod): keep the lockfile platform independent when resolving python by @aignas in #2135
- docs: turn a couple mentions of flags into cross references by @rickeylev in #2146
- fix(whl_library): remove
--no-index
and add--no-build-isolation
when build sdist by @ewianda in #2126 - fix: Handle relative paths properly in _absolute_url by @WillMorrison in #2153
- docs: docgen python apis by @rickeylev in #2149
- build(deps): bump docutils from 0.20.1 to 0.21.2 in /docs by @dependabot in #2158
- fix(gazelle): Correctly resolve deps that have top-level module overlap with a gazelle_python.yaml dep module by @alex-torok in #2160
- docs: document the exec tools toolchain pieces by @rickeylev in #2163
- fix: correctly check the arg count in precompiler.py by @oprypin in #2165
- refactor: move bootstrap tests to their own directory by @rickeylev in #2168
- refactor: allow py_library to accept additional fragments by @rickeylev in #2170
- refactor(flags): return FeatureFlagInfo in --python_version flag by @rickeylev in #2167
- fix(py_wheel): Avoid reliance on bash in
py_wheel
macro. by @UebelAndre in #2171 - feat(rules): add PyExecutableInfo by @rickeylev in #2166
- refactor(sphinxdocs): use bazel label format for internal object tracking by @rickeylev in #2174
- docs: fix some doc warnings and xrefs by @rickeylev in #2176
- refactor(precompiler): give optimize/invalidation_mode flags default values by @oprypin in #2180
- build(deps): bump sphinx from 7.4.7 to 8.0.2 in /docs by @dependabot in #2137
- build(deps): bump alabaster from 0.7.16 to 1.0.0 in /docs by @dependabot in #2138
- doc: clarify the precompile attribute affects the local target by @rickeylev in #2179
- build(bazelci): explicitly enable workspace where Bzlmod is disabled by @Wyverald in #2184
- tests: move various supporting code under tests/support by @rickeylev in #2183
- docs: add
testing.*
Bazel objects to Sphinx inventory and xref in docs by @rickeylev in #2185 - fix: make bootstrap_impl=script compute correct directory when RUNFILES_MANIFEST_FILE set by @scasagrande in #2177
- cleanup: remove commented out debug statement in precompile tests by @rickeylev in #2191
- fix: allow detecting if
--precompile_source_retention
was specified on the command line by @rickeylev in #2192 - docs: add module_ctx, repository_ctx and path for xref support by @aignas in #2188
- chore: cleanup exposed python_repository symbols and add docs by @aignas in #2189
- fix(bzlmod): use --lockfile_mode=update and add a separate job for lockfile testing by @aignas in #2154
- feat(rules): add build_data_file field to PyExecutableInfo by @oprypin in #2181
- build(deps): bump urllib3 from 2.0.7 to 2.2.2 in /tests/multiple_inputs by @dependabot in #2140
- tests: use
{package}
instead of hard-coded path in precompile_tests by @rickeylev in #2193 - fix: allow disabling exec_tools toolchain from looking up an interpreter by @rickeylev in #2194
- docs: document py_cc_toolchain and py_runtime_pair by @rickeylev in #2196
- feat: allow py_cc_toolchain libs to be optional by @rickeylev in #2197
- fix: Fix incorrectly generated
Required-Dist
when specifying requirements with markers in extra_requires in py_wheel rule by @sfc-gh-wzhao in #2200 - feat(toolchain): add patch_strip attr for python_repository by @aignas in #2201
- feat: default
py_runtime
version info to--python_version
by @rickeylev in #2198 - fix(sphinx): Support python 3.9 in Sphinx rules by @imarban in #2208
- build(deps): bump certifi from 2024.7.4 to 2024.8.30 in /docs by @dependabot in #2210
- build(deps): bump mdit-py-plugins from 0.4.1 to 0.4.2 in /docs by @dependabot in #2209
- tests: make precompile tests pass when other toolchains are defined by @rickeylev in #2213
- test(bzlmod): add python.toolchain unit tests by @aignas in #2204
- chore: cleanup unused attributes for the host_toolchain repo rule by @aignas in #2195
- refactor(internal): make the usage of MINOR_MAPPING variable explicit in full_version by @aignas in #2219
- refactor(internal): add a semver parsing utility function by @aignas in #2218
- docs: give some general guidance on how to define custom toolchains by @rickeylev in #2220
- refactor: move hermetic Python runtime setup into macro by @rickeylev in #2221
- feat: add //python:none as public target to disable exec_interpreter by @rickeylev in #2226
- chore: remove mandatory default values for python version flag by @aignas in #2217
- fix: Prefix bootstrap file to prevent pytest reentrance by @mortenmj in #2230
- refactor(toolchains): split the implementation of toolchain rules to separate files by @aignas in #2232
- fix(ci): use --enable_workspace for bazel-in-bazel tests by @aignas in #2237
- fix(platforms): include flag_values in config_settings by @aignas in #2236
- feat(bzlmod): add python.override APIs by @aignas in #2222
- chore: prepare 0.36.0 release by @aignas in #2245
New Contributors
- @tokongs made their first contribution in ht...
0.35.0
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.35.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "be04b635c7be4604be1ef20542e9870af3c49778ce841ee2d92fcb42f9d9516a",
strip_prefix = "rules_python-0.35.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.35.0/rules_python-0.35.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 = "be04b635c7be4604be1ef20542e9870af3c49778ce841ee2d92fcb42f9d9516a",
strip_prefix = "rules_python-0.35.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.35.0/rules_python-0.35.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()
Changed
- (pypi) A better log message when the wheel is built from an sdist or
when the wheel is downloaded usingdownload_only
feature to aid debugging. - (gazelle): Simplify and make gazelle_python.yaml have only top level package name.
It would work well in cases to reduce merge conflicts and ease the change review. - (toolchains): Change some old toochain versions to use 20240726 release to
include dependency updates3.8.19
,3.9.19
,3.10.14
,3.11.9
- (toolchains): Bump default toolchain versions to:
3.12 -> 3.12.4
- (rules)
PYTHONSAFEPATH
is inherited from the calling environment to allow
disabling it (Requires {obj}--bootstrap_impl=script
)
(#2060).
Fixed
- (pypi)
compile_pip_requirements
now sets theUSERPROFILE
env variable on
Windows to work around an issue wheresetuptools
fails to locate the user's
home directory. - (pypi) correctly handle absolute URLs in
parse_simpleapi_html.bzl
. - (rules) Fixes build targets linking against
@rules_python//python/cc:current_py_cc_libs
in host platform builds on macOS, by editing theLC_ID_DYLIB
field of the hermetic interpreter's
libpython3.x.dylib
usinginstall_name_tool
, setting it to its absolute path under Bazel's
execroot. - (rules) Signals are properly received when using {obj}
--bootstrap_impl=script
(for non-zip builds).
(#2043) - (rules) Fixes Python builds when the
--build_python_zip
is set tofalse
on
Windows. See #1840. - (rules) Fixes Mac +
--build_python_zip
+ {obj}--bootstrap_impl=script
(#2030). - (rules) User dependencies come before runtime site-packages when using
{obj}--bootstrap_impl=script
.
(#2064). - (rules) Version-aware rules now return both
@_builtins
and@rules_python
providers instead of only one.
(#2114). - (pypi) Fixed pypi parse_simpleapi_html function for feeds with package metadata
containing ">" sign - (toolchains) Added missing executable permission to
//python/runtime_env_toolchains
interpreter script so that it is runnable.
(#2085). - (pip) Correctly use the
sdist
downloaded by the bazel downloader when using
experimental_index_url
feature. Fixes
#2091. - (gazelle) Make
gazelle_python_manifest.update
manual to avoid unnecessary
network behavior. - (bzlmod): The conflicting toolchains during
python
extension will no longer
cause warnings by default. In order to see the warnings for diagnostic purposes
set the env varRULES_PYTHON_REPO_DEBUG_VERBOSITY
to one ofINFO
,DEBUG
orTRACE
.
Fixes #1818. - (runfiles) Make runfiles lookups work for the situation of Bazel 7,
Python 3.9 (or earlier, where safepath isn't present), and the Rlocation call
in the same directory as the main file.
Fixes #1631.
Added
- (pypi)
compile_pip_requirements
supports multiple requirements input files assrcs
. - (rules)
PYTHONSAFEPATH
is inherited from the calling environment to allow
disabling it (Requires {obj}--bootstrap_impl=script
)
(#2060). - (gazelle) Added
python_generation_mode_per_package_require_test_entry_point
in order to better accommodate users who use a custom macro,
pytest-bazel
, rules_python_pytest orrules_py
py_test_main in order to integrate withpytest
. Currently the default
flag value is set totrue
for backwards compatible behaviour, but in the
future the flag will be flipped befalse
by default. - (toolchains) New Python versions available:
3.12.4
using the 20240726 release. - (pypi) Support env markers in requirements files. Note, that this means that
if your requirements files contain env markers, the Python interpreter will
need to be run during bzlmod phase to evaluate them. This may incur
downloading an interpreter (for hermetic-based builds) or cause non-hermetic
behavior (if using a system Python).
List of PRs:
- chore: include aignas to PyPI code reviewers by @aignas in #2034
- fix(windows): symlink bootstrap script when not building zip by @KoltesDigital in #2015
- fix: pypi parse_simpleapi_html.bzl is robust to metadata containing ">" sign by @mihaidusmanu in #2031
- build(deps): bump certifi from 2023.7.22 to 2024.7.4 in /tools/publish by @dependabot in #2041
- refactor: use http_archive for the stdlib list by @sitaktif in #2037
- build(deps): bump charset-normalizer from 3.0.1 to 3.3.2 in /tools/publish by @dependabot in #2028
- build(deps): bump certifi from 2024.6.2 to 2024.7.4 in /docs/sphinx by @dependabot in #2046
- fix: use
exec
to invoke the stage-2 bootstrap for non-zip case by @chowder in #2047 - chore: add cxxopt std=c++14 to BCR presubmit config by @rickeylev in #2051
- tests: add integration test for build_python_zip by @rickeylev in #2045
- refactor: don't load repo-phase objects from build-phase by @rickeylev in #2056
- fix(gazelle): Use the correct rules_go label in gazelle/manifest/defs.bzl by @dougthor42 in #2058
- feat: Introduce an experimental
uv
toolchain by @groodt in #1989 - refactor: Address a few improvements on
uv
toolchain by @groodt in #2062 - build(deps): bump setuptools from 65.6.3 to 70.0.0 in /examples/pip_parse by @dependabot in #2065
- build(deps): bump zipp from 3.11.0 to 3.19.2 in /tools/publish by @dependabot in #2066
- fix: make mac zip builds work by @rickeylev in #2052
- internal: repos to create a toolchain from a locally installed Python by @rickeylev in #2000
- refactor(pypi): split out more utils and start passing 'abi_os_arch' around by @aignas in #2069
- refactor(pypi): split out code for env marker evaluation for reuse by @aignas in #2068
- docs: document some environment variables by @rickeylev in #2077
- refactor(internal): move the os/arch detection to repo_utils by @aignas in #2075
- fix(uv): fix UV_BIN usage with current_toolchain by @aignas in #2074
- docs: describe
annotations
attr ofpip_parse
by @bruno-digitbio in #1667 - feat!: Following generation mode when generating test targets by @linzhp in #2044
- feat: inherit PYTHONSAFEPATH env var from outer process by @rickeylev in #207...
0.34.0
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.34.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
strip_prefix = "rules_python-0.34.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.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 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
strip_prefix = "rules_python-0.34.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.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: Remove transitive legacy struct provider usage by @fmeum in #1957
- docs: fix doc for how to use new bootstrap impl by @rickeylev in #1959
- chore: various cleanups to make google imports/patching easier by @rickeylev in #1958
- build(deps): bump idna from 3.4 to 3.7 in /tools/publish by @dependabot in #1849
- build(deps): bump cryptography from 41.0.6 to 42.0.4 in /tools/publish by @dependabot in #1772
- ci: add a custom dependabot file by @aignas in #1960
- build(deps): bump pygments from 2.17.2 to 2.18.0 in /docs/sphinx by @dependabot in #1966
- build(deps): bump actions/checkout from 2 to 4 by @dependabot in #1961
- build(deps): bump actions/stale from 3 to 9 by @dependabot in #1962
- build(deps): bump markupsafe from 2.1.3 to 2.1.5 in /docs/sphinx by @dependabot in #1964
- build(deps): bump softprops/action-gh-release from 1 to 2 by @dependabot in #1963
- build(deps): bump typing-extensions from 4.9.0 to 4.12.2 in /docs/sphinx by @dependabot in #1965
- fix(bzlmod): use same target in requirement('foo') and all_requirements by @jvolkman in #1973
- refactor(bzlmod): generate fewer targets for pip_config_settings by @aignas in #1974
- chore: access ctx.version_file to inform Bazel stamping info is needed by @rickeylev in #1952
- build(deps): bump urllib3 from 1.26.18 to 1.26.19 in /tools/publish by @dependabot in #1981
- build(deps): bump babel from 2.13.1 to 2.15.0 in /docs/sphinx by @dependabot in #1983
- docs: Fix a few typos in docs and function names by @rickeylev in #1978
- fix: enable auto exec groups using attribute by @rickeylev in #1986
- docs: Remove proposals by @groodt in #1990
- chore: use
**
globs instead of explcit BUILD.bazel reference in distribution filegroups by @rickeylev in #1991 - refactor(internal): allow setting linking mode for internal cc_details APIs by @rickeylev in #1982
- fix(toolchain): disable exec toolchain by default by @aignas in #1968
- fix: Resolve the test manifest with the runfiles lib. by @lberki in #1993
- fix: allow creating PyRuntimeInfo without specifying interpreter_version_info by @rickeylev in #1992
- doc: Changelog updates for 0.33.2 by @aignas in #1995
- refactor!: Remove entrypoint by @groodt in #1987
- refactor: lookup exec interpreter using toolchain resolution by @rickeylev in #1997
- fix: Add
configure=True
for internal_config_repo by @meteorcloudy in #1998 - chore: remove dead code from whl_target_platforms by @aignas in #2001
- fix(bzlmod): pass only non-default values to whl_library by @aignas in #2002
- refactor: move PyPI related extension and repository_rule setup to its own dir by @aignas in #2003
- docs: Removes dead link after docs were migrated to sphinx by @groodt in #2005
- refactor: Remove unused template substitution by @groodt in #2004
- refactor: move the remaining PyPI related functions to private/pypi by @aignas in #2006
- chore: adjust CODEOWNERS by @aignas in #2008
- fix: make first default output the executable again by @rickeylev in #2010
- refactor: call a function to define internal pypi flags instead of listcomp by @rickeylev in #2011
- chore: bump sphinxdocs deps by @aignas in #2013
- fix(whl_library): correctly handle arch-specific deps in wheels by @aignas in #2007
- fix(multiplatform): Add i386 Linux support by @nicbadiu in #1999
- fix: Fix broken logger statement in parse_requirements.bzl by @mark-thm in #2017
- feat: add runtime_env toolchain suite to replace "autodetecting" toolchain by @rickeylev in #2018
- fix(bzlmod): only expose common packages via the requirements constants by @aignas in #1955
- feat(gazelle): Add directives for label format & normalisation by @wingsofovnia in #1976
- chore: Remove unused renovate.json by @groodt in #2021
- (chore): Remove the extra indirection and
bzlmod
folder by @groodt in #2022
New Contributors
- @lberki made their first contribution in #1993
- @nicbadiu made their first contribution in #1999
- @mark-thm made their first contribution in #2017
- @wingsofovnia made their first contribution in #1976
Full Changelog: 0.33.1...0.34.0
0.33.2
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.33.2")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "e3f1cc7a04d9b09635afb3130731ed82b5f58eadc8233d4efb59944d92ffc06f",
strip_prefix = "rules_python-0.33.2",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.33.2/rules_python-0.33.2.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 = "e3f1cc7a04d9b09635afb3130731ed82b5f58eadc8233d4efb59944d92ffc06f",
strip_prefix = "rules_python-0.33.2/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.33.2/rules_python-0.33.2.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: 0.33.1...0.33.2
0.33.1
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta. APIs subject to change.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.33.1")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
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 = "5bcfa3852444d084b1d3262714cec151b797648d4d444ea9895c7c7ed79cd715",
strip_prefix = "rules_python-0.33.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.33.1/rules_python-0.33.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 = "5bcfa3852444d084b1d3262714cec151b797648d4d444ea9895c7c7ed79cd715",
strip_prefix = "rules_python-0.33.1/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.33.1/rules_python-0.33.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()
What's Changed
Full Changelog: 0.33.0...0.33.1