Releases: bazelbuild/rules_python
0.22.1
This is a patch release of 0.22.0 that automatically registers the @bazel_tools//tools/python:autodetecting_toolchain
toolchain.
See bazelbuild/bazel#20458 for more information.
Using Bzlmod with Bazel 6
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.22.1")
pip = use_extension("@rules_python//python:extensions.bzl", "pip")
pip.parse(
name = "pip",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")
# (Optional) Register a specific python toolchain instead of using the host version
python = use_extension("@rules_python//python:extensions.bzl", "python")
python.toolchain(
name = "python3_9",
python_version = "3.9",
)
use_repo(python, "python3_9_toolchains")
register_toolchains(
"@python3_9_toolchains//:all",
)
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 = "a5640fddd4beb03e8c1fde5ed7160c0ba6bd477e7d048661c30c06936a26fd63",
strip_prefix = "rules_python-0.22.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.22.1/rules_python-0.22.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 = "a5640fddd4beb03e8c1fde5ed7160c0ba6bd477e7d048661c30c06936a26fd63",
strip_prefix = "rules_python-0.22.1/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.22.1/rules_python-0.22.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.22.0...0.22.1
0.27.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.27.1")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
name = "pip",
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 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
strip_prefix = "rules_python-0.27.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.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 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
strip_prefix = "rules_python-0.27.1/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.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.27.0...0.27.1
0.27.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.27.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
name = "pip",
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 = "9acc0944c94adb23fba1c9988b48768b1bacc6583b52a2586895c5b7491e2e31",
strip_prefix = "rules_python-0.27.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.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 = "9acc0944c94adb23fba1c9988b48768b1bacc6583b52a2586895c5b7491e2e31",
strip_prefix = "rules_python-0.27.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.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
See CHANGELOG 0.27.0 for
a human friendly description of what has changed. Below are an overview of commits.
- chore: bump the CHANGELOG.md by @aignas in #1467
- docs: document a breaking changes policy by @rickeylev in #1460
- internal: add stub register_extension_name to make patching easier by @rickeylev in #1475
- docs(gazelle): Update README.md for gazelle by @jsharpe in #1454
- doc(bzlmod): bump stardoc to 0.6.2 and enable bzlmod docs building by @aignas in #1476
- refactor(bzlmod): move bzlmod code to private/bzlmod by @aignas in #1477
- test: use a custom rule instead of native.filegroup for testing that PyInfo is a required provider. by @rickeylev in #1479
- docs: Fix a few typos in various docs and comments by @rickeylev in #1480
- fix(repo setup): Skip aliases for unloaded toolchains by @kilian-funk in #1473
- Disable Bzlmod explicitly in .bazelrc by @meteorcloudy in #1470
- test(bzlmod): Make some tests bzlmod compatible with Bazel@HEAD by @rickeylev in #1482
- docs: Fix URL in README.md by @dshahbaz in #1483
- docs: allow manual edits to generated docs by @aignas in #1478
- fix: allowing to import code generated from proto with strip_import_prefix by @linzhp in #1406
- fix(examples): bump gazelle in examples/build_file_generation by @OliverFM in #1421
- refactor(visibility)!: limit visibility of an internal library by @aignas in #1490
- ci: pin pystar bazel version by @aignas in #1497
- fix(py_wheel): produce deterministic wheel files by @dizzy57 in #1453
- build(gazelle): embed Python zip file by @linzhp in #1485
- refactor(whl_library): split wheel downloading and extraction into separate executions by @aignas in #1487
- feat(whlmaker): introduce an internal _WhlFile class and stop sorting RECORD by @aignas in #1488
- test: remove usage of deprecated method
TestCase.assertEquals
by @dizzy57 in #1494 - docs: Fix typo in comment by @jjwatt in #1408
- docs: initial doc generation using Sphinx by @rickeylev in #1489
- test(bzlmod): support toolchain tests on bzlmod by @aignas in #1507
- build(deps): bump urllib3 from 1.26.13 to 1.26.18 in /examples/bzlmod by @dependabot in #1505
- build(deps): bump urllib3 from 1.26.7 to 1.26.18 in /tests/pip_repository_entry_points by @dependabot in #1500
- build(deps): bump urllib3 from 1.26.14 to 1.26.18 in /tools/publish by @dependabot in #1499
- build(deps): bump urllib3 from 1.26.13 to 1.26.18 in /examples/pip_parse by @dependabot in #1501
- build(deps): bump urllib3 from 1.26.17 to 1.26.18 in /examples/pip_repository_annotations by @dependabot in #1502
- chore!: disable pip_install and remove from examples and tests by @aignas in #1510
- docs: make readthedocs render a bit nicer and port docs over to Sphinx by @rickeylev in #1511
- feat(bzlmod): support patching 'whl' distributions by @aignas in #1393
- chore!: switch py_wheel flags to True to start enforcing PEP440 by @aignas in #1513
- refactor!: do not use a wrapper macro for pip_parse by @aignas in #1514
- build(deps): bump requests from 2.28.2 to 2.31.0 in /docs/sphinx by @dependabot in #1512
- build(deps): bump urllib3 from 1.26.15 to 1.26.18 in /docs/sphinx by @dependabot in #1508
- build(deps): bump certifi from 2022.12.7 to 2023.7.22 in /docs/sphinx by @dependabot in #1509
- internal(pystar): use rules_python PyCcLinkParamsProvider if pystar is enabled by @rickeylev in #1517
- ci: don't run minimum bazel version tests as part of bazel downstream… by @rickeylev in #1522
- docs: show PR warning banner and fix links doc source pages by @rickeylev in #1521
- tests: make multi_python_verions example bzlmod compatible by @rickeylev in #1523
- test: make compile_pip_requirements work with bzlmod enabled by @rickeylev in #1526
- tests: explicitly disable bzlmod for pip_repository_entry_points test by @rickeylev in #1527
- tests: explicitly disable bzlmod for pip_parse_vendored example by @rickeylev in #1529
- chore(pip_parse, gazelle): generate/use hub repo aliases by default by @aignas in #1525
- test: make compile_pip_requirements_test_from_external_workspace work with bzlmod by @rickeylev in #1528
- tests: make pip_parse example work with bzlmod enabled by @rickeylev in #1524
- refactor: use click in dependency_resolver.py by @cj81499 in #1071
- cleanup(pystar): inline @bazel_tools and @platforms references by @rickeylev in #1531
- cleanup: delete defunct load of bzlmod pip_repository by @rickeylev in #1533
- feat(pip): provide pypi -> whl target mapping in requirements.bzl by @alexeagle in #1532
- feat: support pyproject.toml in compile_pip_requirements by @aignas in #1519
- cleanup: delete commented out line forgottenly left in by @rickeylev in #1535
- fix(gazelle): generate a single
py_test
for coarse_grained setups by @aignas in #1538 - tests: disable bzlmod for workspace-only pip_repository_annotations example by @rickeylev in #1540
- tests: disable bzlmod for workspace-only build_file_generation example by @rickeylev in #1539
- fix: always ignore
.pyc.NNNN
files from the hermetic runtime tree by @rickeylev in #1541 - chore(wheelmaker): drop Python 2 support by @aignas in #1545
- test(pystar): run pystar under Windows and Mac by @rickeylev in #1547
- test(gazelle): have a go_test target for each gazelle test by @aignas in #1537
- feat: expose 'pip_utils.normalize_name' function by @aignas in https://github.co...
0.26.0
Changed in this release
-
Python version patch level bumps:
- 3.8.15 -> 3.8.18
- 3.9.17 -> 3.9.18
- 3.10.12 -> 3.10.13
- 3.11.4 -> 3.11.6
-
(deps) Upgrade rules_go 0.39.1 -> 0.41.0; this is so gazelle integration works with upcoming Bazel versions
-
(multi-version) The
distribs
attribute is no longer propagated. This attribute has been long deprecated by Bazel and shouldn't be used. -
Calling
//python:repositories.bzl#py_repositories()
is required. It has always been documented as necessary, but it was possible to omit it in certain cases. An error about@rules_python_internal
means thepy_repositories()
call is missing inWORKSPACE
. -
(bzlmod) The
pip.parse
extension will generate os/arch specific lock file entries onbazel>=6.4
.
Removed in this release
- (bzlmod) The
entry_point
macro is no longer supported and has been removed in favor of thepy_console_script_binary
macro forbzlmod
users. - (bzlmod) The
pip.parse
no longer generates{hub_name}_{py_version}
hub repos as theentry_point
macro has been superseded bypy_console_script_binary
. - (bzlmod) The
pip.parse
no longer generates{hub_name}_{distribution}
hub repos.
Added in this release
- (bzlmod, entry_point) Added
py_console_script_binary
, which allows adding custom dependencies to a package's entry points and customizing thepy_binary
rule used to build it. - New Python versions available:
3.8.17
,3.11.5
using
https://github.com/indygreg/python-build-standalone/releases/tag/20230826. - (gazelle) New
# gazelle:python_generation_mode file
directive to support generating onepy_library
per file. - (python_repository) Support
netrc
andauth_patterns
attributes to enable authentication against private HTTP hosts serving Python toolchain binaries. //python:packaging_bzl
added, abzl_library
for the Starlark files//python:packaging.bzl
requires.- (py_wheel) Added the
incompatible_normalize_name
feature flag to normalize the package distribution name according to latest Python packaging standards. Defaults toFalse
for the time being. - (py_wheel) Added the
incompatible_normalize_version
feature flag to normalize the package version according to PEP440 standard. This also adds support for local version specifiers (versions with a+
in them), in accordance with PEP440. Defaults toFalse
for the time being. - New Python versions available:
3.8.18
,3.9.18
,3.10.13
,3.11.6
,3.12.0
using https://github.com/indygreg/python-build-standalone/releases/tag/20231002.3.12.0
support is considered beta and may have issues.
Fixed in this release
- (whl_library) No longer restarts repository rule when fetching external dependencies improving initial build times involving external dependency fetching.
- (gazelle) Improve runfiles lookup hermeticity.
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.26.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
name = "pip",
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 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
strip_prefix = "rules_python-0.26.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.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 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
strip_prefix = "rules_python-0.26.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.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
- doc: Note Python version changes in CHANGELOG by @rickeylev in #1391
- fix: bcr releaser email by @f0rmiga in #1392
- Adding kwargs to gazelle_python_manifest by @linzhp in #1289
- docs: Use correct link to build badge image and build status page. by @rickeylev in #1390
- feat(py_console_script_binary)!: entry points with custom dependencies by @aignas in #1363
- fix(whl_library): avoid unnecessary repository rule restarts by @aignas in #1400
- refactor: add missing
//python/config_settings/private:distribution
target by @philsc in #1402 - Import pycross_wheel_library by @philsc in #1403
- refactor: upgrade certifi by @cflewis in #1397
- fix: don't set distribs in version transitioning rule by @comius in #1412
- fix(gazelle): upgrade rules_go: 0.39.1 -> 0.41.0 to work with upcoming Bazel versions by @sgowroji in #1410
- fix: gazelle: Fix non-hermetic runfiles lookup by @fmeum in #1415
- feat: create toolchain type for py_proto_library by @comius in #1416
- internal: copy Starlark rule implementation from Bazel by @rickeylev in #1418
- feat: add new Python toolchain versions by @aignas in #1414
- internal(pystar): make starlark impl (mostly) loadable by @rickeylev in #1422
- feat: generate py_library per file by @raylu in #1398
- chore: bump default python versions by @aignas in #1425
- feat: Support netrc-based authentication for python_repository rule by @LINKIWI in #1417
- refactor(pystar): load (but don't use) Starlark implementation. by @rickeylev in #1428
- fix(gazelle): runfiles discovery by @aignas in #1429
- feat, refactor(pystar): bzl_library for packaging.bzl; fix pystar doc building and py_wheel by @rickeylev in #1432
- refactor(toolchain): use a helper method to convert an X.Y version to X.Y.Z by @aignas in #1423
- pycross: Rename
pycross_wheel_library
and make it work by @philsc in #1413 - fix: Skip printing unneccesary warning. by @matts1 in #1407
- refactor(bzlmod)!: simplify pip.parse repository layout by @aignas in #1395
- feat(bzlmod): mark pip extension as os/arch dependent by @aignas in #1433
- chore: bump internal_deps by @aignas in #1322
- tests(pystar): CI configs that uses Starlark implementation of rules by @rickeylev in #1435
- internal(pystar): Copy @bazel_tools//tools/python files to rules_python by @rickeylev in #1437
- internal(pystar): Make py_runtime_pair and autodetecting toolchain mostly loadable. by @rickeylev in #1439
- tests: Move base rule tests under tests instead of //tools/build_defs/python by @rickeylev in #1440
- tests(pystar): py_runtime_pair and py_runtime analysis tests by @rickeylev in #1441
- fix(pystar): Use py_internal for runfiles_enabled, declare_shareable_artifact, share_native_deps by @rickeylev in #1443
- build(deps): bump urllib3 from 1.26.13 to 1.26.17 in /examples/pip_repository_annotations by @dependabot in #1447
- build(deps): bump urllib3 from 1.25.11 to 1.26.17 in /examples/pip_install by @dependabot in #1444
- fix: add missing
@bazel_tools
files to bzl_library dependencies. by @rickeylev in #1457 - tests(pystar): add analysis tests to cover basic windows building by @rickeylev in #1452
- docs: move dependency management into respective bzl packages by @rickeylev in #1459
- feat(py_wheel): Normalize name and version by @vonschultz in #1331
- chore: add new Python toolchains from indygreg by @aignas in #1461
New Contributors
- @cflewis made their first contribution in https://github.com/bazelbuild/rules_python/p...
0.25.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.25.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
name = "pip",
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 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
strip_prefix = "rules_python-0.25.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.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 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
strip_prefix = "rules_python-0.25.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.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: Use correct pip extension path in generated release notes by @rickeylev in #1310
- doc: correct name of rules_python in bzlmod support doc by @aignas in #1317
- test: Remove testonly=True from test toolchain implementations by @rickeylev in #1327
- cleanup: Add placeholder comment to defs.bzl to make patching loads easier by @rickeylev in #1319
- fix(multi-versions): correctly default 'main' arg for transition rules by @aignas in #1316
- refactor: have a single function for normalized PyPI package names by @aignas in #1329
- refactor: add a version label function for consistent labels by @aignas in #1328
- docs: Updating README by @chrislovecnm in #1282
- revert(bzlmod)!: allow bzlmod pip.parse to implicitly use default python version by @chrislovecnm in #1341
- feat: stop generating imports when not necessary by @linzhp in #1335
- fix: Don't require default Python version for pip hubs by @rickeylev in #1344
- docs: Better explain when and how to use toolchains for bzlmod by @rickeylev in #1349
- refactor(whl_library): move bazel file generation to Starlark by @aignas in #1336
- feat: add a tool to update internal dependencies by @aignas in #1321
- refactor: support rendering pkg aliases without whl_library_alias by @aignas in #1346
- Feat: Using repo-relative labels by @chrislovecnm in #1367
- feat: Add s390x release by @namrata-ibm in #1352
- feat: Improve exec error handling by @chrislovecnm in #1368
- feat: Update MINOR_MAPPING to latest version by @namrata-ibm in #1370
- feat: add CHANGELOG to make summarizing releases easier. by @rickeylev in #1382
- docs: add update changelog as part of pull request instructions by @rickeylev in #1384
- tests: Expose test's fake_header.h so py_cc_toolchain tests can use it. by @rickeylev in #1388
- Update changelog for 0.25.0 by @rickeylev in #1389
New Contributors
- @namrata-ibm made their first contribution in #1352
Full Changelog: 0.24.0...0.25.0
0.24.0
BREAKING CHANGES
Users of this Gazelle extension must upgrade to Gazelle v0.30.0 or above.
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still beta; APIs are settling down but some are still subject to change
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.24.0")
pip = use_extension("@rules_python//python:extensions.bzl", "pip")
pip.parse(
name = "pip",
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 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578",
strip_prefix = "rules_python-0.24.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.24.0/rules_python-0.24.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 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578",
strip_prefix = "rules_python-0.24.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.24.0/rules_python-0.24.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: Ignore tempoary pyc.NNN files in wheels by @rickeylev in #1266
- fix(bzlmod): Fixing Windows Python Interpreter symlink issues by @chrislovecnm in #1265
- feat(bzlmod)!: Calling pip multiple times allowing for multiple Python versions by @chrislovecnm in #1254
- fix(py_wheel.publish): allow twine tags and args by @alexeagle in #1271
- feat(py_wheel): Add support for specifying Description-Content-Type and Summary in METADATA by @sfc-gh-zpeng in #1274
- feat(py_wheel): Add support for specifying Project-URL in METADATA by @sfc-gh-wzhao in #1276
- test: basic analysis tests for py_wheel by @rickeylev in #1279
- fix: plugin_output in py_proto_library rule by @comius in #1280
- cleanup: Typos, doc, and formatting cleanup in pip extension et al by @rickeylev in #1275
- feat: Upgrading gazelle and rules_go by @chrislovecnm in #1283
- tests: make analysis tests support --incompatible_enable_cc_toolchain_resolution by @comius in #1281
- feat!: using Gazelle's lifecycle manager to manage external processes by @linzhp in #1284
- fix(toolchain): restrict coverage tool visibility under bzlmod by @aignas in #1252
- fix: add
format()
calls toglob_exclude
templates by @lpulley in #1285 - feat: Expose Python C headers through the toolchain. by @rickeylev in #1287
- feat(bzlmod): Implementing wheel annotations via whl_mods by @chrislovecnm in #1278
- feat(gazelle): support multiple requirements files in manifest generation by @aignas in #1301
- feat: Add setting generate_hashes for requirements by @vonschultz in #1290
- feat(bzlmod): Use a common constant for detecting bzlmod being enabled by @chrislovecnm in #1302
- fix(bzlmod)!: Changing repository name "python_aliases" to "python_versions" by @chrislovecnm in #1304
- feat(bzlmod): Allow bzlmod pip.parse to reference the default python toolchain and interpreter by @chrislovecnm in #1303
- feat: Create
all_data_requirements
alias by @kevinpark1217 in #1292 - chore: Bump rules_testing to 0.4.0 from 0.0.5 by @rickeylev in #1306
- cleanup(tests): Use new APIs in rules_testing 0.4.0 by @rickeylev in #1307
New Contributors
- @sfc-gh-zpeng made their first contribution in #1274
- @sfc-gh-wzhao made their first contribution in #1276
- @vonschultz made their first contribution in #1290
- @kevinpark1217 made their first contribution in #1292
Full Changelog: 0.23.1...0.24.0
0.23.1
Using Bzlmod with Bazel 6
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.23.1")
pip = use_extension("@rules_python//python:extensions.bzl", "pip")
pip.parse(
name = "pip",
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 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841",
strip_prefix = "rules_python-0.23.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.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 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841",
strip_prefix = "rules_python-0.23.1/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.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
- fix(bzlmod+gazelle): update BCR release presubmit to use correct example by @rickeylev in #1264
Full Changelog: 0.23.0...0.23.1
0.23.0
Using Bzlmod with Bazel 6
NOTE: bzlmod support is still experimental; apis are still subject to change
This release introduces two notable changes to bzlmod support:
- A default toolchain is automatically registered for you. You no longer need to call
register_toolchains()
yourself. Depending
on rules_python through bazel_dep is sufficient. Note, however, the Python version used for this default toolchain will change
frequently/unexpectedly to track the a recent Python version. - The
name
arg ofpython.toolchain
has been removed. The toolchain repo name format ispython_X_Y
e.g.python_3_11
.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.23.0")
pip = use_extension("@rules_python//python:extensions.bzl", "pip")
pip.parse(
name = "pip",
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 = "8272287b125a23bfc79650ecbbc045ebcaee4d632338b1a50aad34357bcbadce",
strip_prefix = "rules_python-0.23.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.0/rules_python-0.23.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 = "8272287b125a23bfc79650ecbbc045ebcaee4d632338b1a50aad34357bcbadce",
strip_prefix = "rules_python-0.23.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.0/rules_python-0.23.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
- feat(bzlmod): Allowing multiple python.toolchain extension calls by @chrislovecnm in #1230
- build: Upgrade Gazelle to v0.31.0 by @linzhp in #1240
- fix: make
import python.runfiles
work with--experimental_python_import_all_repositories=false
by @rickeylev in #1243 - feat(bzlmod): Moving register.toolchains internal by @chrislovecnm in #1238
- docs(compile_pip_requirements): Add note on requirements.txt VC by @boomanaiden154 in #1245
- cleanup: Set toolchain target_setting directly instead of via inline ternary by @rickeylev in #1246
- fix(bzlmod): give precedence to the first seen versioned toolchain by @rickeylev in #1244
- chore: add a pre-commit hook to maintain deleted packages by @aignas in #1208
- chore: auto-publish gazelle module to BCR by @kormide in #1247
- fix(coverage): bump to latest coverage.py and fix import shadowing by @aignas in #1249
- feat: add ppc64le releases and update to 3.10.11, 3.11.3 for python-build-standalone by @clnperez in #1234
- fix(bzlmod)!: Remove ability to specify toolchain repo name. by @rickeylev in #1258
- fix: update correct requirements lock file when using os specific lock files by @Rasrack in #1123
- fix: use
only-binary
fordownload_only
pip download
by @lpulley in #1219 - feat: Adding variable support for distribution in py_wheel by @ns-tkonduri in #1251
- feat(bzlmod): Register a default toolchain by @rickeylev in #1259
New Contributors
- @boomanaiden154 made their first contribution in #1245
- @clnperez made their first contribution in #1234
- @lpulley made their first contribution in #1219
- @ns-tkonduri made their first contribution in #1251
Full Changelog: 0.22.0...0.23.0
0.22.0
Notable and Breaking Changes
Bzlmod extension paths have changed
As part of fixing some fundamental issues with the bzlmod support, we had to change the path to our extensions. Instead of all extensions being in a single extensions.bzl
file, each extension is in its own file. Users must update the file path in their use_repo()
statements as follows:
use_extension("@rules_python//python:extensions.bzl", "python")
->use_extension("@rules_python//python/extensions:python.bzl", "python")
use_extension("@rules_python//python:extensions.bzl", "pip")
->use_extension("@rules_python//python/extensions:pip.bzl", "pip")
The following sed
commands should approximate the necessary changes:
sed 'sXuse_extension("@rules_python//python:extensions.bzl", "python")Xuse_extension("@rules_python//python/extensions:python.bzl", "python")X'`
sed 'sXuse_extension("@rules_python//python:extensions.bzl", "pip")Xuse_extension("@rules_python//python/extensions:pip.bzl", "pip")X'`
See examples/bzlmod_build_file_generation/MODULE.bazel
for an example of the new paths.
Lockfile output churn
The output of lockfiles has slightly changed. Though functionally the same, their integrity hashes will change.
Using Bzlmod with Bazel 6
NOTE: Bzlmod support is still in beta.
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.22.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
name = "pip",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")
# (Optional) Register a specific python toolchain instead of using the host version
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
name = "python3_9",
python_version = "3.9",
)
use_repo(python, "python3_9_toolchains")
register_toolchains(
"@python3_9_toolchains//:all",
)
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 = "863ba0fa944319f7e3d695711427d9ad80ba92c6edd0b7c7443b84e904689539",
strip_prefix = "rules_python-0.22.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.22.0/rules_python-0.22.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 = "863ba0fa944319f7e3d695711427d9ad80ba92c6edd0b7c7443b84e904689539",
strip_prefix = "rules_python-0.22.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.22.0/rules_python-0.22.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 reference to @bazel_tools//tools/python/private:defs.bzl by @comius in #1173
- docs: Tell how to use GitHub to find commits in an upcoming release. by @rickeylev in #1092
- fix: compile_pip_requirements test from external repositories by @Rasrack in #1124
- feat: add Python 3.8.16 by @jml-derek in #1168
- test: Set mac platform for test_mac_requires_darwin_for_execution by @rickeylev in #1179
- fix: Don't reference deleted private bazel_tools bzl file by @rickeylev in #1180
- docs: Add starlark directive to code snippet by @blorente in #1170
- tests: Upgrade rules_testing to 0.0.5 by @rickeylev in #1184
- tests: Set linux platform for test_non_mac_doesnt_require_darwin_for_execution by @rickeylev in #1183
- fix(bzlmod): correctly template repository macros for requirements, etc by @aignas in #1190
- type:docs Update README.md by @yuanweixin in #1186
- fix: Allow passing a tuple to the
tags
attribute. by @rickeylev in #1191 - tests: Add skylib to various test dependencies to fix CI by @chrislovecnm in #1199
- feat: removing bzlmod from example by @chrislovecnm in #1200
- feat: propagate visibility attribute for py_wheel publishing by @chrislovecnm in #1203
- docs: fix typos in pip_repository docs by @martis42 in #1202
- tests: Force analysis test labels to resolve within @rules_python context by @rickeylev in #1187
- fix(update_deleted_packages.sh): allow to run from anywhere in the repo by @aignas in #1206
- feat(bzlmod): expose platform-agnostic repo target for toolchain interpreter by @chrislovecnm in #1155
- fix(update_deleted_packages.sh): wheels example should not be included in .bazelrc by @aignas in #1207
- fix: Strip trailing newline from python output by @illicitonion in #1212
- fix: manually ignore bazel-* directories to make using custom Bazel builds easier by @rickeylev in #1181
- test(bzlmod): explicitly enable bzlmod in the test harness by @aignas in #1204
- feat(bzlmod): Cleaning up interpreter resolution by @chrislovecnm in #1218
- feat(bzlmod)!: Move each bzlmod extension into its own file by @chrislovecnm in #1226
- Adding bzlmod support document by @chrislovecnm in #1214
- test(coverage): add a test to check the sys.path under bzlmod by @aignas in #1223
- fix(toolchain): set correct return attrs to remove non-hermeticity warning by @aignas in #1231
- fix: allow url fragments in requirements file by @mattoberle in #1195
- fix:
example/build_file_generation/README.md
by @ofey404 in #1164 - fix: Using canonical name in requirements.bzl by @linzhp in #1176
- feat(bzlmod): support entry_point macro by @aignas in #1220
New Contributors
- @Rasrack made their first contribution in #1124
- @jml-derek made their first contribution in #1168
- @blorente made their first contribution in #1170
- @yuanweixin made their first contribution in #1186
- @ofey404 made their first contribution in #1164
Full Changelog: 0.21.0...0.22.0
0.21.0
Using Bzlmod with Bazel 6
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.21.0")
pip = use_extension("@rules_python//python:extensions.bzl", "pip")
pip.parse(
name = "pip",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")
# (Optional) Register a specific python toolchain instead of using the host version
python = use_extension("@rules_python//python:extensions.bzl", "python")
python.toolchain(
name = "python3_9",
python_version = "3.9",
)
use_repo(python, "python3_9_toolchains")
register_toolchains(
"@python3_9_toolchains//:all",
)
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 = "94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f",
strip_prefix = "rules_python-0.21.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.21.0/rules_python-0.21.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 = "94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f",
strip_prefix = "rules_python-0.21.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.21.0/rules_python-0.21.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
- cleanup: factor reexports.bzl into the respective implementation files by @rickeylev in #1137
- fix: bump installer to handle windows better by @f0rmiga in #1138
- build: Fixing buildifier by @chrislovecnm in #1148
- docs: Updating documentation for bzlmod by @chrislovecnm in #1149
- fix: use a consistent buildifier version for CI and pre-commit by @aignas in #1151
- chore: bump buildifier to 6.1.0 by @aignas in #1152
- fix: correct the labels returned by all_requirements lists by @aignas in #1146
- fix: gazelle correctly adds new py_test rules by @amartani in #1143
- fix: respect kind mapping by @OniOni in #1158
- test: cleanup gazelle tests and run them in parallel by @aignas in #1159
- [docs] Fixing rule name in coverage.md docs by @anfelbar in #1162
- feat: Support specifying multiple download URLs in tool_versions. by @quval in #1145
New Contributors
- @amartani made their first contribution in #1143
- @anfelbar made their first contribution in #1162
- @quval made their first contribution in #1145
Full Changelog: 0.20.0...0.21.0