Skip to content

Commit c2e5871

Browse files
committed
Merge branch 'main' into konsti/invalid-git-urls
2 parents 91e7fcd + 8c3a6b2 commit c2e5871

File tree

38 files changed

+1224
-79
lines changed

38 files changed

+1224
-79
lines changed

CHANGELOG.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
<!-- prettier-ignore-start -->
44

5+
## 0.6.1
6+
7+
### Enhancements
8+
9+
- Allow users to mark platforms as "required" for wheel coverage ([#10067](https://github.com/astral-sh/uv/pull/10067))
10+
- Warn for builds in non-build and workspace root pyproject.toml ([#11394](https://github.com/astral-sh/uv/pull/11394))
11+
12+
### Bug fixes
13+
14+
- Add `--all` to `uvx --reinstall` message ([#11535](https://github.com/astral-sh/uv/pull/11535))
15+
- Fallback to `GET` on HTTP 400 when attempting to use range requests for wheel download ([#11539](https://github.com/astral-sh/uv/pull/11539))
16+
- Prefer local variants in preference selection ([#11546](https://github.com/astral-sh/uv/pull/11546))
17+
- Respect verbatim executable name in `uvx` ([#11524](https://github.com/astral-sh/uv/pull/11524))
18+
19+
### Documentation
20+
21+
- Add documentation for required environments ([#11542](https://github.com/astral-sh/uv/pull/11542))
22+
- Note that `main.py` used to be `hello.py` ([#11519](https://github.com/astral-sh/uv/pull/11519))
23+
524
## 0.6.0
625

726
There have been 31 releases and 1135 pull requests since [0.5.0](https://github.com/astral-sh/uv/releases/tag/0.5.0), our last release with breaking changes. As before, we've accumulated various changes that improve correctness and user experience, but could break some workflows. This release contains those changes; many have been marked as breaking out of an abundance of caution. We expect most users to be able to upgrade without making changes.
@@ -24,18 +43,18 @@ There have been 31 releases and 1135 pull requests since [0.5.0](https://github.
2443

2544
- **Error on non-existent extras, e.g., in `uv sync`** ([#11426](https://github.com/astral-sh/uv/pull/11426))
2645

27-
Previously, uv would silently ignore non-existent extras requested on the command-line (e.g., via `uv sync --extra foo`). This is _generally_ correct behavior when resolving requests for package extras, because an extra may be present on one compatible version of a package but not another. However, this flexibility doesn't need to apply to the local project and it's less surprising to error here.
46+
Previously, uv would silently ignore non-existent extras requested on the command-line (e.g., via `uv sync --extra foo`). This is *generally* correct behavior when resolving requests for package extras, because an extra may be present on one compatible version of a package but not another. However, this flexibility doesn't need to apply to the local project and it's less surprising to error here.
2847

2948
- **Error on missing dependency groups when `--frozen` is provided** ([#11499](https://github.com/astral-sh/uv/pull/11499))
3049

3150
Previously, uv would not validate that the requested dependency groups were present in the lockfile when the `--frozen` flag was used. Now, an error will be raised if a requested dependency group is not present.
3251

3352
- **Change `-p` to a `--python` alias in `uv pip compile`** ([#11486](https://github.com/astral-sh/uv/pull/11486))
3453

35-
In `uv pip compile`, `-p` was an alias for `--python-version` while everywhere else in uv's interface it is an alias for `--python`. Additionally, `uv pip compile` did not respect the `UV_PYTHON` environment variable. Now, the semantics of this flag have been updated for parity with the rest of the CLI.
36-
54+
In `uv pip compile`, `-p` was an alias for `--python-version` while everywhere else in uv's interface it is an alias for `--python`. Additionally, `uv pip compile` did not respect the `UV_PYTHON` environment variable. Now, the semantics of this flag have been updated for parity with the rest of the CLI.
55+
3756
However, `--python-version` is unique: if we cannot find an interpreter with the given version, we will not fail. Instead, we'll use an alternative interpreter and override its version tags with the requested version during package resolution. This behavior is retained here for backwards compatibility, `--python <version>` / `-p <version>` will not fail if the version cannot be found. However, if a specific interpreter is requested, e.g., with `--python <path>` or `--python pypy`, and cannot be found — uv will exit with an error.
38-
57+
3958
The breaking changes here are that `UV_PYTHON` is respected and `--python <version>` will no longer fail if the version cannot be found.
4059

4160
- **Bump `alpine` default tag to 3.21 for derived Docker images** ([#11157](https://github.com/astral-sh/uv/pull/11157))
@@ -89,3 +108,4 @@ See [changelogs/0.2.x](./changelogs/0.2.x.md)
89108
See [changelogs/0.1.x](./changelogs/0.1.x.md)
90109

91110
<!-- prettier-ignore-end -->
111+

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/uv-build-frontend/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ uv-python = { workspace = true }
2828
uv-static = { workspace = true }
2929
uv-types = { workspace = true }
3030
uv-virtualenv = { workspace = true }
31+
uv-warnings = { workspace = true }
3132

3233
anstream = { workspace = true }
3334
fs-err = { workspace = true }

crates/uv-build-frontend/src/lib.rs

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
55
mod error;
66

7-
use fs_err as fs;
8-
use indoc::formatdoc;
9-
use itertools::Itertools;
10-
use rustc_hash::FxHashMap;
11-
use serde::de::{value, IntoDeserializer, SeqAccess, Visitor};
12-
use serde::{de, Deserialize, Deserializer};
137
use std::ffi::OsString;
148
use std::fmt::Formatter;
159
use std::fmt::Write;
@@ -20,6 +14,13 @@ use std::rc::Rc;
2014
use std::str::FromStr;
2115
use std::sync::LazyLock;
2216
use std::{env, iter};
17+
18+
use fs_err as fs;
19+
use indoc::formatdoc;
20+
use itertools::Itertools;
21+
use rustc_hash::FxHashMap;
22+
use serde::de::{value, IntoDeserializer, SeqAccess, Visitor};
23+
use serde::{de, Deserialize, Deserializer};
2324
use tempfile::TempDir;
2425
use tokio::io::AsyncBufReadExt;
2526
use tokio::process::Command;
@@ -36,6 +37,7 @@ use uv_pypi_types::{Requirement, VerbatimParsedUrl};
3637
use uv_python::{Interpreter, PythonEnvironment};
3738
use uv_static::EnvVars;
3839
use uv_types::{AnyErrorBuild, BuildContext, BuildIsolation, BuildStack, SourceBuildTrait};
40+
use uv_warnings::warn_user_once;
3941

4042
pub use crate::error::{Error, MissingHeaderCause};
4143

@@ -49,20 +51,22 @@ static DEFAULT_BACKEND: LazyLock<Pep517Backend> = LazyLock::new(|| Pep517Backend
4951
});
5052

5153
/// A `pyproject.toml` as specified in PEP 517.
52-
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
54+
#[derive(Deserialize, Debug)]
5355
#[serde(rename_all = "kebab-case")]
5456
struct PyProjectToml {
5557
/// Build-related data
5658
build_system: Option<BuildSystem>,
5759
/// Project metadata
5860
project: Option<Project>,
61+
/// Tool configuration
62+
tool: Option<Tool>,
5963
}
6064

6165
/// The `[project]` section of a pyproject.toml as specified in PEP 621.
6266
///
6367
/// This representation only includes a subset of the fields defined in PEP 621 necessary for
6468
/// informing wheel builds.
65-
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
69+
#[derive(Deserialize, Debug)]
6670
#[serde(rename_all = "kebab-case")]
6771
struct Project {
6872
/// The name of the project
@@ -75,7 +79,7 @@ struct Project {
7579
}
7680

7781
/// The `[build-system]` section of a pyproject.toml as specified in PEP 517.
78-
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
82+
#[derive(Deserialize, Debug)]
7983
#[serde(rename_all = "kebab-case")]
8084
struct BuildSystem {
8185
/// PEP 508 dependencies required to execute the build system.
@@ -86,6 +90,18 @@ struct BuildSystem {
8690
backend_path: Option<BackendPath>,
8791
}
8892

93+
#[derive(Deserialize, Debug)]
94+
#[serde(rename_all = "kebab-case")]
95+
struct Tool {
96+
uv: Option<ToolUv>,
97+
}
98+
99+
#[derive(Deserialize, Debug)]
100+
#[serde(rename_all = "kebab-case")]
101+
struct ToolUv {
102+
workspace: Option<de::IgnoredAny>,
103+
}
104+
89105
impl BackendPath {
90106
/// Return an iterator over the paths in the backend path.
91107
fn iter(&self) -> impl Iterator<Item = &str> {
@@ -514,8 +530,40 @@ impl SourceBuild {
514530
requirements,
515531
}
516532
} else {
517-
// If a `pyproject.toml` is present, but `[build-system]` is missing, proceed with
518-
// a PEP 517 build using the default backend, to match `pip` and `build`.
533+
// If a `pyproject.toml` is present, but `[build-system]` is missing, proceed
534+
// with a PEP 517 build using the default backend (`setuptools`), to match `pip`
535+
// and `build`.
536+
//
537+
// If there is no build system defined and there is no metadata source for
538+
// `setuptools`, warn. The build will succeed, but the metadata will be
539+
// incomplete (for example, the package name will be `UNKNOWN`).
540+
if pyproject_toml.project.is_none()
541+
&& !source_tree.join("setup.py").is_file()
542+
&& !source_tree.join("setup.cfg").is_file()
543+
{
544+
// Give a specific hint for `uv pip install .` in a workspace root.
545+
let looks_like_workspace_root = pyproject_toml
546+
.tool
547+
.as_ref()
548+
.and_then(|tool| tool.uv.as_ref())
549+
.and_then(|tool| tool.workspace.as_ref())
550+
.is_some();
551+
if looks_like_workspace_root {
552+
warn_user_once!(
553+
"`{}` appears to be a workspace root without a Python project; \
554+
consider using `uv sync` to install the workspace, or add a \
555+
`[build-system]` table to `pyproject.toml`",
556+
source_tree.simplified_display().cyan(),
557+
);
558+
} else {
559+
warn_user_once!(
560+
"`{}` does not appear to be a Python project, as the `pyproject.toml` \
561+
does not include a `[build-system]` table, and neither `setup.py` \
562+
nor `setup.cfg` are present in the directory",
563+
source_tree.simplified_display().cyan(),
564+
);
565+
};
566+
}
519567
default_backend.clone()
520568
};
521569
Ok((backend, pyproject_toml.project))

crates/uv-python/download-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
"minor": 14,
204204
"patch": 0,
205205
"prerelease": "a5",
206-
"url": "https://github.com/astral-sh/python-build-standalone/releases/download/20250212/cpython-3.14.0a5%2B20250212-i686-pc-windows-msvc-shared-install_only_stripped.tar.gz",
206+
"url": "https://github.com/astral-sh/python-build-standalone/releases/download/20250212/cpython-3.14.0a5%2B20250212-i686-pc-windows-msvc-install_only_stripped.tar.gz",
207207
"sha256": "5851a9e6a6afa698fa3ee5b678dff96e612f47e5e2c2f0c032f7c48d42f6a1ac",
208208
"variant": null
209209
},

crates/uv-python/fetch-download-metadata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ async def _fetch_downloads(self, pages: int = 100) -> list[PythonDownload]:
244244
if not rows:
245245
break
246246
for row in rows:
247+
# Sort the assets to ensure deterministic results
248+
row["assets"].sort(key=lambda asset: asset["browser_download_url"])
247249
for asset in row["assets"]:
248250
url = asset["browser_download_url"]
249251
download = self._parse_download_url(url)

crates/uv-python/src/downloads.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub(crate) const PYTHON_DOWNLOADS: &[ManagedPythonDownload] = &[
239239
libc: Libc::None,
240240
variant: PythonVariant::Default
241241
},
242-
url: "https://github.com/astral-sh/python-build-standalone/releases/download/20250212/cpython-3.14.0a5%2B20250212-i686-pc-windows-msvc-shared-install_only_stripped.tar.gz",
242+
url: "https://github.com/astral-sh/python-build-standalone/releases/download/20250212/cpython-3.14.0a5%2B20250212-i686-pc-windows-msvc-install_only_stripped.tar.gz",
243243
sha256: Some("5851a9e6a6afa698fa3ee5b678dff96e612f47e5e2c2f0c032f7c48d42f6a1ac")
244244
},
245245
ManagedPythonDownload {

crates/uv-scripts/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ pub struct ToolUv {
331331
pub top_level: ResolverInstallerOptions,
332332
pub override_dependencies: Option<Vec<uv_pep508::Requirement<VerbatimParsedUrl>>>,
333333
pub constraint_dependencies: Option<Vec<uv_pep508::Requirement<VerbatimParsedUrl>>>,
334+
pub build_constraint_dependencies: Option<Vec<uv_pep508::Requirement<VerbatimParsedUrl>>>,
334335
pub sources: Option<BTreeMap<PackageName, Sources>>,
335336
}
336337

crates/uv-settings/src/settings.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ pub struct Options {
107107
#[cfg_attr(feature = "schemars", schemars(skip))]
108108
pub constraint_dependencies: Option<Vec<Requirement<VerbatimParsedUrl>>>,
109109

110+
#[cfg_attr(feature = "schemars", schemars(skip))]
111+
pub build_constraint_dependencies: Option<Vec<Requirement<VerbatimParsedUrl>>>,
112+
110113
#[cfg_attr(feature = "schemars", schemars(skip))]
111114
pub environments: Option<SupportedEnvironments>,
112115

@@ -1792,6 +1795,7 @@ pub struct OptionsWire {
17921795
// They're respected in both `pyproject.toml` and `uv.toml` files.
17931796
override_dependencies: Option<Vec<Requirement<VerbatimParsedUrl>>>,
17941797
constraint_dependencies: Option<Vec<Requirement<VerbatimParsedUrl>>>,
1798+
build_constraint_dependencies: Option<Vec<Requirement<VerbatimParsedUrl>>>,
17951799
environments: Option<SupportedEnvironments>,
17961800
required_environments: Option<SupportedEnvironments>,
17971801

@@ -1858,6 +1862,7 @@ impl From<OptionsWire> for Options {
18581862
cache_keys,
18591863
override_dependencies,
18601864
constraint_dependencies,
1865+
build_constraint_dependencies,
18611866
environments,
18621867
required_environments,
18631868
conflicts,
@@ -1922,6 +1927,7 @@ impl From<OptionsWire> for Options {
19221927
cache_keys,
19231928
override_dependencies,
19241929
constraint_dependencies,
1930+
build_constraint_dependencies,
19251931
environments,
19261932
required_environments,
19271933
install_mirrors: PythonInstallMirrors::resolve(

crates/uv-version/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "uv-version"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
edition = { workspace = true }
55
rust-version = { workspace = true }
66
homepage = { workspace = true }

0 commit comments

Comments
 (0)