734 Commits

Author SHA1 Message Date
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
Zanie Blue
e097f948c9 Bump version to 0.2.35 (#5984) 2024-08-09 19:21:06 -05:00
Charlie Marsh
f89403f4f6 Retain and respect settings in tool upgrades (#5937)
## Summary

We now persist the `ResolverInstallerOptions` when writing out a tool
receipt. When upgrading, we grab the saved options, and merge with the
command-line arguments and user-level filesystem settings (CLI > receipt
> filesystem).
2024-08-09 18:21:49 +00:00
Ibraheem Ahmed
ffd18cc75d Implement marker trees using algebraic decision diagrams (#5898)
## Summary

This PR rewrites the `MarkerTree` type to use algebraic decision
diagrams (ADD). This has many benefits:
- The diagram is canonical for a given marker function. It is impossible
to create two functionally equivalent marker trees that don't refer to
the same underlying ADD. This also means that any trivially true or
unsatisfiable markers are represented by the same constants.
- The diagram can handle complex operations (conjunction/disjunction) in
polynomial time, as well as constant-time negation.
- The diagram can be converted to a simplified DNF form for user-facing
output.

The new representation gives us a lot more confidence in our marker
operations and simplification, which is proving to be very important
(see https://github.com/astral-sh/uv/pull/5733 and
https://github.com/astral-sh/uv/pull/5163).

Unfortunately, it is not easy to split this PR into multiple commits
because it is a large rewrite of the `marker` module. I'd suggest
reading through the `marker/algebra.rs`, `marker/simplify.rs`, and
`marker/tree.rs` files for the new implementation, as well as the
updated snapshots to verify how the new simplification rules work in
practice. However, a few other things were changed:
- [We now use release-only comparisons for `python_full_version`, where
we previously only did for
`python_version`](https://github.com/astral-sh/uv/blob/ibraheem/canonical-markers/crates/pep508-rs/src/marker/algebra.rs#L522).
I'm unsure how marker operations should work in the presence of
pre-release versions if we decide that this is incorrect.
- [Meaningless marker expressions are now
ignored](https://github.com/astral-sh/uv/blob/ibraheem/canonical-markers/crates/pep508-rs/src/marker/parse.rs#L502).
This means that a marker such as `'x' == 'x'` will always evaluate to
`true` (as if the expression did not exist), whereas we previously
treated this as always `false`. It's negation however, remains `false`.
- [Unsatisfiable markers are written as `python_version <
'0'`](https://github.com/astral-sh/uv/blob/ibraheem/canonical-markers/crates/pep508-rs/src/marker/tree.rs#L1329).
- The `PubGrubSpecifier` type has been moved to the new `uv-pubgrub`
crate, shared by `pep508-rs` and `uv-resolver`. `pep508-rs` also depends
on the `pubgrub` crate for the `Range` type, we probably want to move
`pubgrub::Range` into a separate crate to break this, but I don't think
that should block this PR (cc @konstin).

There is still some remaining work here that I decided to leave for now
for the sake of unblocking some of the related work on the resolver.
- We still use `Option<MarkerTree>` throughout uv, which is unnecessary
now that `MarkerTree::TRUE` is canonical.
- The `MarkerTree` type is now interned globally and can potentially
implement `Copy`. However, it's unclear if we want to add more
information to marker trees that would make it `!Copy`. For example, we
may wish to attach extra and requires-python environment information to
avoid simplifying after construction.
- We don't currently combine `python_full_version` and `python_version`
markers.
- I also have not spent too much time investigating performance and
there is probably some low-hanging fruit. Many of the test cases I did
run actually saw large performance improvements due to the markers being
simplified internally, reducing the stress on the old `normalize`
routine, especially for the extremely large markers seen in
`transformers` and other projects.

Resolves https://github.com/astral-sh/uv/issues/5660,
https://github.com/astral-sh/uv/issues/5179.
2024-08-09 13:40:02 -04:00
Charlie Marsh
cdd7341b6d Run cargo update (#5960) 2024-08-09 13:36:11 -04:00
Ibraheem Ahmed
ddb82a01c8 Add basic universal benchmarks to CI (#5938)
## Summary

Resolves https://github.com/astral-sh/uv/issues/4921.
2024-08-09 12:52:28 -04:00
Charlie Marsh
21408c1f35 Enforce extension validity at parse time (#5888)
## Summary

This PR adds a `DistExtension` field to some of our distribution types,
which requires that we validate that the file type is known and
supported when parsing (rather than when attempting to unzip). It
removes a bunch of extension parsing from the code too, in favor of
doing it once upfront.

Closes https://github.com/astral-sh/uv/issues/5858.
2024-08-08 21:39:47 -04:00
Charlie Marsh
c681c5a33c Bump version to v0.2.34 (#5889) 2024-08-07 16:33:53 -04:00
renovate[bot]
02eba290f6 Update Rust crate tempfile to v3.11.0 (#5784) 2024-08-05 01:46:44 +00:00
renovate[bot]
b4cb3f2266 Update Rust crate indexmap to v2.3.0 (#5783) 2024-08-05 01:43:29 +00:00
renovate[bot]
c14d84609d Update Rust crate winsafe to 0.0.22 (#5780) 2024-08-05 01:13:37 +00:00
renovate[bot]
77141464fe Update Rust crate which to v6.0.2 (#5779) 2024-08-05 01:08:55 +00:00
renovate[bot]
03b033f828 Update Rust crate toml to v0.8.19 (#5777) 2024-08-05 01:01:56 +00:00
renovate[bot]
0c3ac4eafe Update Rust crate target-lexicon to v0.12.16 (#5776) 2024-08-05 00:57:41 +00:00
renovate[bot]
e16ba6ed51 Update Rust crate serde_json to v1.0.122 (#5775) 2024-08-05 00:53:28 +00:00
renovate[bot]
28aa720e29 Update Rust crate regex to v1.10.6 (#5774) 2024-08-05 00:52:47 +00:00
renovate[bot]
96b52510e1 Update Rust crate flate2 to v1.0.31 (#5773) 2024-08-05 00:49:10 +00:00
renovate[bot]
f38fd25e95 Update Rust crate dunce to v1.0.5 (#5772) 2024-08-05 00:46:43 +00:00
renovate[bot]
09b227ce86 Update Rust crate clap to v4.5.13 (#5771) 2024-08-05 00:45:52 +00:00
Zanie Blue
b14945a7b1 Bump version to 0.2.33 (#5712) 2024-08-01 21:39:17 +00:00
Zanie Blue
f107406727 Generate CLI reference for documentation (#5685)
Loosely based on [Cargo's
format](https://github.com/rust-lang/cargo/blob/master/src/doc/src/commands/cargo-build.md)

<img width="896" alt="Screenshot 2024-08-01 at 9 44 03 AM"
src="https://github.com/user-attachments/assets/7c016bb3-2b54-46af-8ea8-ce82e07a0e30">

Future work includes:

- Grouping options
- Enforcing some sort of specific command ordering
- Showing possible values for enums
- Adding "long_about" to commands for more context
2024-08-01 16:04:16 +00:00
Charlie Marsh
f266fb711c Use full requirement when serializing receipt (#5494)
## Summary

The current receipt doesn't capture quite enough information. For
example, it doesn't differentiate between editable and non-editable
requirements. This PR instead uses the full `Requirement` type. I think
we should use a custom representation like we do in the lockfile, but
I'm just using the default representation to demonstrate the idea.
2024-07-31 16:16:39 +00:00
Charlie Marsh
dfec262586 Capture portable path serialization in a struct (#5652)
## Summary

I need to reuse this in #5494, so want to abstract it out and make it
reusable.
2024-07-31 16:00:37 +00:00