Skip to content

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jul 1, 2025

This allows PythonDownloadRequest which is used for parsing general install key requests to have missing segments, which unblocks requests like windows-aarch64 or cpython-linux (whereas before those would require any-any-windows-aarch64 and cpython-any-linux respectively). We still require strict ordering of segments.

Previously, we only allowed missing segments at the end of the key.

This uses a state machine for parsing, which is quite a bit more complicated.

I'm a little hesitant about the possibility that this regresses error messages and the complexity of the implementation, but uv run -p aarch64 seems valuable following #13724. The alternative to this would probably be to make these explicit in various places? e.g., expose --python-arch, --python-libc, and --python-os? Or make --python-platform (which already exists) accept a subset of the keys?

There is a possibility of regressions here, e.g., if something matches this parser it will not fallback to the PythonRequest::ExecutableName case and we've made this parser more permissive, but I think that should be quite rare?

@zanieb zanieb changed the title zb/parse key Allow Python requests with missing segments Jul 1, 2025
@zanieb zanieb temporarily deployed to uv-test-registries July 1, 2025 18:33 — with GitHub Actions Inactive
@zanieb zanieb temporarily deployed to uv-test-registries July 1, 2025 19:04 — with GitHub Actions Inactive
@zanieb zanieb temporarily deployed to uv-test-registries July 1, 2025 19:31 — with GitHub Actions Inactive
@zanieb zanieb temporarily deployed to uv-test-registries July 1, 2025 19:50 — with GitHub Actions Inactive

// Install an x86_64 version (assuming an aarch64 host)
uv_snapshot!(context.filters(), context.python_install().arg("cpython-3.13-macos-x86_64"), @r"
uv_snapshot!(context.filters(), context.python_install().arg("3.13-x86_64"), @r"
Copy link
Member Author

Choose a reason for hiding this comment

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

I used these here as a PoC / integration test!

@zanieb zanieb temporarily deployed to uv-test-registries July 2, 2025 16:31 — with GitHub Actions Inactive
@zanieb zanieb temporarily deployed to uv-test-registries July 2, 2025 16:43 — with GitHub Actions Inactive
@zanieb zanieb marked this pull request as ready for review July 2, 2025 16:51
if let Some(err) = state.error {
return Err(err);
}
state.next_part();
Copy link
Member

Choose a reason for hiding this comment

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

This LGTM. Once I figured out how to read one state transition (i.e., the differing behavior based on whether the value parsed or not), I found it easy to pattern match that understanding to the other transitions. So there's a fair bit of code, but it follows a nice repeatable structure that I find easy to digest.

So, nice job!

Copy link
Member Author

Choose a reason for hiding this comment

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

<3 I could document how the machine works a little

@zanieb zanieb merged commit b38edb9 into main Aug 13, 2025
90 checks passed
@zanieb zanieb deleted the zb/parse-key branch August 13, 2025 16:03
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 16, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.8.9` -> `0.8.11` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.8.11`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0811)

[Compare Source](astral-sh/uv@0.8.10...0.8.11)

##### Python

- Add Python 3.14.0rc2
- Update Pyodide to 0.28.1

##### Enhancements

- Add Debian 13 trixie to published Docker images ([#&#8203;15269](astral-sh/uv#15269))
- Add `extra-build-dependencies` hint for any missing module on build failure ([#&#8203;15252](astral-sh/uv#15252))
- Make 'v' prefix cyan in overlap warnings ([#&#8203;15259](astral-sh/uv#15259))

##### Bug fixes

- Fix missing uv version in extended Docker image tags ([#&#8203;15263](astral-sh/uv#15263))
- Persist cache info when re-installing cached wheels ([#&#8203;15274](astral-sh/uv#15274))

##### Rust API

- Allow passing custom `reqwest` clients to `RegistryClient` ([#&#8203;15281](astral-sh/uv#15281))

### [`v0.8.10`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0810)

[Compare Source](astral-sh/uv@0.8.9...0.8.10)

##### Python

- Add support for installing Pyodide versions ([#&#8203;14518](astral-sh/uv#14518))

##### Enhancements

- Allow Python requests with missing segments, e.g., just `aarch64` ([#&#8203;14399](astral-sh/uv#14399))

##### Preview

- Move warnings for conflicting modules into preview ([#&#8203;15253](astral-sh/uv#15253))

</details>

---

### Configuration

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

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

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

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

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS42Ni4yIiwidXBkYXRlZEluVmVyIjoiNDEuNzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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