Skip to content

Conversation

@EliteTK
Copy link
Contributor

@EliteTK EliteTK commented Dec 11, 2025

Summary

Implement #16408.

Currently doesn't avoid recompiling the bytecode when it is already compiled, which I initially thought could be fine but then realised that it would be annoying if you have the environment variable set.

Covers upgrades, installs, reinstalls, and compiling existing installs. But not certain about the UX.

pyodide is weird and currently gets skipped by the heuristic I came up with.

Test Plan

Styling of the status report was manually tested, there is a new test for testing the actual functionality.

@EliteTK EliteTK requested a review from konstin December 11, 2025 16:37
@EliteTK EliteTK temporarily deployed to uv-test-registries December 11, 2025 16:41 — with GitHub Actions Inactive
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 11, 2025

CodSpeed Performance Report

Merging #17088 will not alter performance

Comparing tk/py-install-bytecomp (cdf398c) with main (936da00)

Summary

✅ 5 untouched

@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from 5644a1b to d08b115 Compare December 11, 2025 17:06
@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from d08b115 to cc0d3f9 Compare December 11, 2025 17:08
@EliteTK EliteTK temporarily deployed to uv-test-registries December 11, 2025 17:11 — with GitHub Actions Inactive
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Looks good! Added some smaller comments.

@konstin konstin added the enhancement New feature or improvement to existing functionality label Dec 14, 2025
@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from cc0d3f9 to 6c39c61 Compare December 16, 2025 18:02
@EliteTK EliteTK temporarily deployed to uv-test-registries December 16, 2025 18:04 — with GitHub Actions Inactive
@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from 6c39c61 to 7cc9212 Compare December 16, 2025 18:13
@EliteTK EliteTK temporarily deployed to uv-test-registries December 16, 2025 18:15 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 16, 2025 18:31 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 12:55 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 14:01 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 14:10 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 14:24 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 14:53 — with GitHub Actions Inactive
@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from ee3a32b to 03d0b75 Compare December 17, 2025 15:33
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 15:39 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 17:07 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 17, 2025 17:30 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 18, 2025 10:43 — with GitHub Actions Inactive
Comment on lines 1193 to 1195
warn_user_once!(
"Standard library bytecode compilation is not supported for pyodide"
);
Copy link
Member

Choose a reason for hiding this comment

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

This could be pretty annoying if UV_COMPILE_BYTECODE is just set globally? I think we usually want warnings to be actionable, and this one isn't really. I might just move this into verbose logs?

Copy link
Member

Choose a reason for hiding this comment

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

We could differentiate between explicit --compile-bytecode and implicit UV_COMPILE_BYTECODE as we just did for UV_GIT_LFS, I guess. Then the action is "remove the flag", but it's weird if you do

uv python install cpython-3.12 pyodide-3.12 --compile-bytecode

Copy link
Member

Choose a reason for hiding this comment

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

