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

Work around platform.python_version() returning non PEP 440 compliant version for non-tagged CPython builds #802

Merged
merged 2 commits into from
May 20, 2024

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented May 19, 2024

Fixes #678

Since #678 will make things difficult for pip 24.1 users using non-tagged python builds, I'm proposing this solution.

We could also work around it in pip but this would be messier and would not solve the problem for packaging users.

CPython could also be changed, but it is likely more complex to achieve and probably not doable for older CPython versions.

@pradyunsg pradyunsg merged commit 3e67fc7 into pypa:main May 20, 2024
32 checks passed
@pradyunsg pradyunsg changed the title Work around platform.python_version() returning non PEP 440 compliant version for non-tagged Python builds Work around platform.python_version() returning non PEP 440 compliant version for non-tagged CPython builds May 20, 2024
@sbidoul sbidoul deleted the python_full_version-plus branch May 21, 2024 06:03
@ichard26 ichard26 mentioned this pull request Jun 6, 2024
kodiakhq bot referenced this pull request in cloudquery/plugin-sdk-python Jul 1, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [packaging](https://github.com/pypa/packaging) | minor | `==24.0` -> `==24.1` |

---

### Release Notes

<details>
<summary>pypa/packaging (packaging)</summary>

### [`v24.1`](https://github.com/pypa/packaging/releases/tag/24.1)

[Compare Source](https://github.com/pypa/packaging/compare/24.0...24.1)

#### What's Changed

-   pyupgrade/black/isort/flake8 → ruff by [@&#8203;DimitriPapadopoulos](https://github.com/DimitriPapadopoulos) in [https://github.com/pypa/packaging/pull/769](https://github.com/pypa/packaging/pull/769)
-   Add support for Python 3.13 and drop EOL 3.7 by [@&#8203;hugovk](https://github.com/hugovk) in [https://github.com/pypa/packaging/pull/783](https://github.com/pypa/packaging/pull/783)
-   Bump the github-actions group with 4 updates by [@&#8203;dependabot](https://github.com/dependabot) in [https://github.com/pypa/packaging/pull/782](https://github.com/pypa/packaging/pull/782)
-   Fix typo in `_parser` docstring by [@&#8203;pradyunsg](https://github.com/pradyunsg) in [https://github.com/pypa/packaging/pull/784](https://github.com/pypa/packaging/pull/784)
-   Modernise type annotations using FA rules from ruff by [@&#8203;pradyunsg](https://github.com/pradyunsg) in [https://github.com/pypa/packaging/pull/785](https://github.com/pypa/packaging/pull/785)
-   Document `markers.default_environment()` by [@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in [https://github.com/pypa/packaging/pull/753](https://github.com/pypa/packaging/pull/753)
-   Bump the github-actions group with 3 updates by [@&#8203;dependabot](https://github.com/dependabot) in [https://github.com/pypa/packaging/pull/789](https://github.com/pypa/packaging/pull/789)
-   Work around platform.python_version() returning non PEP 440 compliant version for non-tagged CPython builds by [@&#8203;sbidoul](https://github.com/sbidoul) in [https://github.com/pypa/packaging/pull/802](https://github.com/pypa/packaging/pull/802)

#### New Contributors

-   [@&#8203;dependabot](https://github.com/dependabot) made their first contribution in [https://github.com/pypa/packaging/pull/782](https://github.com/pypa/packaging/pull/782)
-   [@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) made their first contribution in [https://github.com/pypa/packaging/pull/753](https://github.com/pypa/packaging/pull/753)

**Full Changelog**: pypa/packaging@24.0...24.1

</details>

---

### Configuration

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

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

♻ **Rebasing**: Whenever PR becomes conflicted, 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 [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuMyIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
Comment on lines +313 to +315
# compliant for non-tagged Python builds. We preserve default_environment()'s
# behavior of returning platform.python_version() verbatim, and leave it to the
# caller to provide a syntactically valid version if they want to override it.
Copy link
Member

Choose a reason for hiding this comment

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

What was the motivation for preserving the non-compliant version number and expecting the caller to do this same logic? That leads to other callers like pipx encountering the same bug. Is the expectation that all downstream users should have to provide their own fix?

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.

Non-tagged Python builds use non-PEP 440 versions
3 participants