Skip to content

0.26.0

Compare
Choose a tag to compare
@github-actions github-actions released this 06 Oct 06:40
· 243 commits to main since this release
fe33a45

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 the py_repositories() call is missing in WORKSPACE.

  • (bzlmod) The pip.parse extension will generate os/arch specific lock file entries on bazel>=6.4.

Removed in this release

  • (bzlmod) The entry_point macro is no longer supported and has been removed in favor of the py_console_script_binary macro for bzlmod users.
  • (bzlmod) The pip.parse no longer generates {hub_name}_{py_version} hub repos as the entry_point macro has been superseded by py_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 the py_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 one py_library per file.
  • (python_repository) Support netrc and auth_patterns attributes to enable authentication against private HTTP hosts serving Python toolchain binaries.
  • //python:packaging_bzl added, a bzl_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 to False 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 to False 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

Full Changelog: 0.25.0...0.26.0