Commit graph

3528 commits

Author SHA1 Message Date
Jo
bcc52ed108
Add uv pip show --files (#8369)
## Summary

Resolves #8357
2024-10-20 12:13:41 -04:00
Zanie Blue
05a56dab61
Copy the workspace examples into test contexts (#8348)
Cherry-picked from https://github.com/astral-sh/uv/pull/8347

Per [this
flake](3175705352)
it doesn't solve the problem unfortunately. Still seems like best
practice.
2024-10-20 12:11:52 -04:00
Jo
e980c1b0f8
Only remove a source from [tool.uv.sources] if it is no long being referenced (#8366)
## Summary

Resolves #8361
2024-10-19 10:52:01 -05:00
Jo
ca55793a90
Remove tool.uv.sources table if it is empty (#8365)
## Summary

Resolves #8362
2024-10-19 15:20:45 +00:00
Zanie Blue
4355392c82
Add a uv remove test where a dependency is repeated (#8360) 2024-10-19 14:33:54 +00:00
Jo
ac451af1bd
Check existing source by normalized name before add and remove (#8359)
Resolves #8328
Resolves #8330
2024-10-19 08:26:01 -05:00
Zanie Blue
4b0a4dadb7
Fix bug where username from authentication cache could be ignored (#8345)
Basically, if username-only authentication came from the _cache_ instead
of being present on the _request URL_ to start, we'd end up ignoring it
during password lookups which breaks keyring.

Includes some cosmetic changes to the logging and commentary in the
middleware, because I was confused when reading the code and logs.
2024-10-18 18:45:31 -05:00
konsti
e26eed10e4
Better missing self update feature (#8337) 2024-10-18 17:38:34 +00:00
Charlie Marsh
d53d580221
Add support for UV_FROZEN and UV_LOCKED (#8340)
## Summary

Closes https://github.com/astral-sh/uv/issues/8321.
2024-10-18 13:37:49 -04:00
Vini Brasil
69d5e084d5
Allow dashes and underscores in custom index names (#8339)
Previously, `uv add --index` command threw an error when the index name
included characters like hyphens or underscores.

Closes #8315
2024-10-18 13:24:16 -04:00
konsti
c162078050
Add cfg for other external resources tests (#8320)
Fixes #8295
2024-10-18 12:30:11 -04:00
Zanie Blue
42dac85bf7
Remove commands available in the top-level from the suggested subcommand error (#8316)
Part of https://github.com/astral-sh/uv/issues/8313

I think we'll need to open an issue upstream to add more context to the
error here, because there's not sufficient information about the parent
command to provide a good error message. As a first step, let's avoid
giving these suggestions for subcommands that overlap with our top-level
commands.. because that's just confusing.

Here's all the information we have here

```rust
[crates/uv/src/lib.rs:1530:13] &err = ErrorInner {
    kind: InvalidSubcommand,
    context: FlatMap {
        keys: [
            InvalidSubcommand,
            Usage,
        ],
        values: [
            String(
                "remove",
            ),
            StyledStr(
                StyledStr(
                    "\u{1b}[1m\u{1b}[32mUsage:\u{1b}[0m \u{1b}[1m\u{1b}[36muv python\u{1b}[0m \u{1b}[36m[OPTIONS]\u{1b}[0m \u{1b}[36m<COMMAND>\u{1b}[0m",
                ),
            ),
        ],
    },
    message: None,
    source: None,
    help_flag: Some(
        "--help",
    ),
    styles: Styles {
        header: Style {
            fg: Some(
                Ansi(
                    Green,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(BOLD),
        },
        error: Style {
            fg: Some(
                Ansi(
                    Red,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(BOLD),
        },
        usage: Style {
            fg: Some(
                Ansi(
                    Green,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(BOLD),
        },
        literal: Style {
            fg: Some(
                Ansi(
                    Cyan,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(BOLD),
        },
        placeholder: Style {
            fg: Some(
                Ansi(
                    Cyan,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(),
        },
        valid: Style {
            fg: Some(
                Ansi(
                    Green,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(),
        },
        invalid: Style {
            fg: Some(
                Ansi(
                    Yellow,
                ),
            ),
            bg: None,
            underline: None,
            effects: Effects(),
        },
    },
    color_when: Auto,
    color_help_when: Auto,
    backtrace: None,
}
```
2024-10-18 10:57:07 -05:00
konsti
6b8f447387
Make lock_multiple_sources stable over time (#8336) 2024-10-18 15:51:51 +00:00
Charlie Marsh
a459052f44
Redact index sources in uv.lock (#8333)
## Summary

Closes https://github.com/astral-sh/uv/issues/8296.
2024-10-18 11:20:15 -04:00
konsti
23c80c547c
Remove trailing newlines in error messages (#8322) 2024-10-18 17:17:41 +02:00
konsti
32bba9f33b
Don't prefetch unreachable packages (#8246) 2024-10-18 13:44:24 +02:00
Zanie Blue
cf7fcaa942
Fixup HTTP_BASIC reference in docstring (#8314) 2024-10-17 19:37:06 -05:00
Zanie Blue
b9cd549138
Bump version to 0.4.24 (#8312) 2024-10-17 18:50:13 -05:00
Zanie Blue
c8cbd62a30
Patch Python executable name for Windows free-threaded builds (#8310)
A temporary fix for https://github.com/astral-sh/uv/issues/8298 while we
wait for my slower upstream fix at
https://github.com/indygreg/python-build-standalone/pull/373

I think we'll want this machinery anyway to ensure that the various
executable names are available? Otherwise we need to special-case all
the `python` names in `uv run`?

We don't have unit test coverage of managed downloads, so I added an
[integration
test](3170395680)
similar to what we have for Linux.
2024-10-17 18:27:55 -05:00
David Bern
3fd69b448e
Respect UV_INDEX_ rather than UV_HTTP_BASIC_ (#8306)
The docs reference `UV_INDEX_`, but the code actually uses
UV_HTTP_BASIC_ as the prefix for environment variable credentials.

See PR #7741

Code is at
https://github.com/astral-sh/uv/blob/main/crates/uv-static/src/env_vars.rs#L163

```rust
    /// Generates the environment variable key for the HTTP Basic authentication username.
    pub fn http_basic_username(name: &str) -> String {
        format!("UV_HTTP_BASIC_{name}_USERNAME")
    }

    /// Generates the environment variable key for the HTTP Basic authentication password.
    pub fn http_basic_password(name: &str) -> String {
        format!("UV_HTTP_BASIC_{name}_PASSWORD")
    }
```

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-17 21:42:04 +00:00
Charlie Marsh
c62f8d769c
Redact index credentials from lockfile sources (#8307)
## Summary

Closes https://github.com/astral-sh/uv/issues/8296.
2024-10-17 21:38:21 +00:00
Charlie Marsh
7beb5ebe26
Improve sources deserialization errors (#8308) 2024-10-17 21:33:04 +00:00
Zanie Blue
16b77e7fd4
Add a FreeBSD build to CI (#8269)
Playing with this because it's interesting and I learned about this cool
firecracker action.

Related #3370
2024-10-17 15:24:21 +00:00
Zanie Blue
83f835b0d0
Bump version to 0.4.23 (#8275)
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-17 14:26:39 +00:00
InSync
d2e3026160
Fix error leading to out-of-bound panic in uv-pep508 (#8282)
Resolves #8281.

## Summary


[`Cursor.slice()`](d930367f8c/crates/uv-pep508/src/cursor.rs (L39))
expects a start index and a length, but it is instead [given a start
index and an end
index](d930367f8c/crates/uv-pep508/src/lib.rs (L936)).

## Test plan

A new "leading whitespace" test is added to `tests.rs`.
2024-10-17 08:22:58 -04:00
konsti
7eed0bcd23
Add more context on resolve client error (#8285)
I'm not clear where #8144 comes from, so I'm adding some more error
context to narrow it down.
2024-10-17 08:22:09 -04:00
Charlie Marsh
d930367f8c
Fix test fixtures to reflect installer new error messages (#8278)
## Summary

I unintentionally pushed this change directly to main; this PR just
updates the fixtures to reflect the more nuanced messages.
2024-10-16 22:22:06 -04:00
Charlie Marsh
5201550685
Update Saleor ecosystem snapshot (#8277) 2024-10-16 22:20:15 -04:00
Charlie Marsh
66211cb028 Use more precise error messages for preparation failures 2024-10-16 22:08:45 -04:00
Tim Hatch
91585a90e7
Narrow what the pip3.<minor> logic drops from entry points. (#8273)
## Summary

The hack in pip itself only modifies entry points called
`pip<number>.<number>` and `easy_install-<number>.<number>`, uv
previously dropped too many items including any of the form
`foo.<number>`.

Found while trying to install `memray` which somewhat notably does not
provide an abi3 wheel, so the installed, suffixed script matches. At a
minimum, this makes the installed files match the `entry_points.txt`
more than it did previously, which makes `pickley` happy.

## Test Plan

New test provided for previously-untested code.
2024-10-16 21:33:13 -04:00
Zanie Blue
b851ced09e
Fix selection of free-threaded interpreters during default Python discovery (#8239)
Closes https://github.com/astral-sh/uv/issues/8228

e.g., on this branch

```
❯ uv python install 3.13t 3.13
❯ cargo build
❯ cargo run -q --bin uvx -- --from build python -c "import sys; print(sys.base_prefix)"
/Users/zb/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none
❯ cargo run -q --bin uvx -- -p 3.13 --from build python -c "import sys; print(sys.base_prefix)"
/Users/zb/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none
❯ cargo run -q --bin uvx -- -p 3.13t --from build python -c "import sys; print(sys.base_prefix)"
/Users/zb/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none
```

and on main

```
❯ cargo build
❯ cargo run -q --bin uvx -- --from build python -c "import sys; print(sys.base_prefix)"
Installed 3 packages in 12ms
/Users/zb/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none
```

I want to add more test coverage around this, but I've noticed the
free-threaded discovery tests are a bit off as-is and it'll be a bigger
task. I think the recent bugs around discovery indicate we should invest
more into that test framework.
2024-10-16 14:44:32 -05:00
github-actions[bot]
94a2686385
Fix managed distributions of free-threaded Python on Windows (#8268)
See upstream fix at
https://github.com/indygreg/python-build-standalone/pull/368

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2024-10-16 14:35:29 -05:00
Jo
76a9afbae5
Ignore try lock error if it is WouldBlock (#8258)
## Summary

Address a TODO comment, seems like we don't need `raw_os_err`?
2024-10-16 14:15:48 -05:00
Zanie Blue
6ac5859b1a
Improve styling of requires-python warnings (#8240)
Extends #7959

While I was looking at that message, I noticed I didn't love the
readability of the existing message and opted to follow-up with a change
to them both.
2024-10-16 13:08:21 -05:00
Charlie Marsh
4ca158931a
Show hint in resolution failure on Forbidden (403) or Unauthorized (401) (#8264)
## Summary

Closes https://github.com/astral-sh/uv/issues/8167.
2024-10-16 17:34:29 +00:00
Charlie Marsh
5e05a62004
Respect index priority when storing credentials (#8256)
## Summary

Closes https://github.com/astral-sh/uv/issues/8248.
2024-10-16 15:52:26 +00:00
konsti
31bf8eb43b
Update PubGrub (#8245) 2024-10-16 15:39:23 +00:00
Charlie Marsh
7730861bc5
Allow users to incorporate Git tags into dynamic cache keys (#8259)
## Summary

You can now use `cache-keys = [{ git = { commit = true, tags = true }
}]` to include both the current commit and set of tags in the cache key.

Closes https://github.com/astral-sh/uv/issues/7866.

Closes https://github.com/astral-sh/uv/issues/7997.
2024-10-16 11:13:29 -04:00
Aditya Pratap Singh
0bd6e46bcf
Avoid writing duplicate index URLs with --emit-index-url (#8226)
closes #8116

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-16 12:45:25 +00:00
Charlie Marsh
0c445eb11d
Fix flaky test in build.rs (#8250)
## Summary

Closes https://github.com/astral-sh/uv/issues/8241.
2024-10-16 12:26:05 +00:00
samypr100
319c0183c6
Add templates for popular build backends (#7857)
Co-authored-by: konstin <konstin@mailbox.org>
2024-10-16 14:19:59 +02:00
konsti
9f2e54ffba
Make rkyv optional in pep440-rs (#8249) 2024-10-16 12:15:51 +00:00
Ian Paul
e71b1d0c42
Warn when patch isn't specified (#7959)
When patch version isn't specified and a matching version is referenced,
it will default patch to 0 which could be unclear/confusing. This PR
warns the user of that default.

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

The first part of this issue
https://github.com/astral-sh/uv/issues/7426. Will tackle the second part
mentioned (`~=`) in a separate PR once I know this is the correct way to
warn users.

## Test Plan

<!-- How was it tested? -->

Unit tests were added

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-16 04:21:26 +00:00
Charlie Marsh
999b3f06a4
Respect relative paths in uv build sources (#8237)
## Summary

Right now, `uv build` will fail if a package depends on a local source
in `build-system.requires`.
2024-10-16 01:46:29 +00:00
samypr100
b4dca669b4
chore(uv): update env vars map to include newly added ones (#8233)
## Summary

Add some new env var mappings

## Test Plan

Existing tests
2024-10-15 21:40:09 -04:00
Charlie Marsh
98d049407f
Ignore sources in build requirements for non-source trees (#8235)
## Summary

We shouldn't enforce sources when, e.g., you provide a `.tar.gz` file.

Closes https://github.com/astral-sh/uv/issues/8236.
2024-10-16 00:53:19 +00:00
Charlie Marsh
59003cb021
Avoid showing lower-bound warning outside of explicit lock and sync (#8234)
## Summary

We shouldn't show these in `uv add`, especially when the thing we're
adding is about to have a lower-bound put on it. Now, we only show these
when the user runs `uv lock` or `uv sync`.
2024-10-15 20:49:40 -04:00
Charlie Marsh
2153c6ac0d
Respect named --index and --default-index values in tool.uv.sources (#7910)
## Summary

If you pass a named index via the CLI, you can now reference it as a
named source. This required some surprisingly large refactors, since we
now need to be able to track whether a given index was provided on the
CLI vs. elsewhere (since, e.g., we don't want users to be able to
reference named indexes defined in global configuration).

Closes https://github.com/astral-sh/uv/issues/7899.
2024-10-15 23:56:24 +00:00
Charlie Marsh
a034a8b83b
Remove the flat index types (#7759)
## Summary

I think these really don't pull their weight.
2024-10-15 23:30:37 +00:00
Charlie Marsh
d31b995511
Pin named indexes in uv add (#7747)
## Summary

This PR adds an index pin with `uv add` when the user provides exactly
one named index. We don't pin if the user provides an unnamed index, or
if they provide multiple indexes.

We probably _could_ pin on multiple indexes by writing the sources
_after_ resolution, if that's desirable. But we have no idea which index
the user _expects_ each package to come from.

Possible extensions:

- `uv add --no-pin` to avoid this pinning.
- Warn if they provide a single, unnamed index? I'm not sure if that's
worth a warn. Open to input.
2024-10-15 23:22:45 +00:00