Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update correct requirements lock file when using os specific lock files #1123

Merged

Conversation

Rasrack
Copy link
Contributor

@Rasrack Rasrack commented Mar 10, 2023

Currently the dependency_resolver.py ignores that you give requirement lock files for different os's, except when checking if the golden file needs updating. This causes dependecy_resolver.py to update the wrong lock i.e the non platform specific one if ran in "update mode".

@Rasrack Rasrack force-pushed the fix-os-specific-requirements-lock branch from 10b8f28 to c7e5852 Compare March 10, 2023 10:49
@@ -88,6 +88,10 @@ def _select_golden_requirements_file(
requirements_in_path = Path(requirements_in)
resolved_requirements_in = str(requirements_in_path.resolve())

requirements_file = _select_golden_requirements_file(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this functionality. This allows users to not need to run the [[uname -r == foo ]] && cp requirements.txt requirements_foo.txt themselves.

@chrislovecnm
Copy link
Collaborator

Should we add this functionality inside one of our examples?

@chrislovecnm
Copy link
Collaborator

@aignas can you review? You are more familiar with this part of the code base

@chrislovecnm
Copy link
Collaborator

chrislovecnm commented May 17, 2023

@Rasrack can you rebase? Please also include a description in the PR.

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general.

@@ -88,6 +88,10 @@ def _select_golden_requirements_file(
requirements_in_path = Path(requirements_in)
resolved_requirements_in = str(requirements_in_path.resolve())

requirements_file = _select_golden_requirements_file(
requirements_txt, requirements_linux, requirements_darwin, requirements_windows
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I know that this function was created before this PR, but it would be great if we used keyword arguments here for readability and correctness.

It would also help if we return pathlib.Path type instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I at least added the keyword arguments but will skip returning pathlib.Path for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -123,28 +127,28 @@ def _select_golden_requirements_file(

sys.argv.append("--generate-hashes")
sys.argv.append("--output-file")
sys.argv.append(requirements_txt if UPDATE else requirements_out)
sys.argv.append(requirements_file if UPDATE else requirements_out)
sys.argv.append(
requirements_in if requirements_in_path.exists() else resolved_requirements_in
)

if UPDATE:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about the broader picture, we could have the UPDATE being handled by a separate script and use the approach elsewhere where:

  1. There is a rule that generates the pinned requirements_file.
  2. There is a diff_test rule, which checks the source version with the output of 1.
  3. There is a rule that updates the source version.

Right now we use the same script for everything, which allows us to not use bazel-skylib for this functionality, but now we depend on it more heavily and thus we could refactor this code as well.

Whilst this suggestion is likely to be outside the scope of the PR, I would love to understand if the platform resolution complexity could be pushed to starlark and a bunch of select statements in the right places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It almost sound like you are aiming for how it is done in the pip_parse vendored example. To me it sounds like a sensible change.

@Rasrack Rasrack force-pushed the fix-os-specific-requirements-lock branch from c7e5852 to 17c1085 Compare May 19, 2023 13:44
@Rasrack Rasrack force-pushed the fix-os-specific-requirements-lock branch from 17c1085 to 1a5e0c7 Compare May 19, 2023 13:52
Oterwise, CI fails with
"The number of tasks in one config file is limited to 80!"
@Rasrack Rasrack force-pushed the fix-os-specific-requirements-lock branch from ad2f8e8 to d1d52cd Compare May 20, 2023 12:59
@Rasrack Rasrack force-pushed the fix-os-specific-requirements-lock branch from d1d52cd to 90fbf50 Compare May 20, 2023 13:06
@rickeylev rickeylev changed the title fix: update correct requirements lock file when using os specific loc… fix: update correct requirements lock file when using os specific lock files Jun 9, 2023
@rickeylev rickeylev added this pull request to the merge queue Jun 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 9, 2023
@rickeylev rickeylev added this pull request to the merge queue Jun 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 9, 2023
@rickeylev rickeylev added this pull request to the merge queue Jun 9, 2023
Merged via the queue into bazelbuild:main with commit 32b0053 Jun 9, 2023
renovate bot referenced this pull request in bazel-contrib/rules_bazel_integration_test Sep 4, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [rules_python](https://github.com/bazelbuild/rules_python) |
http_archive | minor | `0.20.0` -> `0.25.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_python (rules_python)</summary>

###
[`v0.25.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0250---2023-08-22)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.24.0...0.25.0)

##### Changed

-   Python version patch level bumps:
    -   3.9.16 -> 3.9.17
    -   3.10.9 -> 3.10.12
    -   3.11.1 -> 3.11.4
-   (bzlmod) `pip.parse` can no longer automatically use the default
    Python version; this was an unreliable and unsafe behavior. The
    `python_version` arg must always be explicitly specified.

##### Fixed

- (docs) Update docs to use correct bzlmod APIs and clarify how and when
to use
    various APIs.
- (multi-version) The `main` arg is now correctly computed and usually
optional.
- (bzlmod) `pip.parse` no longer requires a call for whatever the
configured
    default Python version is.

##### Added

-   Created a changelog.
-   (gazelle) Stop generating unnecessary imports.
-   (toolchains) s390x supported for Python 3.9.17, 3.10.12, and 3.11.4.

[0.25.0]:
https://github.com/bazelbuild/rules_python/releases/tag/0.25.0

###
[`v0.24.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0240---2023-07-11)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.23.1...0.24.0)

##### Changed

-   **BREAKING** (gazelle) Gazelle 0.30.0 or higher is required
-   (bzlmod) `@python_aliases` renamed to \`@python_versions
-   (bzlmod) `pip.parse` arg `name` renamed to `hub_name`
- (bzlmod) `pip.parse` arg `incompatible_generate_aliases` removed and
always
    true.

##### Fixed

-   (bzlmod) Fixing Windows Python Interpreter symlink issues
-   (py_wheel) Allow twine tags and args
-   (toolchain, bzlmod) Restrict coverage tool visibility under bzlmod
-   (pip) Ignore temporary pyc.NNN files in wheels
-   (pip) Add format() calls to glob_exclude templates
-   plugin_output in py_proto_library rule

##### Added

-   Using Gazelle's lifecycle manager to manage external processes
- (bzlmod) `pip.parse` can be called multiple times with different
Python
    versions
- (bzlmod) Allow bzlmod `pip.parse` to reference the default python
toolchain and interpreter
-   (bzlmod) Implementing wheel annotations via `whl_mods`
-   (gazelle) support multiple requirements files in manifest generation
- (py_wheel) Support for specifying `Description-Content-Type` and
`Summary` in METADATA
-   (py_wheel) Support for specifying `Project-URL`
- (compile_pip_requirements) Added `generate_hashes` arg (default True)
to
    control generating hashes
-   (pip) Create all_data_requirements alias
-   Expose Python C headers through the toolchain.

[0.24.0]:
https://github.com/bazelbuild/rules_python/releases/tag/0.24.0

###
[`v0.23.1`](https://github.com/bazelbuild/rules_python/releases/tag/0.23.1)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.23.0...0.23.1)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.23.1")

pip = use_extension("@&#8203;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:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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 [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1264](https://github.com/bazelbuild/rules_python/pull/1264)

**Full Changelog**:
bazelbuild/rules_python@0.23.0...0.23.1

###
[`v0.23.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.23.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.22.0...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 of `python.toolchain` has been removed. The toolchain
repo name format is `python_X_Y` e.g. `python_3_11`.

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.23.0")

pip = use_extension("@&#8203;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:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1230](https://github.com/bazelbuild/rules_python/pull/1230)
- build: Upgrade Gazelle to v0.31.0 by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1240](https://github.com/bazelbuild/rules_python/pull/1240)
- fix: make `import python.runfiles` work with
`--experimental_python_import_all_repositories=false` by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1243](https://github.com/bazelbuild/rules_python/pull/1243)
- feat(bzlmod): Moving register.toolchains internal by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1238](https://github.com/bazelbuild/rules_python/pull/1238)
- docs(compile_pip_requirements): Add note on requirements.txt VC by
[@&#8203;boomanaiden154](https://github.com/boomanaiden154) in
[https://github.com/bazelbuild/rules_python/pull/1245](https://github.com/bazelbuild/rules_python/pull/1245)
- cleanup: Set toolchain target_setting directly instead of via inline
ternary by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1246](https://github.com/bazelbuild/rules_python/pull/1246)
- fix(bzlmod): give precedence to the first seen versioned toolchain by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1244](https://github.com/bazelbuild/rules_python/pull/1244)
- chore: add a pre-commit hook to maintain deleted packages by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1208](https://github.com/bazelbuild/rules_python/pull/1208)
- chore: auto-publish gazelle module to BCR by
[@&#8203;kormide](https://github.com/kormide) in
[https://github.com/bazelbuild/rules_python/pull/1247](https://github.com/bazelbuild/rules_python/pull/1247)
- fix(coverage): bump to latest coverage.py and fix import shadowing by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1249](https://github.com/bazelbuild/rules_python/pull/1249)
- feat: add ppc64le releases and update to 3.10.11, 3.11.3 for
python-build-standalone by
[@&#8203;clnperez](https://github.com/clnperez) in
[https://github.com/bazelbuild/rules_python/pull/1234](https://github.com/bazelbuild/rules_python/pull/1234)
- fix(bzlmod)!: Remove ability to specify toolchain repo name. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1258](https://github.com/bazelbuild/rules_python/pull/1258)
- fix: update correct requirements lock file when using os specific lock
files by [@&#8203;Rasrack](https://github.com/Rasrack) in
[https://github.com/bazelbuild/rules_python/pull/1123](https://github.com/bazelbuild/rules_python/pull/1123)
- fix: use `only-binary` for `download_only` `pip download` by
[@&#8203;lpulley](https://github.com/lpulley) in
[https://github.com/bazelbuild/rules_python/pull/1219](https://github.com/bazelbuild/rules_python/pull/1219)
- feat: Adding variable support for distribution in py_wheel by
[@&#8203;ns-tkonduri](https://github.com/ns-tkonduri) in
[https://github.com/bazelbuild/rules_python/pull/1251](https://github.com/bazelbuild/rules_python/pull/1251)
- feat(bzlmod): Register a default toolchain by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1259](https://github.com/bazelbuild/rules_python/pull/1259)

#### New Contributors

- [@&#8203;boomanaiden154](https://github.com/boomanaiden154) made
their first contribution in
[https://github.com/bazelbuild/rules_python/pull/1245](https://github.com/bazelbuild/rules_python/pull/1245)
- [@&#8203;clnperez](https://github.com/clnperez) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1234](https://github.com/bazelbuild/rules_python/pull/1234)
- [@&#8203;lpulley](https://github.com/lpulley) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1219](https://github.com/bazelbuild/rules_python/pull/1219)
- [@&#8203;ns-tkonduri](https://github.com/ns-tkonduri) made their
first contribution in
[https://github.com/bazelbuild/rules_python/pull/1251](https://github.com/bazelbuild/rules_python/pull/1251)

**Full Changelog**:
bazelbuild/rules_python@0.22.0...0.23.0

###
[`v0.22.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.22.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.21.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("@&#8203;rules_python//python:extensions.bzl",
"python")` ->
`use_extension("@&#8203;rules_python//python/extensions:python.bzl",
"python")`
- `use_extension("@&#8203;rules_python//python:extensions.bzl", "pip")`
-> `use_extension("@&#8203;rules_python//python/extensions:pip.bzl",
"pip")`

The following `sed` commands should approximate the necessary changes:

```
sed 'sXuse_extension("@&#8203;rules_python//python:extensions.bzl", "python")Xuse_extension("@&#8203;rules_python//python/extensions:python.bzl", "python")X'`
sed 'sXuse_extension("@&#8203;rules_python//python:extensions.bzl", "pip")Xuse_extension("@&#8203;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:

```starlark
bazel_dep(name = "rules_python", version = "0.22.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python/extensions:python.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()
```

#### What's Changed

- fix: remove reference to
@&#8203;bazel_tools//tools/python/private:defs.bzl by
[@&#8203;comius](https://github.com/comius) in
[https://github.com/bazelbuild/rules_python/pull/1173](https://github.com/bazelbuild/rules_python/pull/1173)
- docs: Tell how to use GitHub to find commits in an upcoming release.
by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1092](https://github.com/bazelbuild/rules_python/pull/1092)
- fix: compile_pip_requirements test from external repositories by
[@&#8203;Rasrack](https://github.com/Rasrack) in
[https://github.com/bazelbuild/rules_python/pull/1124](https://github.com/bazelbuild/rules_python/pull/1124)
- feat: add Python 3.8.16 by
[@&#8203;jml-derek](https://github.com/jml-derek) in
[https://github.com/bazelbuild/rules_python/pull/1168](https://github.com/bazelbuild/rules_python/pull/1168)
- test: Set mac platform for test_mac_requires_darwin_for_execution by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1179](https://github.com/bazelbuild/rules_python/pull/1179)
- fix: Don't reference deleted private bazel_tools bzl file by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1180](https://github.com/bazelbuild/rules_python/pull/1180)
- docs: Add starlark directive to code snippet by
[@&#8203;blorente](https://github.com/blorente) in
[https://github.com/bazelbuild/rules_python/pull/1170](https://github.com/bazelbuild/rules_python/pull/1170)
- tests: Upgrade rules_testing to 0.0.5 by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1184](https://github.com/bazelbuild/rules_python/pull/1184)
- tests: Set linux platform for
test_non_mac_doesnt_require_darwin_for_execution by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1183](https://github.com/bazelbuild/rules_python/pull/1183)
- fix(bzlmod): correctly template repository macros for requirements,
etc by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1190](https://github.com/bazelbuild/rules_python/pull/1190)
- type:docs Update README.md by
[@&#8203;yuanweixin](https://github.com/yuanweixin) in
[https://github.com/bazelbuild/rules_python/pull/1186](https://github.com/bazelbuild/rules_python/pull/1186)
- fix: Allow passing a tuple to the `tags` attribute. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1191](https://github.com/bazelbuild/rules_python/pull/1191)
- tests: Add skylib to various test dependencies to fix CI by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1199](https://github.com/bazelbuild/rules_python/pull/1199)
- feat: removing bzlmod from example by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1200](https://github.com/bazelbuild/rules_python/pull/1200)
- feat: propagate visibility attribute for py_wheel publishing by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1203](https://github.com/bazelbuild/rules_python/pull/1203)
- docs: fix typos in pip_repository docs by
[@&#8203;martis42](https://github.com/martis42) in
[https://github.com/bazelbuild/rules_python/pull/1202](https://github.com/bazelbuild/rules_python/pull/1202)
- tests: Force analysis test labels to resolve within
@&#8203;rules_python context by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1187](https://github.com/bazelbuild/rules_python/pull/1187)
- fix(update_deleted_packages.sh): allow to run from anywhere in the
repo by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1206](https://github.com/bazelbuild/rules_python/pull/1206)
- feat(bzlmod): expose platform-agnostic repo target for toolchain
interpreter by [@&#8203;chrislovecnm](https://github.com/chrislovecnm)
in
[https://github.com/bazelbuild/rules_python/pull/1155](https://github.com/bazelbuild/rules_python/pull/1155)
- fix(update_deleted_packages.sh): wheels example should not be included
in .bazelrc by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1207](https://github.com/bazelbuild/rules_python/pull/1207)
- fix: Strip trailing newline from python output by
[@&#8203;illicitonion](https://github.com/illicitonion) in
[https://github.com/bazelbuild/rules_python/pull/1212](https://github.com/bazelbuild/rules_python/pull/1212)
- fix: manually ignore bazel-\* directories to make using custom Bazel
builds easier by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1181](https://github.com/bazelbuild/rules_python/pull/1181)
- test(bzlmod): explicitly enable bzlmod in the test harness by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1204](https://github.com/bazelbuild/rules_python/pull/1204)
- feat(bzlmod): Cleaning up interpreter resolution by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1218](https://github.com/bazelbuild/rules_python/pull/1218)
- feat(bzlmod)!: Move each bzlmod extension into its own file by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1226](https://github.com/bazelbuild/rules_python/pull/1226)
- Adding bzlmod support document by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1214](https://github.com/bazelbuild/rules_python/pull/1214)
- test(coverage): add a test to check the sys.path under bzlmod by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1223](https://github.com/bazelbuild/rules_python/pull/1223)
- fix(toolchain): set correct return attrs to remove non-hermeticity
warning by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1231](https://github.com/bazelbuild/rules_python/pull/1231)
- fix: allow url fragments in requirements file by
[@&#8203;mattoberle](https://github.com/mattoberle) in
[https://github.com/bazelbuild/rules_python/pull/1195](https://github.com/bazelbuild/rules_python/pull/1195)
- fix: `example/build_file_generation/README.md` by
[@&#8203;ofey404](https://github.com/ofey404) in
[https://github.com/bazelbuild/rules_python/pull/1164](https://github.com/bazelbuild/rules_python/pull/1164)
- fix: Using canonical name in requirements.bzl by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1176](https://github.com/bazelbuild/rules_python/pull/1176)
- feat(bzlmod): support entry_point macro by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1220](https://github.com/bazelbuild/rules_python/pull/1220)

#### New Contributors

- [@&#8203;Rasrack](https://github.com/Rasrack) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1124](https://github.com/bazelbuild/rules_python/pull/1124)
- [@&#8203;jml-derek](https://github.com/jml-derek) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1168](https://github.com/bazelbuild/rules_python/pull/1168)
- [@&#8203;blorente](https://github.com/blorente) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1170](https://github.com/bazelbuild/rules_python/pull/1170)
- [@&#8203;yuanweixin](https://github.com/yuanweixin) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1186](https://github.com/bazelbuild/rules_python/pull/1186)
- [@&#8203;ofey404](https://github.com/ofey404) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1164](https://github.com/bazelbuild/rules_python/pull/1164)

**Full Changelog**:
bazelbuild/rules_python@0.21.0...0.22.0

###
[`v0.21.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.21.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.20.0...0.21.0)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.21.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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 [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1137](https://github.com/bazelbuild/rules_python/pull/1137)
- fix: bump installer to handle windows better by
[@&#8203;f0rmiga](https://github.com/f0rmiga) in
[https://github.com/bazelbuild/rules_python/pull/1138](https://github.com/bazelbuild/rules_python/pull/1138)
- build: Fixing buildifier by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1148](https://github.com/bazelbuild/rules_python/pull/1148)
- docs: Updating documentation for bzlmod by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1149](https://github.com/bazelbuild/rules_python/pull/1149)
- fix: use a consistent buildifier version for CI and pre-commit by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1151](https://github.com/bazelbuild/rules_python/pull/1151)
- chore: bump buildifier to 6.1.0 by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1152](https://github.com/bazelbuild/rules_python/pull/1152)
- fix: correct the labels returned by all_requirements lists by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1146](https://github.com/bazelbuild/rules_python/pull/1146)
- fix: gazelle correctly adds new py_test rules by
[@&#8203;amartani](https://github.com/amartani) in
[https://github.com/bazelbuild/rules_python/pull/1143](https://github.com/bazelbuild/rules_python/pull/1143)
- fix: respect kind mapping by
[@&#8203;OniOni](https://github.com/OniOni) in
[https://github.com/bazelbuild/rules_python/pull/1158](https://github.com/bazelbuild/rules_python/pull/1158)
- test: cleanup gazelle tests and run them in parallel by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1159](https://github.com/bazelbuild/rules_python/pull/1159)
- \[docs] Fixing rule name in coverage.md docs by
[@&#8203;anfelbar](https://github.com/anfelbar) in
[https://github.com/bazelbuild/rules_python/pull/1162](https://github.com/bazelbuild/rules_python/pull/1162)
- feat: Support specifying multiple download URLs in tool_versions. by
[@&#8203;quval](https://github.com/quval) in
[https://github.com/bazelbuild/rules_python/pull/1145](https://github.com/bazelbuild/rules_python/pull/1145)

#### New Contributors

- [@&#8203;amartani](https://github.com/amartani) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1143](https://github.com/bazelbuild/rules_python/pull/1143)
- [@&#8203;anfelbar](https://github.com/anfelbar) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1162](https://github.com/bazelbuild/rules_python/pull/1162)
- [@&#8203;quval](https://github.com/quval) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1145](https://github.com/bazelbuild/rules_python/pull/1145)

**Full Changelog**:
bazelbuild/rules_python@0.20.0...0.21.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/bazel-contrib/rules_bazel_integration_test).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41NC4wIiwidXBkYXRlZEluVmVyIjoiMzYuNzguOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
cgrindel referenced this pull request in k1nkreet/rules_bazel_integration_test Sep 27, 2023
…#153)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [rules_python](https://github.com/bazelbuild/rules_python) |
http_archive | minor | `0.20.0` -> `0.25.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_python (rules_python)</summary>

###
[`v0.25.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0250---2023-08-22)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.24.0...0.25.0)

##### Changed

-   Python version patch level bumps:
    -   3.9.16 -> 3.9.17
    -   3.10.9 -> 3.10.12
    -   3.11.1 -> 3.11.4
-   (bzlmod) `pip.parse` can no longer automatically use the default
    Python version; this was an unreliable and unsafe behavior. The
    `python_version` arg must always be explicitly specified.

##### Fixed

- (docs) Update docs to use correct bzlmod APIs and clarify how and when
to use
    various APIs.
- (multi-version) The `main` arg is now correctly computed and usually
optional.
- (bzlmod) `pip.parse` no longer requires a call for whatever the
configured
    default Python version is.

##### Added

-   Created a changelog.
-   (gazelle) Stop generating unnecessary imports.
-   (toolchains) s390x supported for Python 3.9.17, 3.10.12, and 3.11.4.

[0.25.0]:
https://github.com/bazelbuild/rules_python/releases/tag/0.25.0

###
[`v0.24.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0240---2023-07-11)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.23.1...0.24.0)

##### Changed

-   **BREAKING** (gazelle) Gazelle 0.30.0 or higher is required
-   (bzlmod) `@python_aliases` renamed to \`@python_versions
-   (bzlmod) `pip.parse` arg `name` renamed to `hub_name`
- (bzlmod) `pip.parse` arg `incompatible_generate_aliases` removed and
always
    true.

##### Fixed

-   (bzlmod) Fixing Windows Python Interpreter symlink issues
-   (py_wheel) Allow twine tags and args
-   (toolchain, bzlmod) Restrict coverage tool visibility under bzlmod
-   (pip) Ignore temporary pyc.NNN files in wheels
-   (pip) Add format() calls to glob_exclude templates
-   plugin_output in py_proto_library rule

##### Added

-   Using Gazelle's lifecycle manager to manage external processes
- (bzlmod) `pip.parse` can be called multiple times with different
Python
    versions
- (bzlmod) Allow bzlmod `pip.parse` to reference the default python
toolchain and interpreter
-   (bzlmod) Implementing wheel annotations via `whl_mods`
-   (gazelle) support multiple requirements files in manifest generation
- (py_wheel) Support for specifying `Description-Content-Type` and
`Summary` in METADATA
-   (py_wheel) Support for specifying `Project-URL`
- (compile_pip_requirements) Added `generate_hashes` arg (default True)
to
    control generating hashes
-   (pip) Create all_data_requirements alias
-   Expose Python C headers through the toolchain.

[0.24.0]:
https://github.com/bazelbuild/rules_python/releases/tag/0.24.0

###
[`v0.23.1`](https://github.com/bazelbuild/rules_python/releases/tag/0.23.1)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.23.0...0.23.1)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.23.1")

pip = use_extension("@&#8203;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:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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 [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1264](https://github.com/bazelbuild/rules_python/pull/1264)

**Full Changelog**:
bazelbuild/rules_python@0.23.0...0.23.1

###
[`v0.23.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.23.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.22.0...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 of `python.toolchain` has been removed. The toolchain
repo name format is `python_X_Y` e.g. `python_3_11`.

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.23.0")

pip = use_extension("@&#8203;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:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1230](https://github.com/bazelbuild/rules_python/pull/1230)
- build: Upgrade Gazelle to v0.31.0 by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1240](https://github.com/bazelbuild/rules_python/pull/1240)
- fix: make `import python.runfiles` work with
`--experimental_python_import_all_repositories=false` by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1243](https://github.com/bazelbuild/rules_python/pull/1243)
- feat(bzlmod): Moving register.toolchains internal by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1238](https://github.com/bazelbuild/rules_python/pull/1238)
- docs(compile_pip_requirements): Add note on requirements.txt VC by
[@&#8203;boomanaiden154](https://github.com/boomanaiden154) in
[https://github.com/bazelbuild/rules_python/pull/1245](https://github.com/bazelbuild/rules_python/pull/1245)
- cleanup: Set toolchain target_setting directly instead of via inline
ternary by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1246](https://github.com/bazelbuild/rules_python/pull/1246)
- fix(bzlmod): give precedence to the first seen versioned toolchain by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1244](https://github.com/bazelbuild/rules_python/pull/1244)
- chore: add a pre-commit hook to maintain deleted packages by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1208](https://github.com/bazelbuild/rules_python/pull/1208)
- chore: auto-publish gazelle module to BCR by
[@&#8203;kormide](https://github.com/kormide) in
[https://github.com/bazelbuild/rules_python/pull/1247](https://github.com/bazelbuild/rules_python/pull/1247)
- fix(coverage): bump to latest coverage.py and fix import shadowing by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1249](https://github.com/bazelbuild/rules_python/pull/1249)
- feat: add ppc64le releases and update to 3.10.11, 3.11.3 for
python-build-standalone by
[@&#8203;clnperez](https://github.com/clnperez) in
[https://github.com/bazelbuild/rules_python/pull/1234](https://github.com/bazelbuild/rules_python/pull/1234)
- fix(bzlmod)!: Remove ability to specify toolchain repo name. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1258](https://github.com/bazelbuild/rules_python/pull/1258)
- fix: update correct requirements lock file when using os specific lock
files by [@&#8203;Rasrack](https://github.com/Rasrack) in
[https://github.com/bazelbuild/rules_python/pull/1123](https://github.com/bazelbuild/rules_python/pull/1123)
- fix: use `only-binary` for `download_only` `pip download` by
[@&#8203;lpulley](https://github.com/lpulley) in
[https://github.com/bazelbuild/rules_python/pull/1219](https://github.com/bazelbuild/rules_python/pull/1219)
- feat: Adding variable support for distribution in py_wheel by
[@&#8203;ns-tkonduri](https://github.com/ns-tkonduri) in
[https://github.com/bazelbuild/rules_python/pull/1251](https://github.com/bazelbuild/rules_python/pull/1251)
- feat(bzlmod): Register a default toolchain by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1259](https://github.com/bazelbuild/rules_python/pull/1259)

#### New Contributors

- [@&#8203;boomanaiden154](https://github.com/boomanaiden154) made
their first contribution in
[https://github.com/bazelbuild/rules_python/pull/1245](https://github.com/bazelbuild/rules_python/pull/1245)
- [@&#8203;clnperez](https://github.com/clnperez) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1234](https://github.com/bazelbuild/rules_python/pull/1234)
- [@&#8203;lpulley](https://github.com/lpulley) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1219](https://github.com/bazelbuild/rules_python/pull/1219)
- [@&#8203;ns-tkonduri](https://github.com/ns-tkonduri) made their
first contribution in
[https://github.com/bazelbuild/rules_python/pull/1251](https://github.com/bazelbuild/rules_python/pull/1251)

**Full Changelog**:
bazelbuild/rules_python@0.22.0...0.23.0

###
[`v0.22.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.22.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.21.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("@&#8203;rules_python//python:extensions.bzl",
"python")` ->
`use_extension("@&#8203;rules_python//python/extensions:python.bzl",
"python")`
- `use_extension("@&#8203;rules_python//python:extensions.bzl", "pip")`
-> `use_extension("@&#8203;rules_python//python/extensions:pip.bzl",
"pip")`

The following `sed` commands should approximate the necessary changes:

```
sed 'sXuse_extension("@&#8203;rules_python//python:extensions.bzl", "python")Xuse_extension("@&#8203;rules_python//python/extensions:python.bzl", "python")X'`
sed 'sXuse_extension("@&#8203;rules_python//python:extensions.bzl", "pip")Xuse_extension("@&#8203;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:

```starlark
bazel_dep(name = "rules_python", version = "0.22.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python/extensions:python.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()
```

#### What's Changed

- fix: remove reference to
@&#8203;bazel_tools//tools/python/private:defs.bzl by
[@&#8203;comius](https://github.com/comius) in
[https://github.com/bazelbuild/rules_python/pull/1173](https://github.com/bazelbuild/rules_python/pull/1173)
- docs: Tell how to use GitHub to find commits in an upcoming release.
by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1092](https://github.com/bazelbuild/rules_python/pull/1092)
- fix: compile_pip_requirements test from external repositories by
[@&#8203;Rasrack](https://github.com/Rasrack) in
[https://github.com/bazelbuild/rules_python/pull/1124](https://github.com/bazelbuild/rules_python/pull/1124)
- feat: add Python 3.8.16 by
[@&#8203;jml-derek](https://github.com/jml-derek) in
[https://github.com/bazelbuild/rules_python/pull/1168](https://github.com/bazelbuild/rules_python/pull/1168)
- test: Set mac platform for test_mac_requires_darwin_for_execution by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1179](https://github.com/bazelbuild/rules_python/pull/1179)
- fix: Don't reference deleted private bazel_tools bzl file by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1180](https://github.com/bazelbuild/rules_python/pull/1180)
- docs: Add starlark directive to code snippet by
[@&#8203;blorente](https://github.com/blorente) in
[https://github.com/bazelbuild/rules_python/pull/1170](https://github.com/bazelbuild/rules_python/pull/1170)
- tests: Upgrade rules_testing to 0.0.5 by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1184](https://github.com/bazelbuild/rules_python/pull/1184)
- tests: Set linux platform for
test_non_mac_doesnt_require_darwin_for_execution by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1183](https://github.com/bazelbuild/rules_python/pull/1183)
- fix(bzlmod): correctly template repository macros for requirements,
etc by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1190](https://github.com/bazelbuild/rules_python/pull/1190)
- type:docs Update README.md by
[@&#8203;yuanweixin](https://github.com/yuanweixin) in
[https://github.com/bazelbuild/rules_python/pull/1186](https://github.com/bazelbuild/rules_python/pull/1186)
- fix: Allow passing a tuple to the `tags` attribute. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1191](https://github.com/bazelbuild/rules_python/pull/1191)
- tests: Add skylib to various test dependencies to fix CI by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1199](https://github.com/bazelbuild/rules_python/pull/1199)
- feat: removing bzlmod from example by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1200](https://github.com/bazelbuild/rules_python/pull/1200)
- feat: propagate visibility attribute for py_wheel publishing by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1203](https://github.com/bazelbuild/rules_python/pull/1203)
- docs: fix typos in pip_repository docs by
[@&#8203;martis42](https://github.com/martis42) in
[https://github.com/bazelbuild/rules_python/pull/1202](https://github.com/bazelbuild/rules_python/pull/1202)
- tests: Force analysis test labels to resolve within
@&#8203;rules_python context by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1187](https://github.com/bazelbuild/rules_python/pull/1187)
- fix(update_deleted_packages.sh): allow to run from anywhere in the
repo by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1206](https://github.com/bazelbuild/rules_python/pull/1206)
- feat(bzlmod): expose platform-agnostic repo target for toolchain
interpreter by [@&#8203;chrislovecnm](https://github.com/chrislovecnm)
in
[https://github.com/bazelbuild/rules_python/pull/1155](https://github.com/bazelbuild/rules_python/pull/1155)
- fix(update_deleted_packages.sh): wheels example should not be included
in .bazelrc by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1207](https://github.com/bazelbuild/rules_python/pull/1207)
- fix: Strip trailing newline from python output by
[@&#8203;illicitonion](https://github.com/illicitonion) in
[https://github.com/bazelbuild/rules_python/pull/1212](https://github.com/bazelbuild/rules_python/pull/1212)
- fix: manually ignore bazel-\* directories to make using custom Bazel
builds easier by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1181](https://github.com/bazelbuild/rules_python/pull/1181)
- test(bzlmod): explicitly enable bzlmod in the test harness by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1204](https://github.com/bazelbuild/rules_python/pull/1204)
- feat(bzlmod): Cleaning up interpreter resolution by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1218](https://github.com/bazelbuild/rules_python/pull/1218)
- feat(bzlmod)!: Move each bzlmod extension into its own file by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1226](https://github.com/bazelbuild/rules_python/pull/1226)
- Adding bzlmod support document by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1214](https://github.com/bazelbuild/rules_python/pull/1214)
- test(coverage): add a test to check the sys.path under bzlmod by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1223](https://github.com/bazelbuild/rules_python/pull/1223)
- fix(toolchain): set correct return attrs to remove non-hermeticity
warning by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1231](https://github.com/bazelbuild/rules_python/pull/1231)
- fix: allow url fragments in requirements file by
[@&#8203;mattoberle](https://github.com/mattoberle) in
[https://github.com/bazelbuild/rules_python/pull/1195](https://github.com/bazelbuild/rules_python/pull/1195)
- fix: `example/build_file_generation/README.md` by
[@&#8203;ofey404](https://github.com/ofey404) in
[https://github.com/bazelbuild/rules_python/pull/1164](https://github.com/bazelbuild/rules_python/pull/1164)
- fix: Using canonical name in requirements.bzl by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1176](https://github.com/bazelbuild/rules_python/pull/1176)
- feat(bzlmod): support entry_point macro by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1220](https://github.com/bazelbuild/rules_python/pull/1220)

#### New Contributors

- [@&#8203;Rasrack](https://github.com/Rasrack) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1124](https://github.com/bazelbuild/rules_python/pull/1124)
- [@&#8203;jml-derek](https://github.com/jml-derek) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1168](https://github.com/bazelbuild/rules_python/pull/1168)
- [@&#8203;blorente](https://github.com/blorente) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1170](https://github.com/bazelbuild/rules_python/pull/1170)
- [@&#8203;yuanweixin](https://github.com/yuanweixin) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1186](https://github.com/bazelbuild/rules_python/pull/1186)
- [@&#8203;ofey404](https://github.com/ofey404) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1164](https://github.com/bazelbuild/rules_python/pull/1164)

**Full Changelog**:
bazelbuild/rules_python@0.21.0...0.22.0

###
[`v0.21.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.21.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.20.0...0.21.0)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.21.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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 [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1137](https://github.com/bazelbuild/rules_python/pull/1137)
- fix: bump installer to handle windows better by
[@&#8203;f0rmiga](https://github.com/f0rmiga) in
[https://github.com/bazelbuild/rules_python/pull/1138](https://github.com/bazelbuild/rules_python/pull/1138)
- build: Fixing buildifier by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1148](https://github.com/bazelbuild/rules_python/pull/1148)
- docs: Updating documentation for bzlmod by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1149](https://github.com/bazelbuild/rules_python/pull/1149)
- fix: use a consistent buildifier version for CI and pre-commit by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1151](https://github.com/bazelbuild/rules_python/pull/1151)
- chore: bump buildifier to 6.1.0 by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1152](https://github.com/bazelbuild/rules_python/pull/1152)
- fix: correct the labels returned by all_requirements lists by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1146](https://github.com/bazelbuild/rules_python/pull/1146)
- fix: gazelle correctly adds new py_test rules by
[@&#8203;amartani](https://github.com/amartani) in
[https://github.com/bazelbuild/rules_python/pull/1143](https://github.com/bazelbuild/rules_python/pull/1143)
- fix: respect kind mapping by
[@&#8203;OniOni](https://github.com/OniOni) in
[https://github.com/bazelbuild/rules_python/pull/1158](https://github.com/bazelbuild/rules_python/pull/1158)
- test: cleanup gazelle tests and run them in parallel by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1159](https://github.com/bazelbuild/rules_python/pull/1159)
- \[docs] Fixing rule name in coverage.md docs by
[@&#8203;anfelbar](https://github.com/anfelbar) in
[https://github.com/bazelbuild/rules_python/pull/1162](https://github.com/bazelbuild/rules_python/pull/1162)
- feat: Support specifying multiple download URLs in tool_versions. by
[@&#8203;quval](https://github.com/quval) in
[https://github.com/bazelbuild/rules_python/pull/1145](https://github.com/bazelbuild/rules_python/pull/1145)

#### New Contributors

- [@&#8203;amartani](https://github.com/amartani) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1143](https://github.com/bazelbuild/rules_python/pull/1143)
- [@&#8203;anfelbar](https://github.com/anfelbar) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1162](https://github.com/bazelbuild/rules_python/pull/1162)
- [@&#8203;quval](https://github.com/quval) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1145](https://github.com/bazelbuild/rules_python/pull/1145)

**Full Changelog**:
bazelbuild/rules_python@0.20.0...0.21.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/bazel-contrib/rules_bazel_integration_test).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41NC4wIiwidXBkYXRlZEluVmVyIjoiMzYuNzguOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
alexeagle referenced this pull request in aspect-build/rules_py Nov 14, 2023
…#192)

[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[rules_python_gazelle_plugin](https://github.com/bazelbuild/rules_python)
| http_archive | minor | `0.18.0` -> `0.26.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_python (rules_python_gazelle_plugin)</summary>

###
[`v0.26.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0260---2023-10-06)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.25.0...0.26.0)

##### Changed

-   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`.

##### Added

-   (bzlmod, entry_point) Added
[`py_console_script_binary`](./docs/py_console_script_binary.md), 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.

##### Removed

- (bzlmod) The `entry_point` macro is no longer supported and has been
removed
in favour 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.

##### Fixed

- (whl_library) No longer restarts repository rule when fetching
external
dependencies improving initial build times involving external dependency
    fetching.

-   (gazelle) Improve runfiles lookup hermeticity.

###
[`v0.25.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0250---2023-08-22)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.24.0...0.25.0)

##### Changed

-   Python version patch level bumps:
    -   3.9.16 -> 3.9.17
    -   3.10.9 -> 3.10.12
    -   3.11.1 -> 3.11.4
-   (bzlmod) `pip.parse` can no longer automatically use the default
    Python version; this was an unreliable and unsafe behavior. The
    `python_version` arg must always be explicitly specified.

##### Fixed

- (docs) Update docs to use correct bzlmod APIs and clarify how and when
to use
    various APIs.
- (multi-version) The `main` arg is now correctly computed and usually
optional.
- (bzlmod) `pip.parse` no longer requires a call for whatever the
configured
    default Python version is.

##### Added

-   Created a changelog.
-   (gazelle) Stop generating unnecessary imports.
-   (toolchains) s390x supported for Python 3.9.17, 3.10.12, and 3.11.4.

[0.25.0]:
https://github.com/bazelbuild/rules_python/releases/tag/0.25.0

###
[`v0.24.0`](https://github.com/bazelbuild/rules_python/blob/HEAD/CHANGELOG.md#0240---2023-07-11)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.23.1...0.24.0)

##### Changed

-   **BREAKING** (gazelle) Gazelle 0.30.0 or higher is required
-   (bzlmod) `@python_aliases` renamed to \`@python_versions
-   (bzlmod) `pip.parse` arg `name` renamed to `hub_name`
- (bzlmod) `pip.parse` arg `incompatible_generate_aliases` removed and
always
    true.

##### Fixed

-   (bzlmod) Fixing Windows Python Interpreter symlink issues
-   (py_wheel) Allow twine tags and args
-   (toolchain, bzlmod) Restrict coverage tool visibility under bzlmod
-   (pip) Ignore temporary pyc.NNN files in wheels
-   (pip) Add format() calls to glob_exclude templates
-   plugin_output in py_proto_library rule

##### Added

-   Using Gazelle's lifecycle manager to manage external processes
- (bzlmod) `pip.parse` can be called multiple times with different
Python
    versions
- (bzlmod) Allow bzlmod `pip.parse` to reference the default python
toolchain and interpreter
-   (bzlmod) Implementing wheel annotations via `whl_mods`
-   (gazelle) support multiple requirements files in manifest generation
- (py_wheel) Support for specifying `Description-Content-Type` and
`Summary` in METADATA
-   (py_wheel) Support for specifying `Project-URL`
- (compile_pip_requirements) Added `generate_hashes` arg (default True)
to
    control generating hashes
-   (pip) Create all_data_requirements alias
-   Expose Python C headers through the toolchain.

[0.24.0]:
https://github.com/bazelbuild/rules_python/releases/tag/0.24.0

###
[`v0.23.1`](https://github.com/bazelbuild/rules_python/releases/tag/0.23.1)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.23.0...0.23.1)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.23.1")

pip = use_extension("@&#8203;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:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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 [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1264](https://github.com/bazelbuild/rules_python/pull/1264)

**Full Changelog**:
bazelbuild/rules_python@0.23.0...0.23.1

###
[`v0.23.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.23.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.22.0...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 of `python.toolchain` has been removed. The toolchain
repo name format is `python_X_Y` e.g. `python_3_11`.

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.23.0")

pip = use_extension("@&#8203;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:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1230](https://github.com/bazelbuild/rules_python/pull/1230)
- build: Upgrade Gazelle to v0.31.0 by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1240](https://github.com/bazelbuild/rules_python/pull/1240)
- fix: make `import python.runfiles` work with
`--experimental_python_import_all_repositories=false` by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1243](https://github.com/bazelbuild/rules_python/pull/1243)
- feat(bzlmod): Moving register.toolchains internal by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1238](https://github.com/bazelbuild/rules_python/pull/1238)
- docs(compile_pip_requirements): Add note on requirements.txt VC by
[@&#8203;boomanaiden154](https://github.com/boomanaiden154) in
[https://github.com/bazelbuild/rules_python/pull/1245](https://github.com/bazelbuild/rules_python/pull/1245)
- cleanup: Set toolchain target_setting directly instead of via inline
ternary by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1246](https://github.com/bazelbuild/rules_python/pull/1246)
- fix(bzlmod): give precedence to the first seen versioned toolchain by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1244](https://github.com/bazelbuild/rules_python/pull/1244)
- chore: add a pre-commit hook to maintain deleted packages by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1208](https://github.com/bazelbuild/rules_python/pull/1208)
- chore: auto-publish gazelle module to BCR by
[@&#8203;kormide](https://github.com/kormide) in
[https://github.com/bazelbuild/rules_python/pull/1247](https://github.com/bazelbuild/rules_python/pull/1247)
- fix(coverage): bump to latest coverage.py and fix import shadowing by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1249](https://github.com/bazelbuild/rules_python/pull/1249)
- feat: add ppc64le releases and update to 3.10.11, 3.11.3 for
python-build-standalone by
[@&#8203;clnperez](https://github.com/clnperez) in
[https://github.com/bazelbuild/rules_python/pull/1234](https://github.com/bazelbuild/rules_python/pull/1234)
- fix(bzlmod)!: Remove ability to specify toolchain repo name. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1258](https://github.com/bazelbuild/rules_python/pull/1258)
- fix: update correct requirements lock file when using os specific lock
files by [@&#8203;Rasrack](https://github.com/Rasrack) in
[https://github.com/bazelbuild/rules_python/pull/1123](https://github.com/bazelbuild/rules_python/pull/1123)
- fix: use `only-binary` for `download_only` `pip download` by
[@&#8203;lpulley](https://github.com/lpulley) in
[https://github.com/bazelbuild/rules_python/pull/1219](https://github.com/bazelbuild/rules_python/pull/1219)
- feat: Adding variable support for distribution in py_wheel by
[@&#8203;ns-tkonduri](https://github.com/ns-tkonduri) in
[https://github.com/bazelbuild/rules_python/pull/1251](https://github.com/bazelbuild/rules_python/pull/1251)
- feat(bzlmod): Register a default toolchain by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1259](https://github.com/bazelbuild/rules_python/pull/1259)

#### New Contributors

- [@&#8203;boomanaiden154](https://github.com/boomanaiden154) made
their first contribution in
[https://github.com/bazelbuild/rules_python/pull/1245](https://github.com/bazelbuild/rules_python/pull/1245)
- [@&#8203;clnperez](https://github.com/clnperez) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1234](https://github.com/bazelbuild/rules_python/pull/1234)
- [@&#8203;lpulley](https://github.com/lpulley) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1219](https://github.com/bazelbuild/rules_python/pull/1219)
- [@&#8203;ns-tkonduri](https://github.com/ns-tkonduri) made their
first contribution in
[https://github.com/bazelbuild/rules_python/pull/1251](https://github.com/bazelbuild/rules_python/pull/1251)

**Full Changelog**:
bazelbuild/rules_python@0.22.0...0.23.0

###
[`v0.22.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.22.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.21.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("@&#8203;rules_python//python:extensions.bzl",
"python")` ->
`use_extension("@&#8203;rules_python//python/extensions:python.bzl",
"python")`
- `use_extension("@&#8203;rules_python//python:extensions.bzl", "pip")`
-> `use_extension("@&#8203;rules_python//python/extensions:pip.bzl",
"pip")`

The following `sed` commands should approximate the necessary changes:

```
sed 'sXuse_extension("@&#8203;rules_python//python:extensions.bzl", "python")Xuse_extension("@&#8203;rules_python//python/extensions:python.bzl", "python")X'`
sed 'sXuse_extension("@&#8203;rules_python//python:extensions.bzl", "pip")Xuse_extension("@&#8203;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:

```starlark
bazel_dep(name = "rules_python", version = "0.22.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python/extensions:python.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()
```

#### What's Changed

- fix: remove reference to
@&#8203;bazel_tools//tools/python/private:defs.bzl by
[@&#8203;comius](https://github.com/comius) in
[https://github.com/bazelbuild/rules_python/pull/1173](https://github.com/bazelbuild/rules_python/pull/1173)
- docs: Tell how to use GitHub to find commits in an upcoming release.
by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1092](https://github.com/bazelbuild/rules_python/pull/1092)
- fix: compile_pip_requirements test from external repositories by
[@&#8203;Rasrack](https://github.com/Rasrack) in
[https://github.com/bazelbuild/rules_python/pull/1124](https://github.com/bazelbuild/rules_python/pull/1124)
- feat: add Python 3.8.16 by
[@&#8203;jml-derek](https://github.com/jml-derek) in
[https://github.com/bazelbuild/rules_python/pull/1168](https://github.com/bazelbuild/rules_python/pull/1168)
- test: Set mac platform for test_mac_requires_darwin_for_execution by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1179](https://github.com/bazelbuild/rules_python/pull/1179)
- fix: Don't reference deleted private bazel_tools bzl file by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1180](https://github.com/bazelbuild/rules_python/pull/1180)
- docs: Add starlark directive to code snippet by
[@&#8203;blorente](https://github.com/blorente) in
[https://github.com/bazelbuild/rules_python/pull/1170](https://github.com/bazelbuild/rules_python/pull/1170)
- tests: Upgrade rules_testing to 0.0.5 by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1184](https://github.com/bazelbuild/rules_python/pull/1184)
- tests: Set linux platform for
test_non_mac_doesnt_require_darwin_for_execution by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1183](https://github.com/bazelbuild/rules_python/pull/1183)
- fix(bzlmod): correctly template repository macros for requirements,
etc by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1190](https://github.com/bazelbuild/rules_python/pull/1190)
- type:docs Update README.md by
[@&#8203;yuanweixin](https://github.com/yuanweixin) in
[https://github.com/bazelbuild/rules_python/pull/1186](https://github.com/bazelbuild/rules_python/pull/1186)
- fix: Allow passing a tuple to the `tags` attribute. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1191](https://github.com/bazelbuild/rules_python/pull/1191)
- tests: Add skylib to various test dependencies to fix CI by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1199](https://github.com/bazelbuild/rules_python/pull/1199)
- feat: removing bzlmod from example by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1200](https://github.com/bazelbuild/rules_python/pull/1200)
- feat: propagate visibility attribute for py_wheel publishing by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1203](https://github.com/bazelbuild/rules_python/pull/1203)
- docs: fix typos in pip_repository docs by
[@&#8203;martis42](https://github.com/martis42) in
[https://github.com/bazelbuild/rules_python/pull/1202](https://github.com/bazelbuild/rules_python/pull/1202)
- tests: Force analysis test labels to resolve within
@&#8203;rules_python context by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1187](https://github.com/bazelbuild/rules_python/pull/1187)
- fix(update_deleted_packages.sh): allow to run from anywhere in the
repo by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1206](https://github.com/bazelbuild/rules_python/pull/1206)
- feat(bzlmod): expose platform-agnostic repo target for toolchain
interpreter by [@&#8203;chrislovecnm](https://github.com/chrislovecnm)
in
[https://github.com/bazelbuild/rules_python/pull/1155](https://github.com/bazelbuild/rules_python/pull/1155)
- fix(update_deleted_packages.sh): wheels example should not be included
in .bazelrc by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1207](https://github.com/bazelbuild/rules_python/pull/1207)
- fix: Strip trailing newline from python output by
[@&#8203;illicitonion](https://github.com/illicitonion) in
[https://github.com/bazelbuild/rules_python/pull/1212](https://github.com/bazelbuild/rules_python/pull/1212)
- fix: manually ignore bazel-\* directories to make using custom Bazel
builds easier by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1181](https://github.com/bazelbuild/rules_python/pull/1181)
- test(bzlmod): explicitly enable bzlmod in the test harness by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1204](https://github.com/bazelbuild/rules_python/pull/1204)
- feat(bzlmod): Cleaning up interpreter resolution by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1218](https://github.com/bazelbuild/rules_python/pull/1218)
- feat(bzlmod)!: Move each bzlmod extension into its own file by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1226](https://github.com/bazelbuild/rules_python/pull/1226)
- Adding bzlmod support document by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1214](https://github.com/bazelbuild/rules_python/pull/1214)
- test(coverage): add a test to check the sys.path under bzlmod by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1223](https://github.com/bazelbuild/rules_python/pull/1223)
- fix(toolchain): set correct return attrs to remove non-hermeticity
warning by [@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1231](https://github.com/bazelbuild/rules_python/pull/1231)
- fix: allow url fragments in requirements file by
[@&#8203;mattoberle](https://github.com/mattoberle) in
[https://github.com/bazelbuild/rules_python/pull/1195](https://github.com/bazelbuild/rules_python/pull/1195)
- fix: `example/build_file_generation/README.md` by
[@&#8203;ofey404](https://github.com/ofey404) in
[https://github.com/bazelbuild/rules_python/pull/1164](https://github.com/bazelbuild/rules_python/pull/1164)
- fix: Using canonical name in requirements.bzl by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1176](https://github.com/bazelbuild/rules_python/pull/1176)
- feat(bzlmod): support entry_point macro by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1220](https://github.com/bazelbuild/rules_python/pull/1220)

#### New Contributors

- [@&#8203;Rasrack](https://github.com/Rasrack) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1124](https://github.com/bazelbuild/rules_python/pull/1124)
- [@&#8203;jml-derek](https://github.com/jml-derek) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1168](https://github.com/bazelbuild/rules_python/pull/1168)
- [@&#8203;blorente](https://github.com/blorente) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1170](https://github.com/bazelbuild/rules_python/pull/1170)
- [@&#8203;yuanweixin](https://github.com/yuanweixin) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1186](https://github.com/bazelbuild/rules_python/pull/1186)
- [@&#8203;ofey404](https://github.com/ofey404) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1164](https://github.com/bazelbuild/rules_python/pull/1164)

**Full Changelog**:
bazelbuild/rules_python@0.21.0...0.22.0

###
[`v0.21.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.21.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.20.0...0.21.0)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.21.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;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("@&#8203;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 [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1137](https://github.com/bazelbuild/rules_python/pull/1137)
- fix: bump installer to handle windows better by
[@&#8203;f0rmiga](https://github.com/f0rmiga) in
[https://github.com/bazelbuild/rules_python/pull/1138](https://github.com/bazelbuild/rules_python/pull/1138)
- build: Fixing buildifier by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1148](https://github.com/bazelbuild/rules_python/pull/1148)
- docs: Updating documentation for bzlmod by
[@&#8203;chrislovecnm](https://github.com/chrislovecnm) in
[https://github.com/bazelbuild/rules_python/pull/1149](https://github.com/bazelbuild/rules_python/pull/1149)
- fix: use a consistent buildifier version for CI and pre-commit by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1151](https://github.com/bazelbuild/rules_python/pull/1151)
- chore: bump buildifier to 6.1.0 by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1152](https://github.com/bazelbuild/rules_python/pull/1152)
- fix: correct the labels returned by all_requirements lists by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1146](https://github.com/bazelbuild/rules_python/pull/1146)
- fix: gazelle correctly adds new py_test rules by
[@&#8203;amartani](https://github.com/amartani) in
[https://github.com/bazelbuild/rules_python/pull/1143](https://github.com/bazelbuild/rules_python/pull/1143)
- fix: respect kind mapping by
[@&#8203;OniOni](https://github.com/OniOni) in
[https://github.com/bazelbuild/rules_python/pull/1158](https://github.com/bazelbuild/rules_python/pull/1158)
- test: cleanup gazelle tests and run them in parallel by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1159](https://github.com/bazelbuild/rules_python/pull/1159)
- \[docs] Fixing rule name in coverage.md docs by
[@&#8203;anfelbar](https://github.com/anfelbar) in
[https://github.com/bazelbuild/rules_python/pull/1162](https://github.com/bazelbuild/rules_python/pull/1162)
- feat: Support specifying multiple download URLs in tool_versions. by
[@&#8203;quval](https://github.com/quval) in
[https://github.com/bazelbuild/rules_python/pull/1145](https://github.com/bazelbuild/rules_python/pull/1145)

#### New Contributors

- [@&#8203;amartani](https://github.com/amartani) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1143](https://github.com/bazelbuild/rules_python/pull/1143)
- [@&#8203;anfelbar](https://github.com/anfelbar) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1162](https://github.com/bazelbuild/rules_python/pull/1162)
- [@&#8203;quval](https://github.com/quval) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1145](https://github.com/bazelbuild/rules_python/pull/1145)

**Full Changelog**:
bazelbuild/rules_python@0.20.0...0.21.0

###
[`v0.20.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.20.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.19.0...0.20.0)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.20.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "a644da969b6824cc87f8fe7b18101a8a6c57da5db39caa6566ec6109f37d2141",
    strip_prefix = "rules_python-0.20.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.20.0/rules_python-0.20.0.tar.gz",
)

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "a644da969b6824cc87f8fe7b18101a8a6c57da5db39caa6566ec6109f37d2141",
    strip_prefix = "rules_python-0.20.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.20.0/rules_python-0.20.0.tar.gz",
)

### To compile the rules_python gazelle extension from source,
### we must fetch some third-party go dependencies that it uses.

load("@&#8203;rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()
```

#### What's Changed

- chore: fix some lingering GH archive URLs by
[@&#8203;alexeagle](https://github.com/alexeagle) in
[https://github.com/bazelbuild/rules_python/pull/1108](https://github.com/bazelbuild/rules_python/pull/1108)
- feat: add bzlmod support for gazelle plugin by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1077](https://github.com/bazelbuild/rules_python/pull/1077)
- docs: Simplify pull request template by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1100](https://github.com/bazelbuild/rules_python/pull/1100)
- chore: fix syntax that stardoc misunderstands as HTML by
[@&#8203;alexeagle](https://github.com/alexeagle) in
[https://github.com/bazelbuild/rules_python/pull/1110](https://github.com/bazelbuild/rules_python/pull/1110)
- fix: update gazelle to properly handle dot in package name. by
[@&#8203;OniOni](https://github.com/OniOni) in
[https://github.com/bazelbuild/rules_python/pull/1083](https://github.com/bazelbuild/rules_python/pull/1083)
- fix(bzlmod): expose ignore_root_user_error attribute from
python_register_toolchains by
[@&#8203;alexeagle](https://github.com/alexeagle) in
[https://github.com/bazelbuild/rules_python/pull/1114](https://github.com/bazelbuild/rules_python/pull/1114)
- feat: add bzl_library for defs.bzl and its dependencies by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1115](https://github.com/bazelbuild/rules_python/pull/1115)
- fix: docs for ignore_root_user_error at the module level by
[@&#8203;stonier](https://github.com/stonier) in
[https://github.com/bazelbuild/rules_python/pull/1112](https://github.com/bazelbuild/rules_python/pull/1112)
- fix: generation of toolchain aliases //:defs.bzl file. by
[@&#8203;oxidase](https://github.com/oxidase) in
[https://github.com/bazelbuild/rules_python/pull/1088](https://github.com/bazelbuild/rules_python/pull/1088)
- feat: make variable substitution for py_wheel abi, python_tag args by
[@&#8203;stonier](https://github.com/stonier) in
[https://github.com/bazelbuild/rules_python/pull/1113](https://github.com/bazelbuild/rules_python/pull/1113)
- feat: add bzl_library for proto.bzl by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1116](https://github.com/bazelbuild/rules_python/pull/1116)
- cleanup: Remove license comment in proto build file by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1118](https://github.com/bazelbuild/rules_python/pull/1118)
- fix: restrict proto package visibility to private by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1117](https://github.com/bazelbuild/rules_python/pull/1117)
- cleanup: rename proto BUILD -> BUILD.bazel by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1119](https://github.com/bazelbuild/rules_python/pull/1119)
- feat: bzl file per rule/provider by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1122](https://github.com/bazelbuild/rules_python/pull/1122)
- cleanup: fix typo: libraries, not libaries by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1127](https://github.com/bazelbuild/rules_python/pull/1127)
- feat: add public entry point for PyCcLinkParamsInfo by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1128](https://github.com/bazelbuild/rules_python/pull/1128)
- cleanup: reformat defs.bzl doc string. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1126](https://github.com/bazelbuild/rules_python/pull/1126)
- fix: Include filename when parsing imports for gazelle by
[@&#8203;jlaxson](https://github.com/jlaxson) in
[https://github.com/bazelbuild/rules_python/pull/1133](https://github.com/bazelbuild/rules_python/pull/1133)

#### New Contributors

- [@&#8203;OniOni](https://github.com/OniOni) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1083](https://github.com/bazelbuild/rules_python/pull/1083)
- [@&#8203;stonier](https://github.com/stonier) made their first
contribution in
[https://github.com/bazelbuild/rules_python/pull/1112](https://github.com/bazelbuild/rules_python/pull/1112)

**Full Changelog**:
bazelbuild/rules_python@0.19.0...0.20.0

###
[`v0.19.0`](https://github.com/bazelbuild/rules_python/releases/tag/0.19.0)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.18.1...0.19.0)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.19.0")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "ffc7b877c95413c82bfd5482c017edcf759a6250d8b24e82f41f3c8b8d9e287e",
    strip_prefix = "rules_python-0.19.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.19.0/rules_python-0.19.0.tar.gz",
)

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "ffc7b877c95413c82bfd5482c017edcf759a6250d8b24e82f41f3c8b8d9e287e",
    strip_prefix = "rules_python-0.19.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.19.0/rules_python-0.19.0.tar.gz",
)
```

#### What's Changed

- Making exclusions more strict by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1054](https://github.com/bazelbuild/rules_python/pull/1054)
- docs: fix requirement line for runfiles example by
[@&#8203;alexeagle](https://github.com/alexeagle) in
[https://github.com/bazelbuild/rules_python/pull/1052](https://github.com/bazelbuild/rules_python/pull/1052)
- fix: make py_proto_library respect PyInfo imports by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1046](https://github.com/bazelbuild/rules_python/pull/1046)
- Make toolchain acceptance tests work with latest Bazel build CI
pipeline by [@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1062](https://github.com/bazelbuild/rules_python/pull/1062)
- Only set `py_runtime.coverage_tool` for Bazel 6 and higher. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1061](https://github.com/bazelbuild/rules_python/pull/1061)
- Allow building with unreleased Bazel versions. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1063](https://github.com/bazelbuild/rules_python/pull/1063)
- Extending server process timeout by
[@&#8203;linzhp](https://github.com/linzhp) in
[https://github.com/bazelbuild/rules_python/pull/1060](https://github.com/bazelbuild/rules_python/pull/1060)
- chore: regenerate gazelle_python.yaml manifest by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1066](https://github.com/bazelbuild/rules_python/pull/1066)
- feat: wheel publishing by
[@&#8203;alexeagle](https://github.com/alexeagle) in
[https://github.com/bazelbuild/rules_python/pull/1015](https://github.com/bazelbuild/rules_python/pull/1015)
- fix: checked-in requirements imports generated requirements by
[@&#8203;f0rmiga](https://github.com/f0rmiga) in
[https://github.com/bazelbuild/rules_python/pull/1053](https://github.com/bazelbuild/rules_python/pull/1053)
- fix: Propagate testonly et al for wheel `.dist` targets by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1064](https://github.com/bazelbuild/rules_python/pull/1064)
- fix: correctly advertise minimum supported version by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1065](https://github.com/bazelbuild/rules_python/pull/1065)
- refactor: starlark reimplementation of pip_repository by
[@&#8203;aignas](https://github.com/aignas) in
[https://github.com/bazelbuild/rules_python/pull/1043](https://github.com/bazelbuild/rules_python/pull/1043)
- Add some docs about how to configure coverage. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1074](https://github.com/bazelbuild/rules_python/pull/1074)
- Remove empty line between copyright and build file docstring. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1084](https://github.com/bazelbuild/rules_python/pull/1084)
- cleanup: Remove license type comment; they're no longer required by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1078](https://github.com/bazelbuild/rules_python/pull/1078)
- fix: Use GitHub download URL for BCR URL instead of archive URL. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1093](https://github.com/bazelbuild/rules_python/pull/1093)
- Add a script to add missing license headers by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1094](https://github.com/bazelbuild/rules_python/pull/1094)
- fix: Update pre-commit dependency versions so isort works. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1096](https://github.com/bazelbuild/rules_python/pull/1096)
- docs: doc that the Conventional Commit style should be used for merged
commits and PRs by [@&#8203;rickeylev](https://github.com/rickeylev)
in
[https://github.com/bazelbuild/rules_python/pull/1099](https://github.com/bazelbuild/rules_python/pull/1099)
- test(core): Add analysis tests for base Python rules. by
[@&#8203;rickeylev](https://github.com/rickeylev) in
[https://github.com/bazelbuild/rules_python/pull/1102](https://github.com/bazelbuild/rules_python/pull/1102)

**Full Changelog**:
bazelbuild/rules_python@0.18.0...0.19.0

###
[`v0.18.1`](https://github.com/bazelbuild/rules_python/releases/tag/0.18.1)

[Compare
Source](https://github.com/bazelbuild/rules_python/compare/0.18.0...0.18.1)

#### Using Bzlmod with Bazel 6

Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_python", version = "0.18.1")

pip = use_extension("@&#8203;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("@&#8203;rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@&#8203;python3_9_toolchains//:all",
)
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "29a801171f7ca190c543406f9894abf2d483c206e14d6acbd695623662320097",
    strip_prefix = "rules_python-0.18.1",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.18.1/rules_python-0.18.1.tar.gz",
)

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
```

##### Gazelle plugin

Paste this snippet into your `WORKSPACE` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "29a801171f7ca190c543406f9894abf2d483c206e14d6acbd695623662320097",
    strip_prefix = "rules_python-0.18.1/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.18.1/rules_python-0.18.1.tar.gz",
)
```

### Relevant Changes

- Only set `py_runtime.coverage_tool` for Bazel 6 and higher.
([#&#8203;1061](https://github.com/bazelbuild/rules_python/issues/1061))

**Full Changelog**:
bazelbuild/rules_python@0.18.0...0.18.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/aspect-build/rules_py).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi45Ny4xIiwidXBkYXRlZEluVmVyIjoiMzcuNDYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants