Commit graph

4903 commits

Author SHA1 Message Date
Ilya Grigoriev
e31252e82e
docs installation.md: describe how to pass options to the installer on Linux (#6839)
(This is a suggestion that was easy for me to make a PR for; if other
approaches are considered better, feel free to consider this as a FR for
those instead)

I'd feel more comfortable using the installer with the instructions in
this commit, since I'm uncomfortable with random scripts trying to
modify my system config (PATH in this case).

Currently, the installer seems to be the best way to install `uv` that
allows updating it on a system without Homebrew or `pipx`. I hope
somebody will provide similar instructions for Windows.

I considered recommending saving the script to a file and then running
that, but I think it's better to have fewer options in the instructions.
Most people who'd want to save the file would figure it out.

As an aside, I would personally appreciate if `uv` could be installed
easily with `cargo install` or `cargo binstall`, but a friendly script
that acts predictably is probably more useful for more people.


## Test Plan

I tested the command on my machine, but I did not test compiling the
docs (yet). If the CI does not compile the docs, I could test this a bit
later, or perhaps this would be easier for somebody who already has a
dev environment set up.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-17 16:09:30 +00:00
Zanie Blue
8d7925026d
Add VersionRequest test cases for post and dev segments (#7464) 2024-09-17 10:59:41 -05:00
Charlie Marsh
778da3350a
Add --no-editable support to uv sync and uv export (#7371)
## Summary

Closes https://github.com/astral-sh/uv/issues/5792.
2024-09-17 14:50:36 +00:00
Mikko Leppänen
bb0ffa32e4
Support pre-releases in Python version requests - command --python <major.minor.pre-release> (#7335)
## Summary

This PR adds support to include Python pre-releases when requesting
versions.
Check out the docs for commands that support the `Python` option: 
```text
--python, -p python
The Python interpreter to use for the virtual environment.
```
At least the following scenarios are supported:
```bash
3.13.0a1
3.13b2
3.13rc4
313rc1
```

## Test Plan

I added a basic unit test to `uv/crates/uv-python/src/discovery.rs`. I
could have added more, but I have not discovered any relevant places.

CI passes

Note: I was unable to execute the entire test set locally. There were at
least some timeout issues (some tests took over 60 seconds).

========== output ===========
beta version
```bash
cargo run -- venv --python 3.13.0b3                                                                                                           ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/uv venv --python 3.13.0b3`
Using Python 3.13.0b3 interpreter at: /home/mikko/.pyenv/versions/3.13.0b3/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
````
release candidate
```bash
 cargo run -- venv --python 3.13.0rc2                                                                                                          ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.83s
     Running `target/debug/uv venv --python 3.13.0rc2`
Using Python 3.13.0rc2 interpreter at: /home/mikko/.pyenv/versions/3.13.0rc2/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

```bash
cargo run -- venv --python 313rc2                                                                                                             ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
     Running `target/debug/uv venv --python 313rc2`
Using Python 3.13.0rc2 interpreter at: /home/mikko/.pyenv/versions/3.13.0rc2/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-17 09:46:46 -05:00
Charlie Marsh
2cb3acdb1f
Remove uvx shell completion instructions (#7459)
## Summary

I misunderstood and this isn't necessary.
2024-09-17 09:28:28 -04:00
Charlie Marsh
c87ce7aaf8
Run cargo upgrade (#7448)
Co-authored-by: konstin <konstin@mailbox.org>
2024-09-17 12:39:58 +02:00
Zanie Blue
f679987fe1
Include the parent interpreter in Python discovery when --system is used (#7440)
Closes https://github.com/astral-sh/uv/issues/7417

Tested with this epic blurb

```
❯ uv pip install --python /Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3 . --break-system-packages --reinstall
Resolved 1 package in 0.91ms
   Built uv @ file:///Users/zb/workspace/uv
Prepared 1 package in 2m 48s
Uninstalled 1 package in 1ms
Installed 1 package in 1ms
 - uv==0.4.10
 + uv==0.4.10 (from file:///Users/zb/workspace/uv)
❯ /Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3 -m uv pip install --system -v httpx
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in system path
DEBUG Found `cpython-3.13.0rc2-macos-aarch64-none` at `/Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3` (parent interpreter)
DEBUG Using Python 3.13.0rc2 environment at /Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3
```
2024-09-16 22:51:50 -05:00
bluss
e9378be919
Generate shell completion for uvx (#7388)
## Summary

Generate shell completion for uvx.

Create a `uvx` toplevel command just for completion by combining `uv
tool uvx` (hidden alias for `uv tool run`) with global arguments. This
explicit combination is needed otherwise global arguments are missing
(if they are missing, clap debug assertions fail when `uv tool run`
arguments refer to global arguments in directives like conflicts with).


Fixes #7258 

## Test Plan

- Tested using bash using `eval "$(cargo run --bin uv
generate-shell-completion bash)"`
2024-09-17 03:27:19 +00:00
Charlie Marsh
d1c7cb8bc2
Include --branch et al when resolving unnamed URLs in uv add (#7447)
## Summary

Closes #7433.
2024-09-16 22:21:42 -04:00
Charlie Marsh
424ee439d6
Use consistent PyPI cache bucket (#7443)
## Summary

All the registry wheels were getting cached under
`index/b2a7eb67d4c26b82` rather than `pypi`, because we used
`IndexUrl::Url` rather than `IndexUrl::from`.
2024-09-16 23:33:32 +00:00
Charlie Marsh
9f7d9da449
Prune unzipped source distributions in uv cache prune --ci (#7446)
## Summary

It's very unlikely that retaining these is beneficial, since you tend to
partition the cache by platform anyway.

Closes https://github.com/astral-sh/uv/issues/7394.
2024-09-16 19:18:20 -04:00
Charlie Marsh
e31851fb52
Avoid erroneous version warning for .dist-info (#7444)
## Summary

Since https://github.com/astral-sh/uv/pull/7208, this is now _always_
firing, for every directory, because the version gets normalized (e.g.,
`1.2.3` gets normalized to `1-2-3`, which never matches the parsed
version). pip doesn't warn here, I guess we won't either, because I
can't figure out a robust way to do this... We need to get the
non-normalized remainder after stripping the normalized package name,
but we strip the normalized package name from the normalized string, so
we only have a normalized remainder.
2024-09-16 22:32:56 +00:00
Zanie Blue
d3e6765cea
Add test case for Python selection when invoked with python -m uv --system (#7439) 2024-09-16 15:42:06 -05:00
Zanie Blue
6066989ed4
Add test case for Python pre-release versions from parent interpreter (#7438) 2024-09-16 15:41:58 -05:00
Zanie Blue
e8899fe7f9
Add test case for Python pre-release versions from VIRTUAL_ENV (#7437) 2024-09-16 15:41:53 -05:00
Charlie Marsh
5f2e536925
Add support for --only-dev to uv sync and uv export (#7367)
## Summary

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

Closes https://github.com/astral-sh/uv/issues/6472.
2024-09-16 20:06:20 +00:00
Luca Bruno
23494d85ab
Warn when trying to uv sync a package without build configuration (#7420)
This enhances `uv sync` logic in order to detect and warn if it is
trying to operate on a packaged project with entrypoints.

Ref: https://github.com/astral-sh/uv/issues/6998#issuecomment-2329291764
Closes: https://github.com/astral-sh/uv/issues/7034
2024-09-16 17:50:42 +02:00
konsti
d4f4dedc3b
Ignore activate venv in tests (#7423) 2024-09-16 11:28:14 +00:00
konsti
cad934316f
Fix sourc distribution filename escaping (#7421) 2024-09-16 10:25:46 +00:00
Charlie Marsh
6a9ec9665c
Include dev-dependencies with --no-sources (#7408)
## Summary

Running `uv lock --no-sources` should still include dev dependencies,
since dev dependencies are defined separately from sources.

Closes https://github.com/astral-sh/uv/issues/7406.
2024-09-15 22:29:03 -04:00
renovate[bot]
1e71d9d121
Update pre-commit hook astral-sh/ruff-pre-commit to v0.6.5 (#7414)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[astral-sh/ruff-pre-commit](https://redirect.github.com/astral-sh/ruff-pre-commit)
| repository | patch | `v0.6.4` -> `v0.6.5` |

Note: The `pre-commit` manager in Renovate is not supported by the
`pre-commit` maintainers or community. Please do not report any problems
there, instead [create a Discussion in the Renovate
repository](https://redirect.github.com/renovatebot/renovate/discussions/new)
if you have any questions.

---

### Release Notes

<details>
<summary>astral-sh/ruff-pre-commit (astral-sh/ruff-pre-commit)</summary>

###
[`v0.6.5`](https://redirect.github.com/astral-sh/ruff-pre-commit/releases/tag/v0.6.5)

[Compare
Source](https://redirect.github.com/astral-sh/ruff-pre-commit/compare/v0.6.4...v0.6.5)

See: https://github.com/astral-sh/ruff/releases/tag/0.6.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/uv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW50ZXJuYWwiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-15 20:08:53 -05:00
Charlie Marsh
f895c40a4e
Avoid removing seed packages for uv venv --seed environments (#7410)
## Summary

Closes https://github.com/astral-sh/uv/issues/7121.
2024-09-15 22:27:52 +00:00
Charlie Marsh
8d4b6ca971
Add documentation on platform-specific dependencies (#7411)
## Summary

Closes https://github.com/astral-sh/uv/issues/6758.
2024-09-15 17:55:37 -04:00
Charlie Marsh
7ab1ea22f6
Run cargo update (#7413) 2024-09-15 14:46:29 -04:00
Charlie Marsh
aa71c898f6
Avoid unnecessary progress bar initializations (#7412)
## Summary

Closes https://github.com/astral-sh/uv/issues/6343.
2024-09-15 18:18:28 +00:00
Charlie Marsh
19868455c4
Respect --no-sources in PEP 723 scripts (#7409)
## Summary

Just an oversight.
2024-09-15 16:55:38 +00:00
Charlie Marsh
e07281deb3
Surface dedicated project.name error for workspaces (#7399)
## Summary

An extension of https://github.com/astral-sh/uv/pull/6803 to cover `uv
run`.
2024-09-14 20:46:21 +00:00
konsti
4aad89cf06
Hint at missing project.name (#6803)
We got user reports where users were confused about why they can't use
`[project.urls]` in `pyproject.toml` (i think that's from poetry?). This
PR adds a hint that (according to PEP 621), you need to set
`project.name` when using any `project` fields. (PEP 621 also requires
`project.version` xor `dynamic = ["version"]`, but we check that later.)

The intermediate parsing layer to tell apart syntax errors from schema
errors doesn't incur a performance penalty according to epage
(https://github.com/toml-rs/toml/issues/778#issuecomment-2310369253).

Closes #6419
Closes #6760
2024-09-14 20:03:47 +00:00
Aditya Pratap Singh
3d62154849
Add support for remaining pip-supported file extensions (#7387)
closes #7365 

Summary

This pull request adds support for additional file extension aliases in
the SourceDistExtension and ExtensionError enums. The newly supported
file extensions include .tbz, .tgz, .txz, .tar.lz, .tar.lzma. These
changes align the extensions supported by the SourceDistExtension with
those used in Python packaging tools, enhancing compatibility with a
broader range of source distribution formats.

Test Plan
should be added or updated to verify that the new extensions are
correctly recognized as valid source distributions and that errors are
correctly raised when unsupported extensions are provided.
2024-09-14 19:59:07 +00:00
Charlie Marsh
3060fd22c0
Remove duplicate warning for settings discovery errors (#7384)
## Summary

These are often (but not always) duplicated, and I find it really janky.
This PR makes them tracing warnings instead.
2024-09-14 00:09:15 -04:00
Charlie Marsh
083ec2f1bf
Error when tool.uv.sources contains duplicate package names (#7383)
## Summary

Closes https://github.com/astral-sh/uv/issues/7229.
2024-09-13 23:37:23 -04:00
Mathieu Kniewallner
211fa91c2a
docs: separate project from configuration settings (#7053)
<!--
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

Part of https://github.com/astral-sh/uv/issues/7007.

Settings documentation reference currently doesn't separate "project
metadata" and "configuration" options, implying that it's possible to
set things like `dev-dependencies` in `uv.toml` while it's not. This is
an attempt at better separating those options, by having 2 different
sections:
- `Project metadata`, that holds configuration that can only be set in
`pyproject.toml`
- `Configuration`, that holds configuration that can be set both in
`pyproject.toml` and `uv.toml`

Here are some screenshots to show what this looks like (note that I
don't have code highlighting in the right navigation, which makes them
clunky, as first item is always bigger because of the missing "span" --
I think that's because it's an `mkdocs-material` insider feature, since
I have the same thing on `main` branch):

- Right side navigation:

<img width="241" alt="Screenshot 2024-09-05 at 01 19 50"
src="https://github.com/user-attachments/assets/012f64a4-8d34-4e34-a506-8d02dc1fbf98">

<img width="223" alt="Screenshot 2024-09-05 at 01 20 01"
src="https://github.com/user-attachments/assets/0b0fb71d-c9c3-4ee3-8f6e-cf35180b1a99">

- An option from "Project metadata" section that only applies to
`pyproject.toml`:

<img width="788" alt="Screenshot 2024-09-05 at 01 20 11"
src="https://github.com/user-attachments/assets/64349fbb-8623-4b81-a475-d6ff38c658f1">

- An option from "Configuration" section that applies both to
`pyproject.toml` and `uv.toml`:

<img width="787" alt="Screenshot 2024-09-05 at 01 20 33"
src="https://github.com/user-attachments/assets/732e43d3-cc64-4f5a-8929-23a5555d4c53">

## Test Plan

Local run of the documentation.

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-13 20:57:51 -04:00
Charlie Marsh
54f171c80a
Use unambiguous relative paths in uv export (#7378) 2024-09-13 20:48:46 +00:00
Dan Watson
c1888364b5
Include uv export command in output (#7374)
## Summary

Updates the output of `uv export` to include the command that produced
it, similar to how `uv pip compile` does. This addresses #7159 - I had
this same itch today, figured it was a good time to dive in!

## Test Plan

All the export unit tests were updated to test the new output format.
2024-09-13 16:15:11 -04:00
Charlie Marsh
6907164841
Bump version to v0.4.10 (#7368) 2024-09-13 13:46:56 -04:00
Hanlu
085558502a
chore: fix typos (#7366)
<!--
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

<!-- What's the purpose of the change? What does it do, and why? -->

 fix symbol error

## Test Plan

<!-- How was it tested? -->

Signed-off-by: liangmulu <liangmulu@outlook.com>
2024-09-13 16:25:19 +00:00
Charlie Marsh
d9f53cc83f
Always treat archive-like requirements as local files (#7364)
## Summary

`uv pip install foo.tar.gz` will now always treat `foo.tar.gz` as a
local file. This matches pip's behavior.

Closes https://github.com/astral-sh/uv/issues/7309.
2024-09-13 16:01:25 +00:00
Nathan McDougall
f82224124e
Fix grammatical error in CLI docs (#7353)
Fixing a grammatical error in the CLI docs, namely `in adhere with` ->
`in adherence with`.
2024-09-13 15:51:59 +00:00
Charlie Marsh
613a7d5c5d
Make version ID optional for source builds (#7362)
## Summary

Fixes a bug in which source builds would fail at the top-level of a
container.

Closes https://github.com/astral-sh/uv/issues/7346.
2024-09-13 10:52:25 -04:00
Ahmed Ilyas
b896657275
Allow uv tool upgrade --all to continue on individual upgrade failure (#7333)
## Summary

Resolves #7294 

## Test Plan

`cargo test`
2024-09-12 19:41:11 +00:00
Frost Ming
e1e85ab4c8
feat(cli): add --token option to self update command (#7279)
<!--
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

It often reaches the GitHub API rate limit and shows error like `error:
HTTP status client error (403 Forbidden) for url
(https://api.github.com/repos/astral-sh/uv/releases)` when running `uv
self update`.

To bypass this rate limit issue, allow user to pass a GitHub token via
`--token` or `UV_GITHUB_TOKEN` env.

## Test Plan

<!-- How was it tested? -->

---------

Signed-off-by: Frost Ming <me@frostming.com>
2024-09-12 14:27:54 -05:00
Charlie Marsh
3d2b94f0b0
Clarify Python requirement source for script incompatibilities (#7339)
## Summary

Closes https://github.com/astral-sh/uv/issues/7293.
2024-09-12 19:19:42 +00:00
Zanie Blue
dcde459179
Avoid clobbering existing py.typed files contents in uv init (#7338) 2024-09-12 19:10:30 +00:00
Aditya Pratap Singh
adcb67a882
Fix documentation typos for uv build --build-constraint flag (#7330)
Summary

This pull request fixes a typo in the --build-constraints flag, which
should be singular (--build-constraint). This update ensures consistency
across the documentation and prevents potential confusion for users.

Closes #7315

## Test Plan
The change was verified by reviewing the relevant documentation files
where the flag is referenced. No functional code changes were made, so
no additional testing is required beyond confirming the documentation
update.

## Tested
The change was tested by visually inspecting the updated documentation
to confirm that the typo has been corrected
2024-09-12 14:07:33 -05:00
Charlie Marsh
65d53a7474
Use globwalk for cache-keys matching (#7337)
## Summary

This should be more efficient as we can do a single traversal.

Closes https://github.com/astral-sh/uv/issues/7321.
2024-09-12 15:06:05 -04:00
Charlie Marsh
d52af0ccdd
Avoid installing transitive dev dependencies (#7318)
## Summary

This is arguably breaking, arguably a bug... Today, if project A depends
on project B, and you install A with dev dependencies enabled, you also
get B's dev dependencies. I think this is incorrect. Just like you
shouldn't be importing B's dependencies from A, you shouldn't be using
B's dev dependencies when developing on A.

Closes #7310.
2024-09-12 09:20:43 -04:00
Zanie Blue
f22e5ef69a
Avoid selecting prerelease Python installations without opt-in (#7300)
Similar to our semantics for packages with pre-release versions.

We will not use prerelease versions unless there are only prerelease
versions available, a specific version is requested,
or the prerelease version is found in a reasonable source (active
environment, explicit path, etc. but not `PATH`).

For example, `uv python install 3.13 && uv run python --version` will no
longer use `3.13.0rc2` unless that is the only Python version available,
`--python 3.13` is used, or that's the Python version that is present in
`.venv`.
2024-09-11 15:49:33 -05:00
Charlie Marsh
c124cda098
Add dedicated lock errors for wheel-only distributions (#7307) 2024-09-11 14:53:08 -05:00
Zanie Blue
c50eb12c51
Include pre-release Python versions in uv python list (#7290)
Follows https://github.com/astral-sh/uv/pull/7278

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

`uv python list` should show installed pre-release versions, even though
we don't select them by default (as defined by #7300 and
https://github.com/astral-sh/uv/pull/7278)
2024-09-11 14:46:16 -05:00
Zanie Blue
ebd73d83f8
Allow explicitly requesting an system interpreter version in check_system_python (#7306)
Needed for #7300
2024-09-11 19:41:42 +00:00