disfavor aarch64 windows in its own house#13724
Conversation
crates/uv-python/src/installation.rs
Outdated
| // Architectures are sorted in preferred order, with native architectures first | ||
| .then_with(|| self.arch.cmp(&other.arch).reverse()) | ||
| .then_with(|| { | ||
| // For the time being, manually sort windows to make aarch64 windows disfavored |
There was a problem hiding this comment.
Why not implement this in
uv/crates/uv-python/src/platform.rs
Lines 40 to 59 in 546a6d0
self.os check here?
There was a problem hiding this comment.
(this just looks a lot like the logic already in Arch::cmp and I think it'd be easier to reason about in a single location)
There was a problem hiding this comment.
Yeah it's because of the os check. Not that it's super useful now that I think about it harder, but it feels... wrong... that we would resolve a request for python-3.11-darwin-any to intel on arm64 windows.
There was a problem hiding this comment.
Hm... it does feel wrong... but like... not a real use-case today. I worry about this being brittle. I'll ponder this overnight.
It does suggest that long-term we need a dedicated Platform type to encapsulate both the OS and the Arch and implement Ord on that instead?
CodSpeed Walltime Performance ReportMerging #13724 will not alter performanceComparing Summary
|
|
When applying this, we should make sure that we signal to the user clearly that we prefer x64_86 over aarch64 and how to revert that, both on automatic installation and on |
As in uv should print messages whenever it detected it was doing this, or a public marketing campaign? |
|
Also wanna note, we don't really need to land this until we go to update to a PBS that ships arm64 windows builds, so there's no rush to land this. I don't think we have any reports of users installing system intel and arm64 pythons on windows and getting mad uv isn't picking the intel one (but this PR would change that). |
|
We should print a note when uv installs a managed Python interpreter that is not native and not explicitly requested as non-native by the user. |
311814a to
bc0dac8
Compare
|
Pushed up a fixed impl with the requested diagnostic (zanie wanted a note, not a warning). |
|
Can we add a test case for this? Like the macOS emulated one? We don't run the test suite on arm Windows though, so that's kind of annoying. Maybe better as a follow-up, though we could at least write a janky integration test with a bash assertion in CI? Like |
I was planning to explore testing more when we PR the PBS update that adds windows releases. |
|
That makes sense, though I'd double check we have existing test coverage to ensure this doesn't "break" anything (we do have a couple CI jobs covering aarch64 windows) |
|
Added a "aarch64 on aarch64 windows" smoketest to go with the "x64 on aarch64" one |
4ea8c94 to
eb2eddf
Compare
…#15027) Addresses this outstanding item from a previous review #13724 (comment) I'm interested in this now for consolidating some logic in #12731
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?
and prefer emulated x64 windows in its stead.
This is preparatory work for shipping support for uv downloading and installing aarch64 (arm64) windows Pythons. We've had builds for this platform ready for a while, but have held back on shipping them due to a fundamental problem:
The Python packaging ecosystem does not have strong support for aarch64 windows, e.g., not many projects build aarch64 wheels yet. The net effect of this is that, if we handed you an aarch64 python interpreter on windows, you would have to build a lot more sdists, and there's a high chance you will simply fail to build that sdist and be sad.
Yes unfortunately, in this case a non-native Python interpreter simply works better than the native one... in terms of working at all, today. Of course, if the native interpreter works for your project, it should presumably have better performance and platform compatibility.
We do not want to stand in the way of progress, as ideally this situation is a temporary state of affairs as the ecosystem grows to support aarch64 windows. To enable progress, on aarch64 Windows builds of uv:
PATHor the only installed version.We're coordinating with Microsoft, GitHub (for the
setup-pythonaction), and the CPython team (for thepython.orginstallers), to ensure we're aligned on this default and the timing of toggling to prefer native distributions in the future.See discussion in
This is an alternative to
which uses sorting rather than filtering, as discussed in
uv python list#13721