Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: astral-sh/uv
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.6.7
Choose a base ref
...
head repository: astral-sh/uv
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.6.8
Choose a head ref
  • 11 commits
  • 45 files changed
  • 5 contributors

Commits on Mar 17, 2025

  1. Avoid allocations for default cache keys (#12063)

    charliermarsh authored Mar 17, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e0f81f0 View commit details

Commits on Mar 18, 2025

  1. Allow owned string when deserializing requires-python (#12278)

    ## Summary
    
    I suspect this only affects packages with quotes in the requires-python,
    which is typically an error but one that we correct for in
    `LenientVersionSpecifiers`.
    
    Closes #12260.
    charliermarsh authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b78f929 View commit details
  2. Allow local version mismatches when validating lockfile (#12285)

    ## Summary
    
    Closes #12282.
    
    ## Test Plan
    
    Given:
    
    ```toml
    [project]
    name = "foo"
    version = "0.1.0"
    description = "Add your description here"
    readme = "README.md"
    requires-python = ">=3.13.0"
    dependencies = ["flash-attn"]
    
    [tool.uv]
    environments = ["sys_platform == 'darwin'", "sys_platform == 'linux'"]
    constraint-dependencies = ["torch==2.5.1"]
    
    [tool.uv.sources]
    flash_attn = [
      { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp310-cp310-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.10'"},
      { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp311-cp311-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.11'"},
      { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.12'"},
      { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp313-cp313-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.13'"}
    ]
    ```
    
    Ran `uv lock` on `v0.6.5`. Then verified that `uv lock` fails on
    `v0.6.6` on the same lockfile, but this commit succeeds.
    charliermarsh authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    faf16c1 View commit details
  3. Make cache errors non-fatal in Planner::build (#12281)

    Same basic approach as #11105, including a cache version bump.
    
    Fixes #12274
    Gankra authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ada1acb View commit details
  4. Un-pin maturin-action version (#12287)

    ## Summary
    
    The commit we want is in PyO3/maturin-action#330
    which is now released.
    charliermarsh authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e9d2b6e View commit details
  5. Simplify managed Python flags (#12246)

    Currently, for users to specify at the command line whether to use
    uv-managed or system Python interpreters, they use the
    `--python-preference` parameter, which takes four possible values. This
    is more complex than necessary since the normal case is to either say
    "only managed" or "not managed". This PR hides the old
    `--python-preference` parameter from help and documentation and adds two
    new flags: `--managed-python` and `--no-managed-python` to capture the
    "only managed" and "not managed" cases.
    
    I have successfully tested this locally but currently cannot add
    snapshot tests because of problems with distinguishing managed vs.
    system interpreters in CI (and non-determinism when run on different
    developers' machines). The `--python-preference` test in
    `tool-install.rs` is currently ignored for this reason. See #5144 and
    #7473.
    
    ---------
    
    Co-authored-by: Zanie Blue <contact@zanie.dev>
    jtfmumm and zanieb authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f66ce58 View commit details
  6. Update Rust crate reqwest to v0.12.15 (#12293)

    This PR contains the following updates:
    
    | Package | Type | Update | Change |
    |---|---|---|---|
    | [reqwest](https://redirect.github.com/seanmonstar/reqwest) |
    workspace.dependencies | patch | `0.12.14` -> `0.12.15` |
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>seanmonstar/reqwest (reqwest)</summary>
    
    ###
    [`v0.12.15`](https://redirect.github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v01215)
    
    [Compare
    Source](https://redirect.github.com/seanmonstar/reqwest/compare/v0.12.14...v0.12.15)
    
    -   Fix Windows to support both `ProxyOverride` and `NO_PROXY`.
    -   Fix http3 to support streaming response bodies.
    -   Fix http3 dependency from public API misuse.
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
    Automerge - At any time (no schedule defined).
    
    🚦 **Automerge**: Disabled by config. Please merge this manually once you
    are satisfied.
    
    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
    rebase/retry checkbox.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about this update
    again.
    
    ---
    
    - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
    this box
    
    ---
    
    This PR was generated by [Mend Renovate](https://mend.io/renovate/).
    View the [repository job
    log](https://developer.mend.io/github/astral-sh/uv).
    
    <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    95a9416 View commit details
  7. Update pytorch test snapshot (#12294)

    zanieb authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f390050 View commit details
  8. update ring (#12295)

    This resolves https://github.com/astral-sh/uv/security/dependabot/340
    which doesn't meaningfully affect us but dependabot is screaming about
    it nonetheless.
    Gankra authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    43966f5 View commit details
  9. add default-groups = "all" sugar to pyproject.toml (#12289)

    Suggested by @zanieb in #10934
    
    * [x] agree we want to do this
    * [x] add docs
    
    ---------
    
    Co-authored-by: Zanie Blue <contact@zanie.dev>
    Gankra and zanieb authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    26cad18 View commit details
  10. Bump version to 0.6.8 (#12297)

    zanieb authored Mar 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c1ef482 View commit details
Showing with 1,219 additions and 927 deletions.
  1. +1 −2 .github/workflows/build-binaries.yml
  2. +17 −0 CHANGELOG.md
  3. +7 −14 Cargo.lock
  4. +1 −1 crates/uv-build/Cargo.toml
  5. +1 −1 crates/uv-build/pyproject.toml
  6. +16 −11 crates/uv-cache-info/src/cache_info.rs
  7. +1 −1 crates/uv-cache/src/lib.rs
  8. +33 −9 crates/uv-cli/src/lib.rs
  9. +14 −6 crates/uv-configuration/src/dependency_groups.rs
  10. +124 −75 crates/uv-installer/src/plan.rs
  11. +62 −38 crates/uv-installer/src/satisfies.rs
  12. +6 −5 crates/uv-installer/src/site_packages.rs
  13. +82 −0 crates/uv-normalize/src/group_name.rs
  14. +1 −1 crates/uv-normalize/src/lib.rs
  15. +6 −3 crates/uv-pypi-types/src/simple_json.rs
  16. +3 −1 crates/uv-resolver/src/lock/mod.rs
  17. +7 −2 crates/uv-static/src/env_vars.rs
  18. +1 −1 crates/uv-version/Cargo.toml
  19. +5 −3 crates/uv-workspace/src/pyproject.rs
  20. +1 −1 crates/uv/Cargo.toml
  21. +2 −2 crates/uv/src/commands/project/add.rs
  22. +2 −2 crates/uv/src/commands/project/export.rs
  23. +12 −10 crates/uv/src/commands/project/mod.rs
  24. +2 −2 crates/uv/src/commands/project/run.rs
  25. +2 −2 crates/uv/src/commands/project/sync.rs
  26. +2 −1 crates/uv/src/commands/project/tree.rs
  27. +17 −4 crates/uv/src/settings.rs
  28. +1 −1 crates/uv/tests/it/cache_prune.rs
  29. +68 −77 crates/uv/tests/it/help.rs
  30. +4 −2 crates/uv/tests/it/lock.rs
  31. +41 −0 crates/uv/tests/it/pip_compile.rs
  32. +170 −0 crates/uv/tests/it/sync.rs
  33. +7 −0 docs/concepts/projects/dependencies.md
  34. +30 −11 docs/concepts/python-versions.md
  35. +9 −2 docs/configuration/environment.md
  36. +2 −2 docs/getting-started/installation.md
  37. +2 −2 docs/guides/install-python.md
  38. +2 −2 docs/guides/integration/aws-lambda.md
  39. +5 −5 docs/guides/integration/docker.md
  40. +1 −1 docs/guides/integration/github.md
  41. +5 −5 docs/guides/integration/pre-commit.md
  42. +403 −609 docs/reference/cli.md
  43. +3 −1 docs/reference/settings.md
  44. +1 −1 pyproject.toml
  45. +37 −8 uv.schema.json
3 changes: 1 addition & 2 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
@@ -301,8 +301,7 @@ jobs:

# uv
- name: "Build wheels"
# Use patch for https://github.com/PyO3/maturin-action/issues/331
uses: PyO3/maturin-action@711bb9fcefaea0b45a7d625ee2c265fd9fe7f3e5
uses: PyO3/maturin-action@36db84001d74475ad1b8e6613557ae4ee2dc3598 # v1.47.2
with:
target: ${{ matrix.target }}
manylinux: auto
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,23 @@
<!-- prettier-ignore-start -->


## 0.6.8

### Enhancements

- Add support for enabling all groups by default with `default-groups = "all"` ([#12289](https://github.com/astral-sh/uv/pull/12289))
- Add simpler `--managed-python` and `--no-managed-python` flags for toggling Python preferences ([#12246](https://github.com/astral-sh/uv/pull/12246))

### Performance

- Avoid allocations for default cache keys ([#12063](https://github.com/astral-sh/uv/pull/12063))

### Bug fixes

- Allow local version mismatches when validating lockfile ([#12285](https://github.com/astral-sh/uv/pull/12285))
- Allow owned string when deserializing `requires-python` ([#12278](https://github.com/astral-sh/uv/pull/12278))
- Make cache errors non-fatal in `Planner::build` ([#12281](https://github.com/astral-sh/uv/pull/12281))

## 0.6.7

### Python
21 changes: 7 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/uv-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uv-build"
version = "0.6.7"
version = "0.6.8"
edition.workspace = true
rust-version.workspace = true
homepage.workspace = true
2 changes: 1 addition & 1 deletion crates/uv-build/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uv-build"
version = "0.6.7"
version = "0.6.8"
description = "The uv build backend"
authors = [{ name = "Astral Software Inc.", email = "hey@astral.sh" }]
requires-python = ">=3.8"
27 changes: 16 additions & 11 deletions crates/uv-cache-info/src/cache_info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::cmp::max;
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
@@ -35,7 +36,7 @@ pub struct CacheInfo {
env: BTreeMap<String, Option<String>>,
/// The timestamp or inode of any directories that should be considered in the cache key.
#[serde(default)]
directories: BTreeMap<String, Option<DirectoryTimestamp>>,
directories: BTreeMap<Cow<'static, str>, Option<DirectoryTimestamp>>,
}

impl CacheInfo {
@@ -83,11 +84,11 @@ impl CacheInfo {
// If no cache keys were defined, use the defaults.
let cache_keys = cache_keys.unwrap_or_else(|| {
vec![
CacheKey::Path("pyproject.toml".to_string()),
CacheKey::Path("setup.py".to_string()),
CacheKey::Path("setup.cfg".to_string()),
CacheKey::Path(Cow::Borrowed("pyproject.toml")),
CacheKey::Path(Cow::Borrowed("setup.py")),
CacheKey::Path(Cow::Borrowed("setup.cfg")),
CacheKey::Directory {
dir: "src".to_string(),
dir: Cow::Borrowed("src"),
},
]
});
@@ -97,14 +98,18 @@ impl CacheInfo {
for cache_key in cache_keys {
match cache_key {
CacheKey::Path(file) | CacheKey::File { file } => {
if file.chars().any(|c| matches!(c, '*' | '?' | '[' | '{')) {
if file
.as_ref()
.chars()
.any(|c| matches!(c, '*' | '?' | '[' | '{'))
{
// Defer globs to a separate pass.
globs.push(file);
continue;
}

// Treat the path as a file.
let path = directory.join(&file);
let path = directory.join(file.as_ref());
let metadata = match path.metadata() {
Ok(metadata) => metadata,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
@@ -126,7 +131,7 @@ impl CacheInfo {
}
CacheKey::Directory { dir } => {
// Treat the path as a directory.
let path = directory.join(&dir);
let path = directory.join(dir.as_ref());
let metadata = match path.metadata() {
Ok(metadata) => metadata,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
@@ -296,11 +301,11 @@ struct ToolUv {
#[serde(untagged, rename_all = "kebab-case", deny_unknown_fields)]
pub enum CacheKey {
/// Ex) `"Cargo.lock"` or `"**/*.toml"`
Path(String),
Path(Cow<'static, str>),
/// Ex) `{ file = "Cargo.lock" }` or `{ file = "**/*.toml" }`
File { file: String },
File { file: Cow<'static, str> },
/// Ex) `{ dir = "src" }`
Directory { dir: String },
Directory { dir: Cow<'static, str> },
/// Ex) `{ git = true }` or `{ git = { commit = true, tags = false } }`
Git { git: GitPattern },
/// Ex) `{ env = "UV_CACHE_INFO" }`
2 changes: 1 addition & 1 deletion crates/uv-cache/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1000,7 +1000,7 @@ impl CacheBucket {
match self {
// Note that when bumping this, you'll also need to bump it
// in `crates/uv/tests/it/cache_prune.rs`.
Self::SourceDistributions => "sdists-v8",
Self::SourceDistributions => "sdists-v9",
Self::FlatIndex => "flat-index-v2",
Self::Git => "git-v0",
Self::Interpreter => "interpreter-v4",
42 changes: 33 additions & 9 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -134,21 +134,44 @@ pub struct TopLevelArgs {
#[command(next_help_heading = "Global options", next_display_order = 1000)]
#[allow(clippy::struct_excessive_bools)]
pub struct GlobalArgs {
/// Whether to prefer uv-managed or system Python installations.
///
/// By default, uv prefers using Python versions it manages. However, it
/// will use system Python installations if a uv-managed Python is not
/// installed. This option allows prioritizing or ignoring system Python
/// installations.
#[arg(
global = true,
long,
help_heading = "Python options",
display_order = 700,
env = EnvVars::UV_PYTHON_PREFERENCE
env = EnvVars::UV_PYTHON_PREFERENCE,
hide = true
)]
pub python_preference: Option<PythonPreference>,

/// Require use of uv-managed Python versions.
///
/// By default, uv prefers using Python versions it manages. However, it
/// will use system Python versions if a uv-managed Python is not
/// installed. This option disables use of system Python versions.
#[arg(
global = true,
long,
help_heading = "Python options",
env = EnvVars::UV_MANAGED_PYTHON,
overrides_with = "no_managed_python",
conflicts_with = "python_preference"
)]
pub managed_python: bool,

/// Disable use of uv-managed Python versions.
///
/// Instead, uv will search for a suitable Python version on the system.
#[arg(
global = true,
long,
help_heading = "Python options",
env = EnvVars::UV_NO_MANAGED_PYTHON,
overrides_with = "managed_python",
conflicts_with = "python_preference"
)]
pub no_managed_python: bool,

#[allow(clippy::doc_markdown)]
/// Allow automatically downloading Python when required. [env: "UV_PYTHON_DOWNLOADS=auto"]
#[arg(global = true, long, help_heading = "Python options", hide = true)]
@@ -4419,8 +4442,9 @@ pub enum PythonCommand {
/// By default, installed Python versions and the downloads for latest available patch version
/// of each supported Python major version are shown.
///
/// The displayed versions are filtered by the `--python-preference` option, i.e., if using
/// `only-system`, no managed Python versions will be shown.
/// Use `--managed-python` to view only managed Python versions.
///
/// Use `--no-managed-python` to omit managed Python versions.
///
/// Use `--all-versions` to view all available patch versions.
///
20 changes: 14 additions & 6 deletions crates/uv-configuration/src/dependency_groups.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{borrow::Cow, sync::Arc};

use uv_normalize::{GroupName, DEV_DEPENDENCIES};
use uv_normalize::{DefaultGroups, GroupName, DEV_DEPENDENCIES};

/// Manager of all dependency-group decisions and settings history.
///
@@ -63,10 +63,18 @@ impl DependencyGroups {
} else {
// Merge all these lists, they're equivalent now
group.append(&mut only_group);
// Resolve default groups potentially also setting All
if default_groups {
group.append(&mut defaults);
match &mut defaults {
DefaultGroups::All => IncludeGroups::All,
DefaultGroups::List(defaults) => {
group.append(defaults);
IncludeGroups::Some(group)
}
}
} else {
IncludeGroups::Some(group)
}
IncludeGroups::Some(group)
};

Self(Arc::new(DependencyGroupsInner {
@@ -112,7 +120,7 @@ impl DependencyGroups {
all_groups,
no_default_groups,
// This is unknown at CLI-time, use `.with_defaults(...)` to apply this later!
defaults: Vec::new(),
defaults: DefaultGroups::default(),
})
}

@@ -135,7 +143,7 @@ impl DependencyGroups {
/// Apply defaults to a base [`DependencyGroups`].
///
/// This is appropriate in projects, where the `dev` group is synced by default.
pub fn with_defaults(&self, defaults: Vec<GroupName>) -> DependencyGroupsWithDefaults {
pub fn with_defaults(&self, defaults: DefaultGroups) -> DependencyGroupsWithDefaults {
// Explicitly clone the inner history and set the defaults, then remake the result.
let mut history = self.0.history.clone();
history.defaults = defaults;
@@ -220,7 +228,7 @@ pub struct DependencyGroupsHistory {
pub no_group: Vec<GroupName>,
pub all_groups: bool,
pub no_default_groups: bool,
pub defaults: Vec<GroupName>,
pub defaults: DefaultGroups,
}

impl DependencyGroupsHistory {
Loading