fix(python): use native ARM64 precompiled Python on Windows ARM#8961
fix(python): use native ARM64 precompiled Python on Windows ARM#8961
Conversation
Greptile SummaryThis PR fixes a bug where mise was always downloading x86_64 Python on Windows, even when running on ARM64 hardware. The fix changes the condition in Confidence Score: 5/5This PR is safe to merge — it is a targeted, well-tested bug fix with no regressions expected. The change is minimal and focused: one condition tweak ( No files require special attention.
|
| Filename | Overview |
|---|---|
| src/plugins/core/python.rs | Extracts resolve_python_arch to fix ARM64 Windows Python download and adds unit tests covering all major OS/arch combinations. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[python_arch settings] --> B{precompiled_arch\noverride set?}
B -- yes --> C[return override]
B -- no --> D[settings.arch]
D --> E[resolve_python_arch os arch]
E --> F{normalize arch}
F -- x64 --> G[x86_64]
F -- arm64 --> H[aarch64]
F -- other --> I[other]
G & H & I --> J{os == windows?}
J -- yes, arch != aarch64 --> K[return x86_64]
J -- yes, arch == aarch64 --> L[return aarch64\nnative ARM64 ✅]
J -- no, os == linux\n&& arch == x86_64 --> M{CPU feature flags}
M --> N[x86_64 / x86_64_v2\n/ x86_64_v3 / x86_64_v4]
J -- no, other --> O[return arch as-is]
Reviews (2): Last reviewed commit: "fix(python): use native ARM64 precompile..." | Re-trigger Greptile
There was a problem hiding this comment.
Code Review
This pull request refactors the Python architecture resolution logic into a standalone function, resolve_python_arch, and introduces unit tests to verify its behavior across different operating systems. A review comment suggests simplifying the conditional logic for Windows architecture detection to improve code clarity.
| other => other, | ||
| }; | ||
| if cfg!(windows) { | ||
| if os == "windows" && arch != "aarch64" { |
There was a problem hiding this comment.
The condition os == "windows" && arch != "aarch64" is slightly redundant because resolve_python_arch is called with arch already mapped to aarch64 if it was arm64. While correct, it could be simplified to os == "windows" && arch == "x86_64" for clarity, assuming x86_64 is the only non-aarch64 architecture expected on Windows.
1e5d158 to
7ca6334
Compare
### 🐛 Bug Fixes - **(python)** use native ARM64 precompiled Python on Windows ARM by @JohanLorenzo in [#8961](#8961) ### New Contributors - @JohanLorenzo made their first contribution in [#8961](#8961)
Hi there! 👋 Thank you so much for quickly accepting and releasing jdx/mise#8961. I truly appreciate it and I got to use it already 🙂 I'm converting a personal project from pre-commit to hk and I stumbled upon an issue with `git lfs`. git-lfs hooks (`post-checkout`, `post-merge`, `pre-push`) need the arguments that git passes to the hook script. Without this PR, `git lfs post-checkout` fails with "This should be run through Git's post-checkout hook." ## Summary - Adds a `{{ hook_args }}` template variable that forwards git hook arguments to step commands - The generated hook scripts now pass `$*` via `HK_HOOK_ARGS` env var instead of positional args - All hook handlers (generic, pre-commit, pre-push, commit-msg, prepare-commit-msg) read `HK_HOOK_ARGS` and insert it into the template context With this change, users can configure git-lfs integration in `hk.pkl`: ```pkl hooks { ["post-checkout"] { steps { ["git-lfs"] { check = "git lfs post-checkout {{ hook_args }}" } } } ["post-merge"] { steps { ["git-lfs"] { check = "git lfs post-merge {{ hook_args }}" } } } ["pre-push"] { steps { ["git-lfs"] { check = "git lfs pre-push {{ hook_args }}" } } } } ``` Let me know what you think!
Hello there! 👋
First and foremost, thank you for creating and actively developing
mise! 😃 I discovered it through this HackerNews post and I've used it for a personal project since then. By the way, I'm genuinely impressed by how many releases you ship every now and then 👍Today, I wanted to run my python project on Windows ARM64, and this happened:
I saw the resulting failure when trying to load an ARM64 DLL from the downloaded x86_64 Python:
This fix change the downloaded python into: