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(pypi): use local version specifiers for patched whl output #2365

Merged
merged 3 commits into from
Nov 4, 2024

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Nov 1, 2024

Before this change the installation of the patched wheels using uv or
similar would break. This change fixes that by using local version
specifier, which is better than using a build tag when installing the
wheels.

Before the change:

$ cd examples/bzlmod
$ bazel build @pip//requests:whl
$ uv pip install <path to requests wheel in the example>
error: The wheel filename "requests-2.25.1-patched-py2.py3-none-any.whl" has an invalid build tag: must start with a digit

After:

$ uv pip install <path to requests wheel in the example>
Resolved 5 packages in 288ms
Prepared 5 packages in 152ms
Installed 5 packages in 13ms
 + certifi==2024.8.30
 + chardet==4.0.0
 + idna==2.10
 + requests==2.25.1+patched (from file:///home/aignas/src/github/aignas/rules_python/examples/bzlmod/bazel-bzlmod/external/rules_python~~pip~pip_39_requests_py2_none_any_c210084e/requests-2.25.1+patched-py2.py3-none-any.whl)
 + urllib3==1.26.20

Before this change the installation of the patched wheels using `uv` or
similar would break. This change fixes that by using local version
specifier, which is better than using a build tag when installing the
wheels.

Before the change:
```console
$ cd examples/bzlmod
$ bazel build @pip//requests:whl
$ uv pip install <path to requests wheel in the example>
error: The wheel filename "requests-2.25.1-patched-py2.py3-none-any.whl" has an invalid build tag: must start with a digit
```

After:
```
$ uv pip install <path to requests wheel in the example>
Resolved 5 packages in 288ms
Prepared 5 packages in 152ms
Installed 5 packages in 13ms
 + certifi==2024.8.30
 + chardet==4.0.0
 + idna==2.10
 + requests==2.25.1+patched (from file:///home/aignas/src/github/aignas/rules_python/examples/bzlmod/bazel-bzlmod/external/rules_python~~pip~pip_39_requests_py2_none_any_c210084e/requests-2.25.1+patched-py2.py3-none-any.whl)
 + urllib3==1.26.20
```
@aignas aignas enabled auto-merge November 2, 2024 04:12
@@ -47,6 +47,8 @@ A brief description of the categories of changes:
([617](https://github.com/bazelbuild/rules_python/issues/617)).
* (pypi) When {attr}`pip.parse.experimental_index_url` is set, we need to still
pass the `extra_pip_args` value when building an `sdist`.
* (pypi) The patched wheel filenames from now on are using local version specifiers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* (pypi) The patched wheel filenames from now on are using local version specifiers
* (pypi) The patched wheel filenames from now on are using local version identifiers

Alternative suggestion for full CHANGELOG entry:
(pypi) Patched wheel filenames use local version identifiers to enable installation with standards-compliant package managers

Copy link
Collaborator

@groodt groodt left a comment

Choose a reason for hiding this comment

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

LGTM

@aignas aignas added this pull request to the merge queue Nov 4, 2024
Merged via the queue into bazelbuild:main with commit ae0aeff Nov 4, 2024
4 checks passed
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.

2 participants