Commit graph

3331 commits

Author SHA1 Message Date
Zanie Blue
865f9eeef7
Collapse policies section into reference (#5696) 2024-08-05 17:44:26 +00:00
Zanie Blue
77430a0972
Use uvx in docs serve contributing command (#5795) 2024-08-05 12:41:22 -05:00
Charlie Marsh
ce30bffaab
Make some minor tweaks to the docs (#5786)
## Summary

Small stuff from a first scan.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-05 13:54:06 +00:00
Charlie Marsh
823c17723b
Remove top-level bar from Python installs (#5788) 2024-08-05 02:37:39 +00:00
Charlie Marsh
bb6ac67df3
Use cache for Python install temporary directories (#5787)
## Summary

It's fine for this to be in the cache, I think, since we don't
necessarily need to colocate it with the Python directory.

Closes https://github.com/astral-sh/uv/issues/5747.
2024-08-05 02:32:24 +00: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]
de589af83b
Update pre-commit dependencies (#5782) 2024-08-05 01:42:30 +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
Charlie Marsh
6a80f176a3
Remove some trailing backticks from the docs (#5781) 2024-08-05 00:56:03 +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
Delgan
260d1f546f
Fix broken anchor links in docs about dependencies (#5769) 2024-08-05 00:42:48 +00:00
Charlie Marsh
0b259c8cea
Remove lock from TreeDisplay (#5770) 2024-08-05 00:34:58 +00:00
Charlie Marsh
7567039b80
Avoid lingering dev and optional dependencies in uv tree (#5766)
## Summary

Dev and optional dependencies were appearing at the top-level.
2024-08-04 20:37:01 +00:00
Charlie Marsh
a9a535da14
Use lockfile directly in uv tree (#5761)
## Summary

Ensures that we properly handle (1) duplicated packages and (2) packages
that aren't relevant to the current platform.

Closes https://github.com/astral-sh/uv/issues/5716.
Closes https://github.com/astral-sh/uv/issues/5253.
2024-08-04 14:33:13 -04:00
Charlie Marsh
c5052bc36c
Respect malformed .dist-info directories in tool installs (#5756)
## Summary

Closes https://github.com/astral-sh/uv/issues/5749.
2024-08-03 19:43:03 -04:00
FishAlchemist
26b3bfbedb
Fix the default value of python-preference in docs/reference/settings.md (#5755)
## Summary
After referring to https://github.com/astral-sh/uv/pull/5637 and doing
additional testing.
The default value in a stable state seems more reasonable to be
``only-system``. ``managed`` in preview.
```
cpython-3.11.9-windows-x86_64-none     C:\Users\name\AppData\Local\Programs\Python\Python311\python.exe

cpython-3.10.14-windows-x86_64-none    C:\Users\name\AppData\Roaming\uv\data\python\cpython-3.10.14-windows-x86_64-none\install\python.exe
cpython-3.10.11-windows-x86_64-none    C:\Users\name\AppData\Local\Programs\Python\Python310\python.exe

cpython-3.9.19-windows-x86_64-none     C:\Users\name\AppData\Roaming\uv\data\python\cpython-3.9.19-windows-x86_64-none\python.exe
```
test on uv 0.2.33 (build from
257007ccaf)
### Stable version
``uv venv -p 3.10`` is ``3.10.11`` (System Python)
``uv venv -p 3.9`` is ``No interpreter found``(3.9.19 for managed
Python)
``uv venv -p 3.9 --python-preference only-system`` is ``No interpreter
found``(fail)
``uv venv -p 3.9 --python-preference only-managed`` is
``3.9.19``(success)
Do not use managed Python, only use the system Python, so it can be
determined as ``only-system``.
### Preview mode
**Note:**  ``3.10.14`` is managed python, ``3.10.11`` is system python.
``uv venv -p 3.11 --preview`` is ``3.11.9`` (System Python)
``uv venv -p 3.10 --preview`` is ``3.10.14``
``uv venv -p 3.10 --preview --python-preference only-managed`` is
``3.10.14``
``uv venv -p 3.10 --preview --python-preference managed`` is ``3.10.14``
``uv venv -p 3.10 --preview --python-preference system`` is ``3.10.11``
``venv -p 3.10 --preview --python-preference only-system`` is
``3.10.11``
Prioritize the managed Python and then select the system Python, so it
can be determined as ``managed``.

-----
fixed #5754 
## Test Plan
Run website in local.

![image](https://github.com/user-attachments/assets/02b81d44-1a99-4165-aca5-6ce46345b539)
2024-08-03 23:37:40 +00:00
Charlie Marsh
22dbb1741b
Avoid monomorphization of untar (#5743)
## Summary

This reduces the LLVM lines of the entire project by about 15%.

Before:

```
  Lines                  Copies               Function name
  -----                  ------               -------------
  1742332                42054                (TOTAL)
    22384 (1.3%,  1.3%)     16 (0.0%,  0.0%)  tokio_tar::entry::EntryFields<R>::unpack::{{closure}}
    19113 (1.1%,  2.4%)     69 (0.2%,  0.2%)  alloc::raw_vec::RawVec<T,A>::grow_amortized
    18352 (1.1%,  3.4%)     80 (0.2%,  0.4%)  tokio_tar::entry::EntryFields<R>::unpack::{{closure}}::{{closure}}
    16871 (1.0%,  4.4%)    613 (1.5%,  1.9%)  core::result::Result<T,E>::map_err
    14747 (0.8%,  5.2%)    594 (1.4%,  3.3%)  <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
    12576 (0.7%,  6.0%)     16 (0.0%,  3.3%)  <tokio_tar::archive::Entries<R> as futures_core::stream::Stream>::poll_next
    12314 (0.7%,  6.7%)    226 (0.5%,  3.8%)  <alloc::boxed::Box<T,A> as core::ops::drop::Drop>::drop
    11895 (0.7%,  7.4%)    296 (0.7%,  4.5%)  std::panicking::try
    11718 (0.7%,  8.0%)     63 (0.1%,  4.7%)  alloc::raw_vec::RawVec<T,A>::try_allocate_in
    11152 (0.6%,  8.7%)     16 (0.0%,  4.7%)  uv_extract::stream::untar_in::{{closure}}
    10977 (0.6%,  9.3%)      1 (0.0%,  4.7%)  uv::run::{{closure}}::{{closure}}
    10859 (0.6%,  9.9%)     77 (0.2%,  4.9%)  <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
    10508 (0.6%, 10.5%)     18 (0.0%,  5.0%)  <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::size_hint
    10260 (0.6%, 11.1%)    138 (0.3%,  5.3%)  core::iter::traits::iterator::Iterator::try_fold
    10196 (0.6%, 11.7%)      8 (0.0%,  5.3%)  uv_extract::stream::unzip::{{closure}}
    10178 (0.6%, 12.3%)      7 (0.0%,  5.3%)  uv_client::cached_client::CachedClient::get_cacheable::{{closure}}::{{closure}}
     9698 (0.6%, 12.8%)    293 (0.7%,  6.0%)  tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
```

After:

```
  Lines                  Copies               Function name
  -----                  ------               -------------
  1496463                37891                (TOTAL)
    14958 (1.0%,  1.0%)     54 (0.1%,  0.1%)  alloc::raw_vec::RawVec<T,A>::grow_amortized
    13997 (0.9%,  1.9%)    564 (1.5%,  1.6%)  <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
    12776 (0.9%,  2.8%)    463 (1.2%,  2.9%)  core::result::Result<T,E>::map_err
    12381 (0.8%,  3.6%)    227 (0.6%,  3.5%)  <alloc::boxed::Box<T,A> as core::ops::drop::Drop>::drop
    11895 (0.8%,  4.4%)    296 (0.8%,  4.2%)  std::panicking::try
    10977 (0.7%,  5.1%)      1 (0.0%,  4.2%)  uv::run::{{closure}}::{{closure}}
    10859 (0.7%,  5.9%)     77 (0.2%,  4.4%)  <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
    10508 (0.7%,  6.6%)     18 (0.0%,  4.5%)  <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::size_hint
    10196 (0.7%,  7.3%)      8 (0.0%,  4.5%)  uv_extract::stream::unzip::{{closure}}
    10178 (0.7%,  7.9%)      7 (0.0%,  4.5%)  uv_client::cached_client::CachedClient::get_cacheable::{{closure}}::{{closure}}
     9698 (0.6%,  8.6%)    293 (0.8%,  5.3%)  tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
     9078 (0.6%,  9.2%)      9 (0.0%,  5.3%)  core::slice::sort::partition_in_blocks
     8928 (0.6%,  9.8%)     48 (0.1%,  5.4%)  alloc::raw_vec::RawVec<T,A>::try_allocate_in
     8288 (0.6%, 10.3%)    296 (0.8%,  6.2%)  std::panicking::try::do_catch
     8190 (0.5%, 10.9%)    108 (0.3%,  6.5%)  core::iter::traits::iterator::Iterator::try_fold
     7540 (0.5%, 11.4%)    466 (1.2%,  7.7%)  core::ops::function::FnOnce::call_once
     6612 (0.4%, 11.8%)    296 (0.8%,  8.5%)  std::panicking::try::do_call
     6513 (0.4%, 12.3%)     56 (0.1%,  8.7%)  tokio::runtime::task::core::Cell<T,S>::new
     6438 (0.4%, 12.7%)    269 (0.7%,  9.4%)  alloc::boxed::Box<T>::new
     6360 (0.4%, 13.1%)     20 (0.1%,  9.4%)  <toml_edit:🇩🇪:value::ValueDeserializer as serde:🇩🇪:Deserializer>::deserialize_any
```
2024-08-03 23:29:17 +00:00
Charlie Marsh
257007ccaf
Omit local segments when adding uv add bounds (#5753)
## Summary

Closes https://github.com/astral-sh/uv/issues/5752.
2024-08-03 17:35:53 +00:00
konsti
ba924d298f
Better workspace documentation (#5728)
Add more context around using workspaces.

Closes #5604.

Preview (ignore the glitchy navbar):


![image](https://github.com/user-attachments/assets/61b08a9c-958a-4529-8781-509597704350)
2024-08-03 08:49:09 -05:00
konsti
6e310f2702
Rewrite resolver docs (#5723)
This PR rewrites the resolver concept and adds a resolver internals page
targeted at power users.

The new resolution concept documentation has three parts:
* An introduction for people how never heard of "resolution" before, and
a motivating example what it does. I've also shoved the part about
equally valid resolutions in there.
* Features you commonly use: Non-universal vs. universal resolution,
lowest resolution amd pre-releases.
* Expert features, we don't advertise them, you'll only need them in
complex cases when you already know and i kept them to the reference
points you need in this case: Constraints, overrides and exclude-newer.

I intentionally didn't lay out any detail of the resolution itself, the
idea is that users get a vague sense of "uv has to select fitting
versions", but then they learn the options they have to use and some
common failure points without ever coming near SAT or even graphs.

The resolution internals reference page is targeted at power users who
need to understand what is going on behind the scenes. It assumes ample
prior knowledge and exists to explain the uv-specific behaviors for
someone who already understands dependency resolution conceptually and
has interacted with their dependency tree before. I had a section on the
lockfile but removed it because it found the lockfile to be too
self-documenting.

I haven't touched the readme.

Closes #5603
Closes #5238
Closes #5237

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-03 08:47:11 -05:00
Zanie Blue
44a6dbfa53
Improvements to the documentation (#5718) 2024-08-03 08:41:33 -05:00
konsti
00981732a6
Always strip in release mode (#5745)
Decreases linux release wheel size by 2MB.

See https://github.com/rust-lang/cargo/issues/14346

Fixes #5683
2024-08-03 13:11:02 +02:00
Charlie Marsh
35b982446d
Respect pre-release preferences from input files (#5736)
## Summary

Right now, if you have a `requirements.txt` with a pre-release, but the
`requirements.in` does not have a pre-release marker for that dependency
we drop the pre-release. (In the selector, we end up returning
`AllowPrerelease::IfNecessary`, the default.)

I played with a few ways of solving this... The first was to remove that
guard altogether. But if we do that,
`universal_transitive_disjoint_prerelease_requirement` fails (we use
`1.17.0rc1` in both forks, when it should only apply to one of the two).

The second was to do that, but also avoid pushing pre-releases as
preferences when we solve a fork. But then
`universal_disjoint_prereleases` fails, because we return a different
pre-release in each fork.

Finally, I settled on allowing existing pre-releases in forks if they
have no markers on them, i.e., they are "global" preferences. I believe
this is true IFF the preference came from an existing lockfile.

Closes https://github.com/astral-sh/uv/issues/5729.
2024-08-02 22:01:58 -04:00
Charlie Marsh
030d477653
Respect .python-version in --isolated runs (#5741)
Closes https://github.com/astral-sh/uv/issues/5740.
2024-08-02 23:34:25 +00:00
Charlie Marsh
b26794bf6f
Remove double-proxy nodes in error reporting (#5738)
## Summary

If _both_ nodes in the derivation tree are proxies, we need to remove
the _entire_ node. So, the function now returns an `Option<Tree>`
instead of taking `&mut Tree`.

Closes https://github.com/astral-sh/uv/issues/5618.
2024-08-02 21:27:07 +00:00
Charlie Marsh
097aa929b7
Skip files when detecting workspace members (#5735)
## Summary

Closes https://github.com/astral-sh/uv/issues/5724.
Closes https://github.com/astral-sh/uv/issues/5725.
2024-08-02 19:44:43 +00:00
Jelle Zijlstra
4096bcef3e
docs: fix typo (#5732)
Co-authored-by: konstin <konstin@mailbox.org>
2024-08-02 18:23:53 +00:00
konsti
db371560bc
Use prettier to format the documentation (#5708)
To enforce the 100 character line limit in markdown files introduced in
https://github.com/astral-sh/uv/pull/5635, and to automate the
formatting of markdown files, i've added prettier and formatted our
markdown files with it.

I've excluded the changelog and the generated references documentation
from this for having too many changes, but we can also include them.

I'm not particular on which style we use. My main motivations are
(major) not having to reflow markdown files myself anymore and (minor)
consistence between all markdown files. I've chosen prettier for similar
reason as we chose black, it's a single good style that's automated and
shared in the community. I do prefer prettier's style of not breaking
inside of a link name though.

This PR is in two parts, the first adds prettier to CI and documents
using it, while the second actually formats the docs. When merge
conflicts arise, we can drop the last commit and regenerate it with `npx
prettier --prose-wrap always --write BENCHMARKS.md CONTRIBUTING.md
README.md STYLE.md docs/*.md docs/concepts/**/*.md docs/guides/**/*.md
docs/pip/**/*.md`.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-02 08:58:31 -05:00
eth3lbert
f2c4b9c752
Show default and possible options in CLI reference documentation (#5720)
## Summary

Closes #5692 .
2024-08-02 12:55:50 +00:00
Ahmed Ilyas
a6416aa450
Fix CLI reference URLs to subcommands (#5722)
## Summary

Currently all of these links end up 404-ed. I've added a `#` to fix the
URLs.

<img width="653" alt="Screenshot 2024-08-02 at 12 34 22"
src="https://github.com/user-attachments/assets/9b66adcc-431c-441a-8f4f-1b579472fdce">

## Test Plan

Checked manually.
2024-08-02 07:35:33 -05:00
Ahmed Ilyas
ff9f3dede1
Support build constraints (#5639)
## Summary

Partially resolves #5561. Haven't added overrides support yet but I can
add it tomorrow if the current approach for constraints is ok.

## Test Plan

`cargo test`

Manually checked trace logs after changing the constraints.
2024-08-02 02:15:58 +00:00
Zanie Blue
c558d70690
Install Python versions with previous uv release (#5717)
Part of https://github.com/astral-sh/uv/issues/5713

Shaves 50s or ~25% off the Ubuntu test run. Maybe 30s or 8% off macOS.
Windows already uses the GitHub distributions.

Note this is some of our only test coverage for Python version installs,
we may want to add separate coverage to compensate.
2024-08-01 18:59:28 -05:00
Zanie Blue
b14945a7b1
Bump version to 0.2.33 (#5712) 2024-08-01 21:39:17 +00:00
Charlie Marsh
7efed62798
Add a dedicated error for members with mismatched Python requirements (#5695)
## Summary

Gives you a nice error message if you attempt to sync with, e.g., `-p
3.8` when that version is supported by at least one workspace member,
but your project's minimum requirement is `>=3.12`

Closes https://github.com/astral-sh/uv/issues/5662.
2024-08-01 21:37:13 +00:00
Charlie Marsh
69b8b16c75
Support dev dependencies in virtual workspace roots (#5709)
## Summary

Closes https://github.com/astral-sh/uv/issues/5650.
2024-08-01 21:04:30 +00:00
Charlie Marsh
499c368f1e
Use "pre-release" in prose and Prerelease in code (#5697)
## Summary

Closes https://github.com/astral-sh/uv/issues/5630.
2024-08-01 20:56:29 +00:00
Zanie Blue
6797caccdb
Update top-level command descriptions (#5706)
Addresses feedback in https://github.com/astral-sh/uv/pull/5700
2024-08-01 20:29:26 +00:00
Charlie Marsh
3a8ee0be57
Limit sync after uv add (#5705)
## Summary

I think it's reasonable to only sync the affected group, e.g., `uv add`
on its own should not require syncing all extras.

Closes https://github.com/astral-sh/uv/issues/4418.
2024-08-01 15:22:38 -05:00
konsti
78d4045729
Don't use equals signs for cli args with value (#5704)
Use a consistent style for cli arguments with a value, e.g.
`--resolution lowest`, not `--resolution=lowest`.
2024-08-01 14:17:30 -05:00
Zanie Blue
34f657c964
Unhide the experimental top-level commands (#5700) 2024-08-01 14:06:07 -05:00
Zanie Blue
3c7526b855
Add CLI reference to generate-all (#5701) 2024-08-01 18:32:29 +00:00
Charlie Marsh
ad384ecacf
Set lower bounds in uv add (#5688)
## Summary

Closes https://github.com/astral-sh/uv/issues/5178.
2024-08-01 13:06:57 -04:00