756 Commits

Author SHA1 Message Date
Charlie Marsh
6c62d9fbf1 Bump version to v0.3.5 (#6696) 2024-08-27 16:30:12 +00:00
Charlie Marsh
d86075fc1e Add support for --trusted-host (#6591)
## Summary

This PR revives https://github.com/astral-sh/uv/pull/4944, which I think
was a good start towards adding `--trusted-host`. Last night, I tried to
add `--trusted-host` with a custom verifier, but we had to vendor a lot
of `reqwest` code and I eventually hit some private APIs. I'm not
confident that I can implement it correctly with that mechanism, and
since this is security, correctness is the priority.

So, instead, we now use two clients and multiplex between them.

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

## Test Plan

Created self-signed certificate, and ran `python3 -m http.server --bind
127.0.0.1 4443 --directory . --certfile cert.pem --keyfile key.pem` from
the packse index directory.

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
https://127.0.0.1:8443/simple-html` failed with:

```
error: Request failed after 3 retries
  Caused by: error sending request for url (https://127.0.0.1:8443/simple-html/transitive-yanked-and-unyanked-dependency-a-0abad3b6/)
  Caused by: client error (Connect)
  Caused by: invalid peer certificate: Other(OtherError(CaUsedAsEndEntity))
```

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
'https://127.0.0.1:8443/simple-html' --trusted-host '127.0.0.1:8443'`
failed with the expected error (invalid resolution) and made valid
requests.

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
'https://127.0.0.1:8443/simple-html' --trusted-host '127.0.0.2' -n` also
failed.
2024-08-27 09:36:50 -04:00
Mathieu Kniewallner
6a988aca55 refactor: use a struct for install options (#6561)
## Summary

Closes #6545.

## Test Plan

Relying on existing tests.
2024-08-27 05:38:16 -05:00
konsti
ae57d85dfb Detect musl and error for musl pbs builds (#6643)
As described in #4242, we're currently incorrectly downloading glibc
python-build-standalone on musl target, but we also can't fix this by
using musl python-build-standalone on musl targets since the musl builds
are effectively broken.

We reintroduce the libc detection previously removed in #2381, using it
to detect which libc is the current one before we have a python
interpreter. I changed the strategy a big to support an empty `PATH`
which we use in the tests.

For simplicity, i've decided to just filter out the musl
python-build-standalone archives from the list of available archive,
given this is temporary. This means we show the same error message as if
we don't have a build for the platform. We could also add a dedicated
error message for musl.

Fixes #4242

## Test Plan

Tested manually.

On my ubuntu host, python downloads continue to pass:
```
target/x86_64-unknown-linux-musl/debug/uv python install
```

On alpine, we fail:
```
$ docker run -it --rm -v .:/io alpine /io/target/x86_64-unknown-linux-musl/debug/uv python install
  Searching for Python installations
  error: No download found for request: cpython-any-linux-x86_64-musl
```
2024-08-27 00:06:53 +00:00
Charlie Marsh
39f3cd2a94 Bump version to v0.3.4 (#6656) 2024-08-26 16:51:01 -04:00
renovate[bot]
a25f800aae Update Rust crate syn to v2.0.76 (#6630) 2024-08-26 00:23:27 +00:00
renovate[bot]
f8b8aa72ce Update Rust crate serde_json to v1.0.127 (#6629) 2024-08-26 00:21:22 +00:00
renovate[bot]
8de12fd42e Update Rust crate serde to v1.0.209 (#6628) 2024-08-26 00:21:07 +00:00
renovate[bot]
d98d28a8ca Update Rust crate rkyv to v0.7.45 (#6627) 2024-08-26 00:20:17 +00:00
renovate[bot]
413cf00a0c Update Rust crate reqwest to v0.12.7 (#6626) 2024-08-26 00:15:15 +00:00
renovate[bot]
768840da49 Update Rust crate quote to v1.0.37 (#6625) 2024-08-26 00:14:55 +00:00
renovate[bot]
faf534f997 Update Rust crate jiff to v0.1.10 (#6624) 2024-08-26 00:12:26 +00:00
renovate[bot]
e4e1f384ce Update Rust crate flate2 to v1.0.33 (#6623) 2024-08-25 20:12:14 -04:00
Charlie Marsh
a72a09e9af Use tl fork to support unquoted hrefs (#6622)
## Summary

Closes https://github.com/astral-sh/uv/issues/6082.
2024-08-26 00:02:26 +00:00
Jp
2bfc450418 Parses wheels WHEEL and METADATA files content as email messages (#6616)
## Summary

Fixes: #6615 
Currently, some packages are not installable with `uv`, like `ziglang`
on Linux.
Everything is described in the issue! 😄 

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

## Test Plan

<!-- How was it tested? -->
I added a unit test for the problematic use case.
I also checked that previous unit test are still running in order to
ensure the backward compatibility.
2024-08-25 18:31:07 -04:00
Charlie Marsh
0dc74f619c Remove path-absolutize dependency (#6589)
## Summary

This is now in the standard library.
2024-08-25 12:01:07 +00:00
Charlie Marsh
f7835243c5 Only use relative paths in lockfile (#6490)
For users who were using absolute paths in the `pyproject.toml`
previously, this is a behavior change: We now convert all absolute paths
in `path` entries to relative paths. Since i assume that no-one relies
on absolute path in their lockfiles - they are intended to be portable -
I'm tagging this as a bugfix.

Closes https://github.com/astral-sh/uv/pull/6438
Fixes https://github.com/astral-sh/uv/issues/6371
2024-08-23 22:19:10 -04:00
Charlie Marsh
44e36a7e69 Store test temporary directories outside of /tmp (#6559)
## Summary

There's a long comment inline describing the motivation here.
2024-08-24 01:51:32 +00:00
Zanie Blue
deea6025a1 Bump version to 0.3.3 (#6558) 2024-08-23 18:35:55 -05:00
konsti
bbcd10d3cc Remove rustc-hash 1.1.0 (#6507)
Update tracing-durations-export so we only have rustc-hash 2.0.0
remaining.
2024-08-23 11:50:08 +00:00
konsti
33f15ac456 Update pubgrub to 388685a8711092971930986644cfed152d1a1f6c (#6495)
Regular maintenance.
2024-08-23 12:43:55 +02:00
Charlie Marsh
c5440001ce Bump version to v0.3.2 (#6483) 2024-08-23 03:11:23 +00:00
Charlie Marsh
be17d132ad Bump version to v0.3.1 (#6385) 2024-08-21 19:07:50 -04:00
Zanie Blue
dd1934c9c3 Bump version to 0.3.0 (#6260)
[Rendered](https://github.com/astral-sh/uv/blob/zb/030/CHANGELOG.md#030)

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-08-20 12:29:58 -05:00
konsti
e740322549 Impl Ord for ADD MarkerTree (#6253)
The ADD `MarkerTree` was including the non-deterministic, unstable
`NodeId` in its `Ord` implementation since switching algebraic decision
diagrams. By replacing this with a correct `Ord` implementation, we fix
#6249.

Requires https://github.com/astral-sh/pubgrub/pull/31
2024-08-20 19:11:57 +02:00
Charlie Marsh
e11bbb539a Migrate to XDG and Linux strategy for macOS directories (#5806)
This PR moves us to the Linux strategy for our global directories on
macOS. We both feel on the team _and_ have received feedback (in Issues
and Polls) that the `Application Support` directories are more intended
for GUIs, and CLI tools are correct to respect the XDG variables and use
the same directory paths on Linux and macOS.

Namely, we now use:

- `/Users/crmarsh/.local/share/uv/tools` (for tools)
- `/Users/crmarsh/.local/share/uv/python` (for Pythons)
- `/Users/crmarsh/.cache/uv` (for the cache)

The strategy is such that if the `/Users/crmarsh/Library/Application
Support/uv` already exists, we keep using it -- same goes for
`/Users/crmarsh/Library/Caches/uv`, so **it's entirely backwards
compatible**.

If you want to force a migration to the new schema, you can run:

- `uv cache clean`
- `uv tool uninstall --all`
- `uv python uninstall --all`

Which will clean up the macOS-specific directories, paving the way for
the above paths. In other words, once you run those commands, subsequent
`uv` operations will automatically use the `~/.cache` and `~/.local`
variants.

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

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-20 11:31:46 -05:00
Zanie Blue
04e3e7ce65 Remove preview labeling for uv 0.3.0 (#6166)
- Removes "experimental" labels from command documentation
- Removes preview warnings
- Removes `PreviewMode` from most structs and methods — we could keep it
around but I figure we can propagate it again easily where needed in the
future
- Enables preview behavior by default everywhere, e.g., `uv venv` will
download Python versions
2024-08-20 11:31:46 -05:00
Andrew Gallant
33480d61eb switch to jiff from chrono (#6205)
This PR migrates uv's use of `chrono` to `jiff`.

I did most of this work a while back as one of my tests to ensure Jiff
could actually be used in a real world project. I decided to revive
this because I noticed that `reqwest-retry` dropped its Chrono
dependency,
which is I believe the only other thing requiring Chrono in uv.
(Although, we use a fork of `reqwest-middleware` at present, and that
hasn't been updated to latest upstream yet. I wasn't quite sure of the
process we have for that.)

In course of doing this, I actually made two changes to uv:

First is that the lock file now writes an RFC 3339 timestamp for
`exclude-newer`. Previously, we were using Chrono's `Display`
implementation for this which is a non-standard but "human readable"
format. I think the right thing to do here is an RFC 3339 timestamp.

Second is that, in addition to an RFC 3339 timestamp, `--exclude-newer`
used to accept a "UTC date." But this PR changes it to a "local date."
That is, a date in the user's system configured time zone. I think
this makes more sense than a UTC date, but one alternative is to drop
support for a date and just rely on an RFC 3339 timestamp. The main
motivation here is that automatically assuming UTC is often somewhat
confusing, since just writing an unqualified date like `2024-08-19` is
often assumed to be interpreted relative to the writer's "local" time.
2024-08-20 11:31:46 -05:00
konsti
310412a2ff Update reqwest-middleware (#6206)
Update reqwest-middleware to the latest upstream
(https://github.com/TrueLayer/reqwest-middleware,
603ef97144b6b328c4e9ef7b13297d40bf461779) for #6205.
2024-08-19 10:25:40 -04:00
Andrew Gallant
c7218e19ac cargo: add 'similar' dev dependency
We were already using this via 'insta'. We bring it in so that
we can explicitly snapshot diffs.
2024-08-19 05:33:30 -07:00
Andrew Gallant
74066ec29b cargo: remove unused 'derivative' dependency
This seems to be failing the `cargo shear` check on `main`. It looks
like this was caused by #6200.
2024-08-19 05:19:23 -07:00
renovate[bot]
e008b38df2 Update Rust crate indexmap to v2.4.0 (#6194) 2024-08-19 02:31:24 +00:00
renovate[bot]
8a48f755d1 Update Rust crate which to v6.0.3 (#6193) 2024-08-19 02:31:05 +00:00
renovate[bot]
457ef73209 Update Rust crate tokio to v1.39.3 (#6192) 2024-08-19 02:29:13 +00:00
renovate[bot]
20ef94b15d Update Rust crate syn to v2.0.75 (#6191) 2024-08-19 02:25:42 +00:00
renovate[bot]
be095570f5 Update Rust crate serde_json to v1.0.125 (#6190) 2024-08-19 02:25:25 +00:00
renovate[bot]
f1d2e3fe96 Update Rust crate serde to v1.0.208 (#6189) 2024-08-19 02:24:01 +00:00
renovate[bot]
75d57f50aa Update Rust crate ctrlc to v3.4.5 (#6188) 2024-08-19 02:23:08 +00:00
renovate[bot]
c40f3e4cc1 Update Rust crate clap to v4.5.16 (#6187) 2024-08-19 02:20:44 +00:00
Charlie Marsh
91fba4e1e6 Use FxHash in uv-auth (#6149) 2024-08-16 13:14:51 -04:00
Charlie Marsh
15dfb660ab Bump version to v0.2.37 (#6134) 2024-08-15 22:13:03 -04:00
Charlie Marsh
8fac63d4ce Redact Git credentials from pyproject.toml (#6074)
## Summary

We retain them if you use `--raw-sources`, but otherwise they're
removed. We still respect them in the subsequent `uv.lock` via an
in-process store.

Closes #6056.
2024-08-14 01:30:02 +00:00
Zanie Blue
8d66718077 Bump version to 0.2.36 (#6060) 2024-08-13 12:05:11 -05:00
Charlie Marsh
73e32f4eb9 Add test coverage for direct URLs with sources (#6046)
## Summary

Ensures that we don't respect `tool.uv.sources` for (eg.) direct URL
requirements, as intended.

Related to https://github.com/astral-sh/uv/issues/3943.

Closes https://github.com/astral-sh/uv/issues/6048.
2024-08-12 23:14:08 +00:00
renovate[bot]
2eb692ace1 Update Rust crate syn to v2.0.74 (#6022) 2024-08-12 01:33:16 +00:00
renovate[bot]
2421012bfe Update Rust crate serde_json to v1.0.124 (#6021) 2024-08-12 01:29:12 +00:00
renovate[bot]
0c7e67f7d1 Update Rust crate serde to v1.0.206 (#6020) 2024-08-12 01:27:18 +00:00
renovate[bot]
a295551d93 Update Rust crate clap to v4.5.15 (#6018) 2024-08-12 01:26:06 +00:00
Alexander Gherm
798cc7bf3c Make more informative warning message when failed to parse pyproject.toml (#6009)
## Summary

Added the actual error message to the warning when uv fails to parse
`pyproject.toml`.

Resolves https://github.com/astral-sh/uv/issues/5934

## Test Plan

Took the case from the issue:
- have `pyproject.toml` which contains
```
[tool.uv]
foobar = false
```
- 
```
$ uv venv --preview -v
```
- Expect the message that contains the actual problem in the
`pyproject.toml` like:
```
warning: Failed to parse `pyproject.toml` during settings discovery: unknown field `foobar`; skipping...
```
2024-08-11 21:13:14 +00:00
Charlie Marsh
f10c28225c Support tool.uv in PEP 723 scripts (#5990)
## Summary

This includes both _settings_ and _sources.

Closes https://github.com/astral-sh/uv/issues/5855.
2024-08-09 23:11:10 -04:00