Commit Graph

720 Commits

Author SHA1 Message Date
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
konsti 981661c4af Update pubgrub (#5649)
We improved the API structure in pubgrub, and also update to generally
keep up with upstream.
2024-07-31 12:54:11 +00:00
Charlie Marsh 38c232e466 Bump version to v0.2.32 (#5641) 2024-07-30 18:56:39 -04:00
Maksim Bondarenkov 228a803fde uv-python: use windows-sys instead of winapi (#5591)
<!--
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

use windows-sys bindings maintained by microsoft devs. winapi didn't has
any updates for more than 3 years

## Test Plan

cargo test. it failed locally because I don't have Python 3.12 installed
2024-07-30 11:43:04 +02:00
Charlie Marsh ecb85c9894 Statically link liblzma (#5577)
## Summary

Found via https://github.com/indygreg/PyOxidizer/issues/585.

Closes https://github.com/astral-sh/uv/issues/5572.
2024-07-29 21:46:43 +00:00
Charlie Marsh 48162de974 Bump version to v0.2.31 (#5568) 2024-07-29 14:06:20 -04:00
Charlie Marsh a346d257cb Update rs-async-zip fork commit (#5560)
## Summary

Closes https://github.com/astral-sh/uv/issues/5556.
2024-07-29 14:42:53 +00:00
renovate[bot] 77696c4ab4 Update Rust crate axoupdater to 0.7.0 (#5547) 2024-07-29 09:44:25 -04:00
renovate[bot] 600ef6f18c Update Rust crate assert_cmd to v2.0.15 (#5534) 2024-07-28 20:32:02 -04:00
renovate[bot] c9099b1ed3 Update Rust crate toml to v0.8.16 (#5541) 2024-07-28 20:31:46 -04:00
renovate[bot] 335fe82cfe Update Rust crate tokio to v1.39.2 (#5540) 2024-07-28 20:31:39 -04:00
renovate[bot] 834a1ed515 Update Rust crate serde_json to v1.0.121 (#5539) 2024-07-28 20:31:36 -04:00
renovate[bot] 96c65628b7 Update Rust crate predicates to v3.1.2 (#5538) 2024-07-28 20:31:29 -04:00
renovate[bot] f2860df91f Update Rust crate clap to v4.5.11 (#5537) 2024-07-28 20:30:53 -04:00
renovate[bot] 3b488d8635 Update Rust crate cargo-util to v0.2.13 (#5536) 2024-07-28 20:30:28 -04:00