Commit graph

4903 commits

Author SHA1 Message Date
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
Zanie Blue
159108b728
Move --python and --python-version into the "Python options" help (#5691)
Part of #4454 

e.g. for `uv help pip compile`

```
Python options:
      --python <PYTHON>
          The Python interpreter against which to compile the requirements.
          
          By default, uv uses the virtual environment in the current working directory or any parent
          directory, falling back to searching for a Python executable in `PATH`. The `--python`
          option allows you to specify a different interpreter.
          
          Supported formats:
          - `3.10` looks for an installed Python 3.10 using `py --list-paths` on Windows, or
            `python3.10` on Linux and macOS.
          - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
          - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.

  -p, --python-version <PYTHON_VERSION>
          The minimum Python version that should be supported by the resolved requirements (e.g., `3.8` or `3.8.17`).
          
          If a patch version is omitted, the minimum patch version is assumed. For example, `3.8` is mapped to `3.8.0`.

      --python-preference <PYTHON_PREFERENCE>
          Whether to prefer using Python installations that are already present on the system, or those that are downloaded and installed by uv

          Possible values:
          - only-managed: Only use managed Python installations; never use system Python installations
          - managed:      Prefer managed Python installations over system Python installations
          - system:       Prefer system Python installations over managed Python installations
          - only-system:  Only use system Python installations; never use managed Python installations

      --python-fetch <PYTHON_FETCH>
          Whether to automatically download Python when required

          Possible values:
          - automatic: Automatically fetch managed Python installations when needed
          - manual:    Do not automatically fetch managed Python installations; require explicit installation
 ```
2024-08-01 11:55:11 -05:00
Charlie Marsh
ff2e1fcec0
Support legacy tool receipts with PEP 508 requirements (#5679)
## Summary

In #5494, I made breaking changes to the tool receipt format. This would
break existing tools for all users. This PR makes the change
backwards-compatible by supporting deserialization for the deprecated
format.

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

## Test Plan

Beyond the automated tests, you can run `cargo run tool list` on your
existing machine.

Before:

```
warning: `uv tool list` is experimental and may change without warning
warning: Ignoring malformed tool `black` (run `uv tool uninstall black` to remove)
warning: Ignoring malformed tool `poetry` (run `uv tool uninstall poetry` to remove)
warning: Ignoring malformed tool `ruff` (run `uv tool uninstall ruff` to remove)
```

After:

```
warning: `uv tool list` is experimental and may change without warning
black v0.1.0
- black
poetry v1.8.3
- poetry
ruff v0.0.60
- ruff
```
2024-08-01 12:43:29 -04:00
Charlie Marsh
b9b41d4a38
Include newly-added optional dependencies in lockfile (#5686)
## Summary

When we add a new optional group in `uv add`, we never to update the
`pyproject.toml` before locking. Otherwise, we use the stale
`pyproject.toml` and omit the optional group.

Closes https://github.com/astral-sh/uv/issues/5687.
2024-08-01 12:41:37 -04:00
Zanie Blue
64c6caa57b
Fixup settings reference (#5694)
Fixes #5689
2024-08-01 16:41:26 +00:00
Zanie Blue
0f30c69624
Move settings reference to reference section (#5689)
Joining #5685 in a dedicated reference section
2024-08-01 16:20:30 +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
eth3lbert
9788496c51
Grouping GlobalArgs to dedicated heading (#5665)
## Summary

Part of #4454 .

## Test Plan

test cases included.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-01 10:01:22 -05:00
konsti
9a1a2118e1
Add transformers pyproject.toml to test requirements (#5657)
This `pyproject.toml`, translated from
0e4a1c3401/setup.py,
has found a number of bugs in blue jay, so i'm adding it to uv as a
development test case. (The file is too large to make it a test by
itself.)
2024-08-01 13:25:20 +02:00
Charlie Marsh
b9866b3ee8
Avoid unwrap when serializing receipts (#5678) 2024-07-31 22:57:16 -04:00
Zanie Blue
df6106f5bf
Use "uv" for title of index instead of "Introduction" (#5677)
<img width="807" alt="Screenshot 2024-07-31 at 5 12 48 PM"
src="https://github.com/user-attachments/assets/8a3cc824-c242-4688-a7d9-5b88198a6b94">
vs
<img width="807" alt="Screenshot 2024-07-31 at 5 13 21 PM"
src="https://github.com/user-attachments/assets/04f77771-94c3-4d2e-81d2-2db63aa649bd">
2024-07-31 18:24:55 -05:00
Ahmed Ilyas
5bded73c48
uvx warn when no executables are available (#5675)
## Summary

Resolves #5623 

## Test Plan

`cargo test`
2024-07-31 17:27:41 -05:00
Zanie Blue
ed520580a1
Remove breadcrumbs for navigation (#5676)
Closes https://github.com/astral-sh/uv/issues/5671

These are effectively worthless since it never displays more than one
level.
2024-07-31 17:10:31 -05:00
Zanie Blue
b0e37859ed
Bold active nav links for accessibility (#5673)
Before
<img width="412" alt="Screenshot 2024-07-31 at 3 47 38 PM"
src="https://github.com/user-attachments/assets/d95ebb62-079b-4e20-964c-9876b5978e4c">
After
<img width="412" alt="Screenshot 2024-07-31 at 3 47 21 PM"
src="https://github.com/user-attachments/assets/a658d46a-3eeb-4f00-8952-d4c1dd91afe6">
2024-07-31 16:16:48 -05:00
Charlie Marsh
ff2b810fdf
Fix non-registry serialization for receipts (#5668)
## Summary

Fixes a bug in #5494. The `RequirementSourceWire` representation was
ambiguous, and so the order of the fields meant that all variants were
mapped to `Registry` when deserializing. (So the snapshots were right,
but behaviors were wrong.)
2024-07-31 21:09:54 +00:00
Zanie Blue
9e4fbd2111
Move pip-compatibility doc into pip interface section (#5670) 2024-07-31 20:30:10 +00:00
Charlie Marsh
2b9a4f673e
Initialize the cache in uv init (#5669)
## Summary

We now query the Python interpreter here, which means we need cache
access.
2024-07-31 19:46:12 +00:00
Charlie Marsh
f8e2d2f54d
Remove lingering executables after failed installs (#5666)
## Summary

This could still be made more robust, but it's not critical, since you
can always `--force`. It's good to handle this case, though, since we
have an explicit error for it.

Closes https://github.com/astral-sh/uv/issues/5490.
2024-07-31 15:27:24 -04:00
Charlie Marsh
4b8a127c54
Avoid persisting uv add calls that result in resolver errors (#5664)
## Summary

Closes https://github.com/astral-sh/uv/issues/5622.
2024-07-31 13:27:34 -04:00
eth3lbert
54398fa7bc
Show help specific options in uv help (#5516)
## Summary

Resolves #5221 

## Test Plan

Test case included.
2024-07-31 12:10:57 -05:00
Zanie Blue
ef84380954
Add documentation for caching the uv cache in GHA (#5663)
Related to https://github.com/astral-sh/uv/issues/5409
2024-07-31 11:38:54 -05:00
Pavel Dikov
d05f2b258b
fix(venv): make relocatable activation scripts support ksh (#5640)
It transpires that detecting the directory a script was sourced from is
non-trivial across `bash`, `ksh` and `zsh`.

The previous version was a one-liner and supported `bash` and `zsh` but
not `ksh`.

It is possible to keep the one-liner and add `ksh` support, but that is
mutually-exclusive with `zsh`.

Therefore, the only way to square this circle is to add an `if` block. A
silver lining here is that although longer, the script is probably
easier to follow as there is less code-golfing going on.
2024-07-31 12:18:11 -04: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
bf8934e3e4
Use intersection rather than union for requires-python (#5644)
## Summary

As-is, if you have a workspace with mixed `requires-python`
requirements, resolution will _never_ succeed, since we'll use the union
as the `requires-python` bound (i.e., take the lowest value), and fail
when we see the package that only supports some more narrow range.

This PR modifies the behavior to take the intersection (i.e., the
highest value), so if you have one package that supports Python 3.12 and
later, and another that supports Python 3.8 and later, we lock for
Python 3.12. If you try to sync or run with Python 3.8, we raise an
error, since the lockfile will be incompatible with that request.

Konsti has a write-up in https://github.com/astral-sh/uv/issues/5594
that outlines what could be a longer-term strategy.

Closes https://github.com/astral-sh/uv/issues/5578.
2024-07-31 16:08:53 +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
Zanie Blue
8d14a4cb4f
Simplify GHA UV_SYSTEM_PYTHON examples (#5659) 2024-07-31 10:49:40 -05:00
Zanie Blue
22d152192d
Improvements to the dependency concept doc (#5658) 2024-07-31 15:44:25 +00:00
konsti
2247b0f540
Check idempotence in packse lock scenarios (#5485)
Add tests for the instabilities fix.

Part of
https://github.com/astral-sh/uv/issues/5180#issuecomment-2247696198

Closes #5180
2024-07-31 15:39:16 +00:00
konsti
38c6033010
Use fork markers and fork preferences in resolution with lockfile (#5481)
By resolving for each fork from the lockfile individually and by adding
using preferences for the current fork, we solve the instability #5180.
I've tested the locally and will add the packse test scenarios upstack.

Part of
https://github.com/astral-sh/uv/issues/5180#issuecomment-2247696198
2024-07-31 15:18:58 +00:00