Repository navigation
Release 0.12.0 - #20355
Release 0.12.0#20355
Conversation
ef58871 to
a1fb995
Compare
uv test inventory changesThis PR changes the tests when compared with the
|
Merging this PR will degrade performance by 5.53%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | resolve_warm_jupyter_universal |
121.6 ms | 128.7 ms | -5.53% |
Tip
Investigate this regression with the CodSpeed MCP and your agent.
Comparing release/0.12.0 (6ff71ad) with main (b6359fe)
Footnotes
-
6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Revert #20402. Older uv versions could emit `pylock.toml` files without the required `packages` array; #20145 only recently corrected that emission. Rejecting those existing files in a non-breaking release would make previously generated lockfiles unusable. #20402 has been moved to #20355 as ace867f Co-authored-by: Zanie Blue <[email protected]>
Prior to this change, we needed to know upfront whether a given package was "allowed" to use a pre-release -- either by way of being a first-party dependency with a pre-release marker on it (e.g., `flask >= 2.0.0a0`), or by _only_ having pre-releases available on PyPI at all, or by the user _always_ allowing pre-releases via configuration. By default, if transitive metadata later introduced a requirement like `foo>=2.0.0b1`, that requirement did _not_ enable pre-releases for `foo`, even though it should've (per the spec). This PR adds support for actual transitive pre-release requirements: we prefer stable candidates that satisfy the current range, then consider pre-releases when those candidates are exhausted. An explicit pre-release requirement discovered during resolution is represented by a PubGrub proxy package. For completeness, I also prototyped a [nab](https://github.com/notatallshaw/nab)-style solution in #19998. That design encoded stable- and pre-release-enabled variants directly in PubGrub. It's arguably semantically nicer, but it was much more invasive and caused more significant CodSpeed regressions on large graphs. I ultimately decided that this solution is better for now, given that it's both simpler and closer to how we model versions today. This smaller, proxy-package solution does get at least one case wrong. If a selected stable version of package A satisfies requirements, and we then find a package that depends on A with a pre-release, PubGrub may retain that version instead of "upgrading" it to a newer pre-release. The net effect is that we may accept an older stable release rather than upgrading to a newer pre-release if we see a pre-release requirement later on in a solve. I think this is an acceptable limitation as compared to the number of issues we'll be able to close here. And nab suffers from some similar issues (as per #19993 (comment)). Finally, the former `--prerelease=explicit` policy has been deprecated. `explicit` is the only mode we can't support here, because it requires adding pre-release candidates after resolution has already begun. The behavior is preserved, but unlike the other modes, it doesn't support transitive pre-releases (i.e., it's ~unchanged vs. main). Personally, I don't think that `explicit` vs. `if-necessary-or-explicit` is really an important distinction. Related: #3602. Related: #14851. Closes #19593. Closes #2685. Closes #11483. Closes #19324. Closes #12589. Closes #9395. Closes #16494. Closes #16893.
## Summary Right now, we log a warning but proceed, which means we're effectively ignoring the `--require-hashes` directive (if you're not careful to watch for warnings). This can be considered breaking because workflows that previously passed may now fail. Co-authored-by: Codex <[email protected]>
## Summary - suppress the excluded-package footer when `uv pip compile --no-annotate` is used - keep the existing footer behavior when annotations are enabled - add coverage for `--unsafe-package` combined with `--no-annotate` Closes #19948. Co-authored-by: wzp <[email protected]>
## Summary Follow-up to #18176. This fixes the remaining absolute/relative path issues when `uv add` edits `pyproject.toml`. `uv add` now preserves the user's path form: - Relative paths remain relative. - Absolute paths and literal `file://` URLs remain absolute. - URLs containing expanded variables remain relative, preserving the portability behavior from #18680 for both named and unnamed requirements. This applies to local directories and local archives. * Closes #17307 * Closes #17316 ## Test Plan - Integration coverage for relative paths, absolute paths, and literal `file://` URLs. - Integration coverage for directory and archive sources. - Regression coverage for expanded-variable URLs. - `cargo nextest run -E 'test(add_relative_and_absolute_paths) or test(add_relative_and_absolute_archives) or test(lock_pep508_urls_with_vars)'` - `cargo nextest run -p uv-pep508 -p uv-pypi-types` - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` - `cargo xwin clippy --workspace --all-targets --all-features --locked -- -D warnings`
## Summary > Note: Not sure if this is bug or enhancement. Someone help. While perusing the code I noticed this confusing TODO about `uv python install --reinstall`. In #11072 we changed `uv python install --reinstall` to reinstall all existing Python installations except when a specific minor version was passed, in which case we would instead install the latest available patch. This was justified due to having no `--upgrade` at the time. Then in #16676 we introduced `uv python install --upgrade` but we didn't change the `--reinstall` behaviour. So we now had two ways to do this one thing, but no way to re-install only specific versions. This PR completes the deferred change to `--reinstall`. That's the first commit. The second commit restores the behaviour of `--reinstall --upgrade`, which install or reinstalls the latest patch only, not sure if this is a desirable combo, but it _did_ work in the past and I didn't know if it should break too. Without the special case `--reinstall` takes precedence and `--upgrade` is ignored. This change seems breaking. It's currently just dropped right in (maybe 0.12.0?) but I'm also open to putting it behind a preview flag and adding some warnings. ## Test Plan Test adjustments, to match/test the new behaviours.
## Summary ~~WIP.~~ This removes the bzip2/lzma/xz features from our backing ZIP dependencies, per our long term plans to not support these compression schemes (as they're not standard parts of Python packaging). ~~This doesn't remove the similar paths from tarball handling, yet.~~ This is a breaking change, so it probably shouldn't be merged until we're ready to cut 0.12. See #16911 for context. ## Test Plan Will update the snapshot tests. --------- Signed-off-by: William Woodruff <[email protected]>
## Summary Add pip-compatible `--cert <path>` support to all `uv pip` commands. The option is scoped to the `uv pip` namespace, so other uv commands continue to reject it. An explicit certificate bundle replaces uv's default, system, and `SSL_CERT_FILE` / `SSL_CERT_DIR` trust sources for that invocation, matching pip's behavior without modifying the environment inherited by child processes. Preserve newer release-branch TLS alert regression tests and update the restored certificate snapshots to the current output format.
A pylock.toml missing the required packages array is treated as an empty lock, so sync can uninstall an environment instead of rejecting malformed input. Require the array during deserialization while continuing to accept an explicitly empty array. See [the pylock.toml packages specification](https://packaging.python.org/en/latest/specifications/pylock-toml/#packages).
A `pylock.toml` artifact can declare an incorrect `size` and still install when its hash is correct, despite the [`pylock.toml` installation specification](https://packaging.python.org/en/latest/specifications/pylock-toml/#installation) requiring size checks when present. Validate declared sizes for local, remote, and cached wheels, source distributions, and archives before installation, while continuing to treat registry-reported sizes as advisory. This is breaking for locks with stale sizes that were accepted by installers such as [pip, which currently leaves file-size validation unimplemented](https://github.com/pypa/pip/blob/main/src/pip/_internal/req/constructors.py#L590-L605). Regenerate the lock or remove the stale optional `size`; pre-existing cache entries without recorded sizes will refresh.
Closes #20185. Stabilize the eight preview features planned for uv 0.12, making their preview behavior the default and removing the transitional warnings and code paths: - `adjust-ulimit`: raise the open-file limit on Linux and macOS at startup. - `init-project-flag`: reject `uv init --project` instead of warning. - `project-directory-must-exist`: reject missing or non-directory `--project` paths immediately. - `publish-require-normalized`: skip wheels and source distributions with non-normalized filenames. - `special-conda-env-names`: use path-based detection for Conda environments named `base` or `root`. - `target-workspace-discovery`: discover the project or workspace from a target script's directory instead of the current working directory. - `toml-backwards-compatibility`: always rewrite the source-distribution `pyproject.toml` to TOML 1.0-compatible syntax and preserve the original as `pyproject.toml.orig`, removing the now-unneeded TOML 1.1 detector and dependencies. - `venv-safe-clear`: reject `uv venv --clear` on a non-virtual-environment directory unless `--force` is provided. Update the corresponding snapshots and remove redundant preview-only tests and branches. --------- Co-authored-by: konsti <[email protected]>
Prepare the changes when stabilizing package by default, as a preview how this looks after stabilization. I've updated the snapshots of other `uv init`-using test to using packaged projects (separate commit), they don't seem to be testing unpacked cases specifically and using the defaults seems the most realistic choice for them. To be merged with the next breaking release.
…ry` if provided (#20740) ## Summary The `--directory` argument is documented to change the directory relative to which uv operates. It would therefore be expected that options and arguments with relative paths passed to uv would resolve relative to the target specified by `--directory` but this was not the case for various index arguments. This PR addresses this. For example: ``` $ uv add --directory foo --index ./bar ... ``` Would previously look for the index in `./bar` but with this PR would look for it in `./foo/bar`. I think this is actually a breaking change. > Note: I strongly recommend reviewing the commits separately. There is preparatory work which is mechanical and easier to review separately. ## Test Plan There's a show settings test which targets testing this regression.
Application and packaged application trade places, and we have to de-emphasize packaged layouts as special. This PR needs to be merged just before the release that stabilizes package by default. --------- Co-authored-by: Zsolt Dollenstein <[email protected]> Co-authored-by: Zanie Blue <[email protected]>
`uv build` currently appends `(uv build backend)` to each progress line when it uses the bundled backend, exposing an implementation detail and repeating it for source distributions and wheels. Log backend selection once at debug level instead, keeping ordinary build progress consistent across direct and PEP 517 builds. Co-authored-by: Zanie Blue <[email protected]>
When `SSL_CERT_FILE` or `SSL_CERT_DIR` points to a missing path or contains no valid certificates, uv currently falls back to its default trust roots despite the explicit certificate-source override. Treat every nonempty configured certificate source as authoritative, retaining an empty trust store when no certificates can be loaded and preserving the existing behavior for empty environment-variable values. Fixes #18526. --------- Co-authored-by: Zanie Blue <[email protected]>
Invalid names such as `pylock..toml` and `pylock.foo.bar.toml` are accepted even though the [`pylock.toml` filename specification](https://packaging.python.org/en/latest/specifications/pylock-toml/#file-name) permits only `pylock.toml` and single-name variants such as `pylock.dev.toml`. Validate the complete filename. This is breaking for existing dotted lock names, including files discovered by [Pipenv's `pylock.*.toml` glob](https://github.com/pypa/pipenv/blob/main/pipenv/utils/pylock.py#L746-L768); those files must be renamed.
Running a pip command beneath a broken child `.venv` symlink can skip that environment and modify an unrelated ancestor environment. Stop discovery at the broken link and report its exact path, preserving the actionable broken-link diagnostic introduced in [#12168](#12168). [#20333](#20333) separately allows interpreter-only commands to fall back when `.venv` is a non-venv directory; this keeps pip from taking that fallback across a broken child link.
With package-by-default enabled, `uv init --app` still implicitly selected the unpackaged application layout, so explicitly requesting an application produced a different project than `uv init`. Apply the packaged default to explicitly requested applications as well, while retaining `--no-package` for applications that should remain unpackaged. --------- Co-authored-by: Zanie Blue <[email protected]>
#20418 moved certificate overrides out of `BaseClientBuilder` and applied them to the main HTTP client. The separate client used by `uv run https://...` and GitHub Gists was left unconfigured, allowing remote scripts to fall back to the default trust store instead of respecting `SSL_CERT_FILE` and `SSL_CERT_DIR`. Apply the environment certificate overrides directly to the remote-script client before downloading. Preserve the default trust store when neither override is set, but fail closed when an explicitly configured certificate source is missing or invalid. Follow-up to the [discussion on #20418](#20418 (comment)).
Includes
--require-hashesinrequirements.txt files#19336--upgrade-grouptargets #18957uv add#18402--certsupport touv pip#20418--directoryif provided #20740.venvsymlinks and surface metadata errors #20433