Commit graph

4089 commits

Author SHA1 Message Date
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
Jo
bb0fb8e9bf
uv run supports python zipapp (#7289)
## Summary

`python` supports running a zipfile containing a `__main__.py` file, for
example `python ./pre-commit-3.8.0.pyz`.

See https://docs.python.org/3/using/cmdline.html#interface-options:

> <script> Execute the Python code contained in script, which must be a
filesystem path (absolute or relative) referring to either a Python
file, a directory containing a __main__.py file, or a zipfile containing
a __main__.py file.

and https://docs.python.org/3/library/zipapp.html.

Similar to #7281, this PR allows `uv run ./pre-commit-3.8.0.pyz` to
work.

## Test Plan

```console
$ curl -O https://github.com/pre-commit/pre-commit/releases/download/v3.8.0/pre-commit-3.8.0.pyz
$ cargo run -- run ./pre-commit-3.8.0.pyz
```
2024-09-11 14:34:29 -05:00
Zanie Blue
b05217e624
Show verbose output during system install in test (#7304)
We do this for the other installs and it is helpful for debugging

This is missing in
3001185524
2024-09-11 14:31:51 -05:00
Charlie Marsh
58a157a0ad
Support globs as cache keys in tool.uv.cache-keys (#7268)
## Summary

This has been asked for a few times. There are risks that these checks
could be slow, but they're buyer-beware.

Closes https://github.com/astral-sh/uv/issues/7246.
2024-09-11 15:30:59 -04:00
Zanie Blue
d7ec546e71
Add Python 3.13 system test for Linux (#7302)
Previously we only had coverage on Windows

e.g. for more test coverage in cases like
https://github.com/astral-sh/uv/pull/7300#discussion_r1755343870

I picked Linux over macOS because the 3.13 prereleases are not available
via HomeBrew?
2024-09-11 14:25:09 -05:00
Charlie Marsh
1a3ec9d04f
Avoid enforcing platform compatibility when validating lockfile (#7305)
## Summary

We have to call `to_dist` to get metadata while validating the lockfile,
but some of the distributions won't match the current platform -- and
that's fine!
2024-09-11 19:17:07 +00:00
Charlie Marsh
575eb65a20
Avoid treating .whl sources as source distributions (#7303)
## Summary

The error messages here are incorrect.

Closes https://github.com/astral-sh/uv/issues/7284.
2024-09-11 15:10:04 -04:00
Charlie Marsh
cafc1f986a
Support relative paths in uv add --script (#7301)
## Summary

Closes https://github.com/astral-sh/uv/issues/7292.
2024-09-11 14:36:41 -04:00
Charlie Marsh
15792a3775
Apply --no-install options when constructing resolution (#7277)
## Summary

We need to apply the `--no-install` filters earlier, such that we don't
error if we only have a source distribution for a given package when
`--no-build` is provided but that package is _omitted_.

Closes #7247.
2024-09-11 14:31:24 -04:00
Tom
7021b15a42
Fix PPC64 page size in binary builds. (#7298)
## Summary

Add maturin build flag to set 64kb page size on PPC64 and PPC64LE
architectures. Not aware of modern systems that use 4kb pages.

Resolves #6528

## Test Plan

ppc64le gnu dynamic-linked and musl static-linked binary builds were
tested successfully on an IBM Power9 system running RHEL 8.8. I do not
have access to other types of PPC64 systems for testing.
2024-09-11 14:13:49 -04:00
Jo
38c7c5fdd1
uv run supports python package (#7281)
## Summary

Allow `uv run ./package` runs a Python package with a `__main__.py`
script.

Resolves #7275
2024-09-11 08:18:00 -05:00
Zanie Blue
77d278f68a
Avoid selecting pre-releases for Python downloads without a version request (#7278)
Following #7263 the 3.13.0rc2 releases are at the top of the download
list but we should not select them unless 3.13 is actually requested.

Prior to this, `uv python install` would install `3.13.0rc2`. 

```
❯ cargo run -- python install --no-config
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/uv python install --no-config`
Searching for Python installations
Installed Python 3.12.6 in 1.33s
 + cpython-3.12.6-macos-aarch64-none
```

```
❯ cargo run -- python install --no-config 3.13
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/uv python install --no-config 3.13`
Searching for Python versions matching: Python 3.13
Installed Python 3.13.0rc2 in 1.18s
 + cpython-3.13.0rc2-macos-aarch64-none
```
2024-09-10 22:20:18 +00:00
Zanie Blue
f5891e3296
Bump version to 0.4.9 (#7274) 2024-09-10 16:44:39 -05:00
Charlie Marsh
3f011f3b7b
Add uv run --no-sync (#7192)
## Summary

When `--no-sync` is provided, we won't lock or sync, but we will run the
command in the project environment.

Closes https://github.com/astral-sh/uv/issues/7165.
2024-09-10 17:29:43 -04:00
Michał Górny
4b7fed84eb
Replace tokio-tar with krata-tokio-tar fork (#7271)
## Summary

Replace the unmaintained `tokio-tar` crate with the `krata-tokio-tar`
fork. The latter just merged a fix necessary for the crate to work on
PowerPC, and has better chances of future maintenance.

Fixes #3423

## Test Plan

`cargo test`
2024-09-10 17:28:53 -04:00