Commit graph

4903 commits

Author SHA1 Message Date
Mathieu Kniewallner
eec5403adf
docs(concepts): mention PEP 625 (#7189)
## Summary

Follow-up to
https://github.com/astral-sh/uv/pull/7168#discussion_r1748914880.
2024-09-08 17:28:35 -04:00
Charlie Marsh
4466402214
DRY up exclusion checks in selector (#7194) 2024-09-08 17:42:41 +00:00
kranurag7
5e4bd311c2
bump quinn-proto crate to 0.11.7 (#7191) 2024-09-08 12:11:02 -04:00
Charlie Marsh
f11eebd735
Bump Rust toolchain to 1.81 (#7187) 2024-09-08 15:09:49 +00:00
konsti
aca01f80ef
Clearer registry Python sort (#7178)
Change the registry Python sorting implementation to be easier to
follow, making it clearer what it does and that it is a total order. No
functional changes.
2024-09-07 15:57:01 -04:00
Mathieu Kniewallner
8341d810b2
docs: list supported sdist formats (#7168)
## Summary

Explicitly list the formats and extensions that uv supports, based on
[this
list](86ee8d2c01/crates/distribution-filename/src/extension.rs (L70-L77)).
Not a huge fan of adding the section in `concepts/resolution.md`, but I
did not find a better place. Alternatively we could maybe add a
dedicated page that shortly explains Python package types (wheels,
sdists), where such a section could live?

## Test Plan

Local run of the documentation.
2024-09-07 19:16:12 +00:00
Charlie Marsh
e8a26a43f5
Avoid extra newlines in debug logging for source builds (#7174)
## Summary

@henryiii brought this up and I noticed it too:

![Screenshot 2024-09-06 at 4 09
32 PM](https://github.com/user-attachments/assets/a2849a0e-0515-4856-a9fe-14c713ed9b75)

## Test Plan

`uv build`:

![Screenshot 2024-09-07 at 2 08
39 PM](https://github.com/user-attachments/assets/841db9b7-1fd1-4964-aa57-58b479a255ff)

`uv pip install -e . --verbose`:

![Screenshot 2024-09-07 at 2 08
52 PM](https://github.com/user-attachments/assets/30b2817a-d4a3-4437-b47d-2bc037f5afa4)
2024-09-07 14:34:00 -04:00
Andrew Gallant
f6bc701ac3 uv-resolver: use new simplify/complexify marker routines
This finally gets rid of our hack for working around "hidden"
state. We no longer do a roundtrip marker serialization and
deserialization just to avoid the hidden state.
2024-09-07 13:46:02 -04:00
Andrew Gallant
2c139d6fca pep508: implement marker simplification/complexification
This adds new routines to `MarkerTree` for "simplifying" and
"complexifying" a tree with respect to lower and upper Python version
bounds.

In effect, "simplifying" a marker is what you do when you write it to a
lock file. Namely, since `uv.lock` includes a `requires-python` bound at
the top, one can say that it acts as a bound on the supported Python
versions. That is, it establishes a context in which one can assume that
bound is true. Therefore, the markers we write can be simplified using
this assumption.

The reverse is "complexifying" a marker, and it's what you do when you
read a marker from the lock file. Namely, once a marker is read, it can
be very difficult in code to keep the corresponding requires-python
context from the lock file. If you lose track of it and decide to
operate on the "simplified" marker, then it's trivial for that to
produce an incorrect result.
2024-09-07 13:46:02 -04:00
Andrew Gallant
8bb0a55ff5 pep508: remove hidden state from MarkerTree
I split this change into its own commit because I'm hoping it
crystalizes what it means when we say "a `MarkerTree` has hidden state."
That is, it isn't so much that there is some explicit member of a
`MarkerTree` that is omitted, but rather, the lower and upper version
bounds on `python_full_version` are are rewritten as "unbounded" when
traversing the ADD for display.

We will actually retain this functionality, but rejigger it so that it's
explicit when we do this. In particular, this simplification has been
problematic for us because it fundamentally changes the truth tables of
a marker expression *unless* you are extremely careful to interpret it
only under the original context in which it was simplified. This is
quite difficult to do generally, and in prior work in #6268, we
completed a refactor where we worked around this type of simplification
and moved it to the edges of uv.

In subsequent commits, we'll re-implement this form of simplification as
a more explicit step.
2024-09-07 13:46:02 -04:00
Zanie Blue
86ee8d2c01
Document support for UV_INSTALL_DIR (#7107) 2024-09-07 15:26:37 +00:00
Ilya Grigoriev
23c0d9b1db
installation.md: update shell syntax for setting env vars (#7138)
I find this more readable; it also no longer requires bash (thought just
replacing `bash` with `sh` would achieve that much).

Strictly speaking, `env` is not necessary on most shells, but I find it
makes things clearer.

## Test Plan

Ran the command locally, did not try compiling the docs.



----------

Aside, loosely related (and hopefully helpful) suggestions:

I'm hoping you will also explain in the docs how to install to
`~/.local/bin`, with the same goal as
https://github.com/astral-sh/uv/pull/6839. Using environment variables
for that is fine.

Another minor FR I'd have is to mention these environment variables in
the help message of the installer script, especially if you want to
encourage people to use them.

Thank you for working on the installation script! It helps me feel more
comfortable about eventually asking that people install `uv` to compile
docs on my project, hopefully helping people who don't have a Python
environment already installed.
2024-09-07 10:21:52 -05:00
Charlie Marsh
a3e9610a54
Add build isolation logging to build operations (#7169)
## Summary

Closes https://github.com/astral-sh/uv/issues/7154.
2024-09-07 14:32:25 +00:00
FishAlchemist
aa3297a8d7
Replace incorrect `--source and --binary flags with correct --sdist and --wheel flags in uv build` (#7156)
## Summary
Replace incorrect ``--source`` and ``--binary`` flags with correct
``--sdist`` and ``--wheel`` flags in uv build.
 

![image](https://github.com/user-attachments/assets/f72a9c73-bfce-441b-8756-d0cb22afcd7d)

## Test Plan
Run the server locally

![image](https://github.com/user-attachments/assets/f702f19f-96b8-4338-bd1b-e2fb35f5697a)
2024-09-07 07:50:56 -04:00
Charlie Marsh
a178051e81
Bump version to v0.4.7 (#7150) 2024-09-07 02:18:15 +00:00
Charlie Marsh
6179b65e37
Avoid removing entries during read_dir (#7151)
I think this is the source of the test flakiness.
2024-09-07 02:10:28 +00:00
Charlie Marsh
7d49fbc753
Skip metadata fetch for --no-deps and pip sync (#7127)
## Summary

I think a better tradeoff here is to skip fetching metadata, even though
we can't validate the extras.

It will help with situations like
https://github.com/astral-sh/uv/issues/5073#issuecomment-2334235588 in
which, otherwise, we have to download the wheels twice.
2024-09-06 21:26:28 -04:00
Janosh Riebesell
e96eb946f9
Fix typo aaarch64->aarch64 (#7141)
copy pasted `--python-platform aaarch64-unknown-linux-gnu` [from the
docs](https://docs.astral.sh/uv/reference/cli/#uv-pip-compile) and got

> error: invalid value 'aaarch64-unknown-linux-gnu' for
'--python-platform <PYTHON_PLATFORM>'
> [possible values: windows, linux, macos, x86_64-pc-windows-msvc,
i686-pc-windows-msvc, x86_64-unknown-linux-gnu, aarch64-apple-darwin,
x86_64-apple-darwin, aarch64-unknown-linux-gnu,
aarch64-unknown-linux-musl, x86_64-unknown-linux-musl,
x86_64-manylinux_2_17, x86_64-manylinux_2_28, x86_64-manylinux_2_31,
aarch64-manylinux_2_17, aarch64-manylinux_2_28, aarch64-manylinux_2_31]
> 
>   tip: a similar value exists: 'aarch64-unknown-linux-gnu'
2024-09-06 23:25:46 +00:00
Zanie Blue
8eff8aab0b
Avoid panicking when encountering an invalid Python version during uv python list (#7131)
Closes https://github.com/astral-sh/uv/issues/7129

Not entirely sure about the best approach yet.
2024-09-06 19:23:16 -04:00
Charlie Marsh
8a0e1fde33
Write trailing newline to .python-version files (#7140)
## Summary

Closes https://github.com/astral-sh/uv/issues/7135.
2024-09-06 18:03:52 -04:00
Amos Wenger
5e1b9b1964
chore: Remove dep on derivative (#7133)
(This is part of #5711)

## Summary

@BurntSushi and I spotted that the `derivative` crate is only used for
one enum in the entire codebase — however, it's a proc macro, and we pay
for the cost of (re)compiling it in many different contexts.

This replaces it with a private `Inner` core which uses the regular std
derive macros — inlining and optimizations should make this equivalent
to the other implementation, and not too hard to maintain hopefully
(versus a manual impl of `PartialEq` and `Hash` which have to be kept in
sync.)

## Test Plan

Trust CI?
2024-09-06 17:46:56 -04:00
Ibraheem Ahmed
22c0be6664 pep508: add graph debug representation for MarkerTree
This PR revives #6129, but is less bold:

* It doesn't rename anything. (I think the rename is probably right
  though.)
* It doesn't change the _default_ `Debug` impl. Instead, it offers this
  as a new `MarkerTree::debug_graph` method.

I found this pretty useful for debugging since it gives a display format
that is more faithful to the internal representation of a `MarkerTree`.
So I think it's worth having around. But making it available in `Debug`
is perhaps a bridge too far since it isn't as familiar as the typical
PEP 508 representation and isn't as succinct.

I did consider printing this when using `{:#?}` (i.e., the "alternate"
debug representation), but too many things use that (like `insta` I
think) to make it practical.

Closes #6129
2024-09-06 16:47:51 -04:00
Carlos Pascual
1b6638fdb4
(doc) Fix wrong examples for locking (#7120)
## Summary

The examples for compile with optional dependencies use `uv pip install`
instead of `uv pip compile` (probably a copy-paste error)

## Test Plan
N/A  This is a minor doc issue. The result is directly rendered.
2024-09-06 08:21:54 -05:00
Dheepak Krishnamurthy
346147db23
chore: Fix typo in docs (#7122)
Remove duplicate `the`.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-06 12:40:26 +00:00
Zanie Blue
8bcae5f2f6
Put CLI changes in "Enhancements" section (#7104)
These overlap too much, I think
2024-09-05 23:09:42 -04:00
Charlie Marsh
72b73a506b
Add distinctive logging for cache prune phases (#7114) 2024-09-05 23:09:29 -04:00
Charlie Marsh
93fe3e83be
Prune unused source distributions from the cache (#7112)
## Summary

This has bothered me for a while and should be fairly impactful for
users. It requires a weird implementation, since the
distribution-building crate depends on the cache, and so the prune
operation can't live in the cache, since it needs to access internals of
the distribution-building crate.

Closes https://github.com/astral-sh/uv/issues/7096.
2024-09-05 21:40:51 -04:00
Zanie Blue
1422e18674
Fixup comment for export --output-file (#7111) 2024-09-05 20:18:39 -05:00
Charlie Marsh
6ae005b0d0
Add --no-emit-project and friends to uv export (#7110)
## Summary

Like `uv sync`, you can omit the current project (`--no-emit-project`),
a specific package (`--no-emit-package`), or the entire workspace
(`--no-emit-workspace`).

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

Closes #6995.
2024-09-06 01:01:46 +00:00
Charlie Marsh
d0f9016eda
Add --output-file to uv export (#7109)
## Summary

Closes https://github.com/astral-sh/uv/issues/7058.
2024-09-05 20:53:53 -04:00
Zanie Blue
3d57b6e795
Add -ExecutionPolicy ByPass to Windows installer recommendations (#7106) 2024-09-05 19:41:40 -05:00
Charlie Marsh
c494f6912c
Take intersection of constraint and requirements hashes (#7108)
## Summary

Small follow-up to #7093.
2024-09-05 20:22:34 -04:00
Zanie Blue
84f25e8cf8
Bump version to 0.4.6 (#7103) 2024-09-05 17:39:53 -05:00
Charlie Marsh
58b25b560c
Invalidate lockfile when member versions change (#7102)
## Summary

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

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-05 17:14:57 -05:00
Charlie Marsh
29f53c3c63
Support --no-build and --no-binary in uv sync et al (#7100)
## Summary

This option already existed, but `--no-binary` always errored.

Closes https://github.com/astral-sh/uv/issues/7099.
2024-09-05 21:45:42 +00:00
Charlie Marsh
f2309bfd1e
Remove timestamp exact vs. approximate enum (#7098) 2024-09-05 20:49:20 +00:00
Charlie Marsh
5b89734c85
Add --require-hashes and --verify-hashes to uv build (#7094) 2024-09-05 15:22:03 -04:00
Charlie Marsh
80f51cee06
Accept --build-constraints in uv build (#7085)
## Summary

Closes #7082.

Closes #7065.
2024-09-05 18:46:36 +00:00
Zanie Blue
b36b7badff
Upgrade to the latest cargo-dist version (#7092)
Notably includes support for
[`UV_INSTALL_DIR`](https://github.com/axodotdev/cargo-dist/blob/main/CHANGELOG.md#app-branded-installer-environment-variables)
2024-09-05 13:30:33 -05:00
Charlie Marsh
bb61513952
Respect hashes in constraints files (#7093)
## Summary

Like pip, if hashes are present on both the requirement and the
constraint, we prefer the requirement.

Closes #7089.
2024-09-05 14:30:10 -04:00
Charlie Marsh
2da795ae8c
Document official setup-uv action (#7056)
## Summary

Closes https://github.com/astral-sh/uv/issues/7047.
2024-09-05 13:59:01 -04:00
Jo
d0fa9ccdfa
Use astral-sh/setup-uv action (#7084)
## Summary

Use the now official `astral-sh/setup-uv` action in
`sync-python-release.yml` workflow.
2024-09-05 13:04:46 -04:00
konsti
750e8b1e2f
Remove propagate_markers (#7076)
Follow-up to #6959 and #6961: Use the reachability computation instead
of `propagate_markers` everywhere.

With `marker_reachability`, we have a function that computes for each
node the markers under which it is (`requirements.txt`, no markers
provided on installation) or can be (`uv.lock`, depending on the markers
provided on installation) included in the installation. Put differently:
If the marker computed by `marker_reachability` is not fulfilled for the
current platform, the package is never required on the current platform.

We compute the markers for each package in the graph, this includes the
virtual extra packages and the base packages. Since we know that each
virtual extra package depends on its base package (`foo[bar]` implied
`foo`), we only retain the base package marker in the `requirements.txt`
graph.

In #6959/#6961 we were only using it for pruning packages in `uv.lock`,
now we're also using it for the markers in `requirements.txt`.

I think this closes #4645, CC @bluss.
2024-09-05 16:52:21 +00:00
konsti
d5eb6eb12c
Move reachability function (#7091)
Split out from #7076
2024-09-05 16:44:21 +00:00
Jakub Beránek
ae16c4e524
Document how to manually update locked package version (#7083)
This PR updates documentation to explicitly mention how to update a
specific package with a locked version to a different version.

Fixes: https://github.com/astral-sh/uv/issues/7019

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-05 16:37:43 +00:00
Zanie Blue
d470dfce8e
Add winget to installers (#7088) 2024-09-05 11:32:57 -05:00
Zanie Blue
27e891ff90
Document how to disable path modifications during install (#7090)
Closes https://github.com/astral-sh/uv/issues/6932
2024-09-05 11:15:39 -05:00
Charlie Marsh
d91f7ddf5f
Don't include registry hashes for URL distributions (#7086)
The opposite _can_ be true.
2024-09-05 11:42:07 -04:00
Ahmed Ilyas
567e213cbb
Accept vec of packages in uv tool uninstall (#7077)
## Summary

Follow up
https://github.com/astral-sh/uv/pull/7037#discussion_r1744515370

## Test Plan

`cargo test`
2024-09-05 08:24:13 -04:00
konsti
316f683071
Update packse (#7002)
Add additional tests for https://github.com/astral-sh/uv/pull/6959 and
https://github.com/astral-sh/uv/pull/6961
2024-09-05 08:14:34 +00:00