(also discussed a bit in #17088 (comment))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had spoken about the warnings stuff with konsti yesterday, see the new commit, maybe that's better?

);
if explicit_request {
warn_user!(
"Skipping standard library bytecode compilation for {} as it misreported its location.",
Copy link
Member

Choose a reason for hiding this comment

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

What does it mean for it to have "misreported its location"? I don't think this will make sense to a user. What action can they take to resolve this?

Copy link
Member

@konstin konstin Jan 6, 2026

Choose a reason for hiding this comment

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

Talk to us and/or the maintainer of that Python distribution to get that sysconfig fixed, otherwise it's just silently broken.

@EliteTK EliteTK temporarily deployed to uv-test-registries December 18, 2025 13:46 — with GitHub Actions Inactive
@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from 19ce460 to 9755976 Compare December 29, 2025 14:20
@EliteTK EliteTK temporarily deployed to uv-test-registries December 29, 2025 14:22 — with GitHub Actions Inactive
@EliteTK EliteTK temporarily deployed to uv-test-registries December 29, 2025 14:27 — with GitHub Actions Inactive
@EliteTK EliteTK force-pushed the tk/py-install-bytecomp branch from 6e1e99b to cdf398c Compare December 29, 2025 14:56
@EliteTK EliteTK temporarily deployed to uv-test-registries December 29, 2025 14:58 — with GitHub Actions Inactive
@EliteTK EliteTK requested review from konstin and zanieb December 30, 2025 18:25
@EliteTK EliteTK merged commit 4513797 into main Jan 12, 2026
102 checks passed
@EliteTK EliteTK deleted the tk/py-install-bytecomp branch January 12, 2026 09:31
zaniebot pushed a commit to zaniebot/uv that referenced this pull request Jan 14, 2026
Identifies that PR astral-sh#17088 (--compile-bytecode feature) introduced cache
initialization for `uv python install`, which breaks Docker builds when
HOME is unset or set to "/".

The cache directory falls back to /.cache/uv which requires root permissions.
In v0.9.24, uv python install did not initialize the cache at all.
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 17, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.24` → `0.9.26` |

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.9.26`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0926)

[Compare Source](astral-sh/uv@0.9.25...0.9.26)

Released on 2026-01-15.

##### Python

- Add CPython 3.15.0a5

##### Enhancements

- Add a hint to update uv when a managed Python download is not found ([#&#8203;17461](astral-sh/uv#17461))
- Improve cache initialization failure error message ([#&#8203;17469](astral-sh/uv#17469))
- Improve error message for abi3 wheels on free-threaded Python ([#&#8203;17442](astral-sh/uv#17442))
- Add support for `--no-sources-package` ([#&#8203;14910](astral-sh/uv#14910))

##### Preview features

- Add `METADATA.json` and `WHEEL.json` in uv build backend ([#&#8203;15510](astral-sh/uv#15510))
- Add support for GCS request signing ([#&#8203;17474](astral-sh/uv#17474))
- Adjust the process ulimit to the maximum allowed on startup ([#&#8203;17464](astral-sh/uv#17464))

##### Bug fixes

- Lock to avoid concurrent refresh of pyx tokens ([#&#8203;17479](astral-sh/uv#17479))

##### Documentation

- Add linting and formatting instructions to the CONTRIBUTING guide ([#&#8203;17470](astral-sh/uv#17470))
- Avoid rendering `pyproject.toml` examples for more system-level settings ([#&#8203;17462](astral-sh/uv#17462))

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

[Compare Source](astral-sh/uv@0.9.24...0.9.25)

Released on 2026-01-13.

##### Python

- Add CPython 3.15.0a4
- Upgrade Tcl/Tk used by CPython to 9.0

##### Enhancements

- Add `--compile-bytecode` to `uv python install` and `uv python upgrade` to compile the standard library ([#&#8203;17088](astral-sh/uv#17088))
- Allow disabling `exclude-newer` per package ([#&#8203;16854](astral-sh/uv#16854))
- Broadcast `WM_SETTINGCHANGE` on `uv tool update-shell` ([#&#8203;17404](astral-sh/uv#17404))

##### Preview features

- Detect workspace from `uv run` target ([#&#8203;17423](astral-sh/uv#17423))

##### Bug fixes

- Avoid unwrapping size for file responses ([#&#8203;17434](astral-sh/uv#17434))
- Use keyring authentication when retrieving `tool@latest` version ([#&#8203;17448](astral-sh/uv#17448))
- Use latest Pyodide version for each python version ([#&#8203;17372](astral-sh/uv#17372))
- Improve trampoline file handle closing ([#&#8203;17374](astral-sh/uv#17374))
- Fix error message when installing musl python on armv7 ([#&#8203;17213](astral-sh/uv#17213))

</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:eyJjcmVhdGVkSW5WZXIiOiI0Mi44MC4xIiwidXBkYXRlZEluVmVyIjoiNDIuODEuOCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants