You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad12342
Browse filesBrowse the repository at this point in the historyBrowse files
Add a preview feature for lazy build backend imports (#21967)
Build backend hooks run in short-lived Python processes, so importing
backend code that a hook never uses can add startup overhead. Add the
`build-lazy-imports` preview feature to invoke build hooks with `-X
lazy_imports=all` on CPython 3.15 and later. Other interpreters and
ordinary builds are unchanged. The behavior remains opt-in because
global lazy imports can affect import-time side effects in third-party
backends.
Warm wheel builds on CPython `3.15.0rc2`, using an AMD EPYC 9V74 Linux
host and uv's `profiling` profile:
| Source distribution | Backend | Normal | Lazy | Time reduction, 90% CI
|
| --- | --- | ---: | ---: | ---: |
| `six==1.17.0` | setuptools `84.0.0` | 233.5 ms | 206.0 ms | 11.8%
[11.1%, 12.4%] |
| `requests==2.32.5` | setuptools `84.0.0` | 256.6 ms | 231.2 ms | 9.9%
[8.7%, 11.1%] |
| `packaging==25.0` | Flit Core `4.0.2` | 108.7 ms | 89.7 ms | 17.5%
[16.7%, 18.3%] |
| `attrs==25.3.0` | Hatchling `1.32.0` | 172.2 ms | 152.1 ms | 11.7%
[11.4%, 12.0%] |
| `cleo==2.1.0` | Poetry Core `2.4.1` | 269.4 ms | 235.6 ms | 12.5%
[12.0%, 13.1%] |
| `pdm-backend==2.4.5` | self-hosted `pdm.backend.intree` | 164.7 ms |
136.6 ms | 17.1% [16.7%, 17.5%] |
Each case uses preinstalled build dependencies and 40 order-balanced
AB/BA pairs of `uv build --wheel --no-build-isolation --offline
--no-progress --no-sources`. Times are arithmetic means; reductions use
the geometric paired lazy/normal ratio, with two-sided 90% paired-block
bootstrap intervals from 100,000 resamples. A same-binary toggle based
on
[83d556d](83d556d)
isolates the interpreter flag; these are not exact-head measurements of
the preview-feature integration. The results cover warm pure-Python
builds, not overall `uv sync` or `uv lock` performance.
---------
Co-authored-by: zaniebot <[email protected]>
Copy file name to clipboardExpand all lines: crates/uv-dev/src/generate_preview_features_reference.rs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,8 @@ mod tests {
115
115
- <a id="azure-endpoint" href="#azure-endpoint"><code>azure-endpoint</code></a>: Allows signing requests to Azure Blob Storage endpoints with Azure credentials.
116
116
- <a id="batch-export" href="#batch-export"><code>batch-export</code></a>: Allows using `uv export --batch`.
117
117
- <a id="build-dependency-check" href="#build-dependency-check"><code>build-dependency-check</code></a>: Checks build dependencies before nonisolated builds with `uv build`.
118
+
- <a id="build-lazy-imports" href="#build-lazy-imports"><code>build-lazy-imports</code></a>: Enables lazy imports in build backend invocations on CPython 3.15 and later.
119
+
This can affect import-time side effects in third-party build backends.
118
120
- <a id="cache-physical-space" href="#cache-physical-space"><code>cache-physical-space</code></a>: Reports the physical disk space reclaimed by cache cleanup, accounting for hardlinks and copy-on-write clones.
119
121
- <a id="cache-size" href="#cache-size"><code>cache-size</code></a>: Allows using `uv cache size`.
0 commit comments