Commit Graph

4247 Commits

Author SHA1 Message Date
sobolevn ff1a896dd0
Ignore `UV_CACHE_DIR` in `help` tests (#7895) 2024-10-04 09:41:25 -05:00
konsti ad638d7fa3
Use a higher timeout for publishing (#7923) 2024-10-04 15:52:23 +02:00
Krishnan Chandra d73b25385f
Coerce empty string values to `None` for `UV_PYTHON` env var (#7878)
## Summary

Closes #7841. If there are other env vars that would also benefit from
this value parser, please let me know and I can add them to this PR.

## Test Plan

When running the same example from the linked issue, it now works:

```
UV_PYTHON= cargo run -- init x
   Compiling ...
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 29.06s
     Running `target/debug/uv init x`
Initialized project `x` at `/Users/krishnanchandra/Projects/uv/x`
```
2024-10-04 12:32:03 +01:00
Seth Morton c591636dbe
Add `UV_FIND_LINKS` environment variable support for the `--find-links` command-line option (#7912)
## Summary

This PR adds support for the `UV_FIND_LINKS` environment variable as an
alternative to the `--find-links` command-line option, as requested in
#1839.

## Test Plan

A unit test was added to validate that setting `UV_FIND_LINKS` provided
the same result as a link provided with the `--find-links` command-line
option.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-04 11:30:49 +00:00
konsti fc495876cf
Clear publish progress bar on retry (#7921) 2024-10-04 13:15:26 +02:00
Charlie Marsh d80139698d
Trim commits when reading from Git refs (#7922)
## Summary

Closes #7919.
2024-10-04 11:10:53 +00:00
Ahmed Ilyas b23feebb6d
Preserve case-insensitive sorts in `uv add` (#7864)
## Summary

Resolves https://github.com/astral-sh/uv/issues/7801

## Test Plan

`cargo test`
2024-10-04 10:57:38 +00:00
Volker Hilsenstein ca62f8855b
Fix documentation (projects guide) regarding adding a git dependency (#7916)
## Summary

This is a trivial, one line documentation change that fixes the
following documentation bug.

The current documentation suggests this for adding a git dependency

```
# Add a git dependency

uv add requests --git https://github.com/psf/requests
```

Executing what is suggested with `uv` version `0.4.18` results in this
error message

```
uv add requests --git https://github.com/psf/requests
error: unexpected argument '--git' found
```

The working approach is to add the git depency like this:

```
uv add git+https://github.com/psf/requests
```

## Test Plan

I manually tested the command suggested currently in the guide against
my change.
2024-10-04 11:42:18 +01:00
Charlie Marsh 0eb4320394
Respect project upper bounds when filtering wheels on requires-python (#7904)
## Summary

If the user sets an upper-bound on their `requires-python`, we can omit
more wheels.
2024-10-04 11:35:50 +01:00
Charlie Marsh 312eeb8f57
Always ignore `cp2` wheels in resolution (#7902)
## Summary

Closes #7873.
2024-10-03 17:35:03 +00:00
konsti 41fdecf457
Allow `py3x-none` tags in newer than Python 3.x (#7867)
Unlike `cp36-...`, which requires exactly CPython 3.6, `py36-none` is
compatible with all versions starting at Python 3.6.

Note that `py3x-none` should not be used. Instead, use `py3-none` with
`requires-python`.

Fixes #7800
2024-10-03 18:02:14 +01:00
Jo 172bff4aec
Organize downloads by prioritizing the platform, then the architecture. (#7900)
## Summary

PythonDownloadKey (cpython-3.13.0rc3-darwin-aarch64-none) and
PlatformTriple in `fetch-download-metadata.py` have a slight
inconsistency in the ordering of `os` and `arch`. In PythonDownloadKey,
`os` precedes `arch`, while in PlatformTriple, `arch` comes before
`platform` (equivalent to os). This difference in ordering affects the
sorting logic, giving arch higher priority than platform in the
`download-metadata.json` file, leading to a little bit of unexpected
order of entries.

Before:
<img width="676" alt="image"
src="https://github.com/user-attachments/assets/adb24a2e-da70-4a09-a702-4b5d71600b2c">
After:
<img width="725" alt="image"
src="https://github.com/user-attachments/assets/c6c76e6a-d3fd-43dc-bfb0-b3a4a3fe2b6b">
2024-10-03 10:51:21 -05:00
Charlie Marsh 8962bcb028
Simplify supported environments when comparing to lockfile (#7894)
## Summary

If a supported environment includes a Python marker, we don't simplify
it out, despite _storing_ the simplified markers. This PR modifies the
validation code to compare simplified to simplified markers.

Closes https://github.com/astral-sh/uv/issues/7876.
2024-10-03 14:15:07 +01:00
Charlie Marsh 005bb235f0
Improve legibility of build failure errors (#7854)
## Summary

We now...

- Only show `stdout` and/or `stderr` if they're non-empty.
- Use a colorful header for the start of each section
- Highlight the step that failed

## Test Plan

![Screenshot 2024-10-01 at 8 18
42 PM](https://github.com/user-attachments/assets/c3dadf6d-11be-468d-940c-a0a29c4a88f0)
2024-10-03 12:52:53 +00:00
sobolevn d5c5a29490
Check `python/uv/` folder with `mypy` (#7891)
It used to report:

```
» mypy 
python/uv/_build_backend.py:40: error: Incompatible types in assignment (expression has type "list[str]", variable has type "CompletedProcess[bytes]")  [assignment]
python/uv/_build_backend.py:41: error: Value of type "CompletedProcess[bytes]" is not indexable  [index]
python/uv/_build_backend.py:46: error: Value of type "CompletedProcess[bytes]" is not indexable  [index]
Found 3 errors in 1 file (checked 6 source files)
```

So, I had to fix this problem by renaming the `result` var.
2024-10-03 13:05:01 +01:00
Jo c07cdc6161
Remove the first empty line for `uv tree --package foo` (#7885)
## Summary

When using `uv tree --package foo`, an extra empty line appears at the
beginning, which seems unnecessary since `uv tree` without the package
option doesn’t have this. It’s possible that the intention was to add
separation between packages, i.e. the correct implementation shoule be:

```rust
if !std::mem::take(&mut first) {
    lines.push(String::new());
}
```

Even if corrected, this extra spacing might be redundant as `uv tree`
doesn’t include these empty lines between packages by default.

```console
$ uv init project
$ cd project
$ uv init foo
$ uv tree
Using CPython 3.12.5
Resolved 2 packages in 1ms
foo v0.1.0
project v0.1.0

$ uv tree --package project
Using CPython 3.12.5
Resolved 2 packages in 1ms

project v0.1.0
```
2024-10-03 13:04:36 +01:00
Jo 32ab2a5a95
Fix Python prerelease sorting (#7884)
## Summary

Observed from #7880, `rc3` should be sorted before `rc2`.
2024-10-03 13:03:19 +01:00
samypr100 c708cc82fa
chore(ci): bump macos-12 intel runner to macos-13 intel runner (#7877)
## Summary

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

This is not breaking since `MACOSX_DEPLOYMENT_TARGET` will stay the same
(currently defaulting to 10.12) so a
`uv-x.y.z-py3-none-macosx_10_12_x86_64.whl` will still be built
2024-10-03 13:00:58 +01:00
github-actions[bot] 1635f6da0c
Add CPython 3.13.0rc3 and 3.12.7 downloads (#7880)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2024-10-02 17:20:48 -05:00
Zanie Blue 891c91dd3a
Use an enum for free-threaded Python requests (#7871)
Follow-up to #7431 improving readability
2024-10-02 13:10:45 -05:00
Zanie Blue 64c74ac552
Rename `project::FoundInterpreter` to `ProjectInterpreter` (#7874) 2024-10-02 13:10:29 -05:00
tfsingh 5ff7dc99cb
Support uv run --script (#7739)
This PR adds support for executing a script with ```uv run```, even when
the script does not have a ```.py``` extension. Addresses #7396.
2024-10-02 09:51:12 -05:00
Zanie Blue b0014835dc
Display the target virtual environment path if non-default (#7850)
Supersedes https://github.com/astral-sh/uv/pull/4835

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

e.g.

```
❯ cargo run -q -- pip install --python ../../example httpx
Using Python 3.12.1 environment at /Users/zb/example
Resolved 7 packages in 561ms
Prepared 4 packages in 62ms
Installed 4 packages in 13ms
 + certifi==2024.8.30
 + h11==0.14.0
 + httpcore==1.0.5
 + httpx==0.27.2

❯ cargo run -q -- pip install httpx
Resolved 7 packages in 17ms
Installed 4 packages in 10ms
 + certifi==2024.8.30
 + h11==0.14.0
 + httpcore==1.0.5
 + httpx==0.27.2
```
2024-10-02 09:38:31 -05:00
konsti 2552dc2748
Add missing bound on tomli tests (#7868) 2024-10-02 14:20:34 +00:00
Victorien 30e11c6deb
Fix code block title in Gitlab integration docs (#7861)
![image](https://github.com/user-attachments/assets/64b8d1cc-6dd7-4cd0-9e4a-aee992ec87fc)

A bit sad that mkdocs/mkdocs-material doesn't error on these kind of
issues. I'm wondering if a linter tool, similar to
[sphinx-lint](https://github.com/sphinx-contrib/sphinx-lint) exists for
mkdocs 🤔
2024-10-02 05:21:01 -04:00
Charlie Marsh 90265419b7
Remove unnecessary `Deserialize` derives on settings (#7856) 2024-10-02 02:32:37 +00:00
Charlie Marsh f0659e76cf
Rename `install-wheel-rs` library (#7855)
## Summary

I missed this one in the rename (the crate was renamed, but not the
library).
2024-10-01 20:45:39 -04:00
Charlie Marsh 14507a1793
Add `uv-` prefix to all internal crates (#7853)
## Summary

Brings more consistency to the repo and ensures that all crates
automatically show up in `--verbose` logging.
2024-10-01 20:15:32 -04:00
Zanie Blue 7b55e97909
Bump version to 0.4.18 (#7852) 2024-10-01 18:25:34 -05:00
Luca Bruno 0e8bf62902
Clarify locking and resolving without package name (#7578)
This adds a guiding comment around an hardcoded no-value in the
lock-and-resolve flow.

Ref: https://github.com/astral-sh/uv/pull/7488#issuecomment-2358385418

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-01 18:53:31 +00:00
Jonas Vacek 267dda995b
GitLab Integration documentation (#6857)
<!--
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
Documentation for GitLab integration, reliant on the new tags introduced
in https://github.com/astral-sh/uv/pull/6053

## Test Plan

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

---------

Co-authored-by: David Fritzsche <9479371+davidfritzsche@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-01 18:34:49 +00:00
Krishnan Chandra bc459c8703
Respect `PAGER` env var when paging in `uv help` command (#5511)
## Summary

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

## Test Plan

Tried running the following commands locally to make sure that all cases
work:

```
unset PAGER
cargo run -- help venv
```

With no pager set, `uv` correctly finds `less` on the system as it did
before and passes the help output to it.

---

```
PAGER= cargo run -- help venv
```

This correctly prints out to stdout and does not use any pager.

---

```
PAGER=most cargo run -- help venv
```

This correctly opens the `most` pager as shown below:

<img width="1917" alt="Screenshot 2024-07-27 at 5 14 42 PM"
src="https://github.com/user-attachments/assets/dfaa5a83-b47e-4f5c-9be1-b0b1e9818932">

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-01 17:50:46 +00:00
Charlie Marsh 6aa1e012ed
Improve error message copy for failed builds (#7849) 2024-10-01 17:11:09 +00:00
Charlie Marsh 6c7f8bb564
Use build failure hints for `dotenv` errors, rather than in `uv add` (#7825)
## Summary

We now display the "Did you mean `python-dotenv`?"-style errors on build
failure, rather than in `uv add`. This is less opinionated and couples
us less to specific content in the registry.

## Test Plan

![Screenshot 2024-09-30 at 10 15
05 PM](https://github.com/user-attachments/assets/5b6684e2-d992-4f20-82ab-05632779ba91)
2024-10-01 16:31:27 +00:00
Charlie Marsh abf482395b
Accept `git+` prefix in `tool.uv.sources` (#7847)
## Summary

Right now, this fails, because we later try to do `git+git+https://...`.
It seems nice to have this "just work".
2024-10-01 12:12:48 -04:00
Charlie Marsh f0f2f897de
Add detailed errors for `tool.uv.sources` deserialization failures (#7823)
## Summary

Closes https://github.com/astral-sh/uv/issues/7817.
2024-10-01 11:49:06 -04:00
konsti bd3c462674
Remove pyo3 feature from pep440 and pep508 crates (#7843) 2024-10-01 14:24:34 +00:00
konsti af824c17af
Use `uv publish` instead of twine in docs (#7837) 2024-10-01 16:14:29 +02:00
konsti d7feaadcbf
Reduce file reading boilerplace in tests (#7832) 2024-10-01 15:39:59 +02:00
konsti 8177974439
Follow-up: Add gitignore to dist directory (#7840) 2024-10-01 15:38:37 +02:00
konsti e4d7f33072
Add gitignore to dist directory (#7835) 2024-10-01 15:26:57 +02:00
Tim de Jager 50116efb10
expose `FlatDistributions` struct in public API (#7833)
Would it be okay to expose this struct? We currently use our own
ResolveProvider, and it would be nice to use the `FlatDistributions` for
easy `VersionMap` creation.

Thanks!
2024-10-01 07:46:32 -05:00
konstin f68e3dfd9d Add gitignore to dist directory
The build artifacts in `dist` are not meant to be checked in, so we're adding a gitignore to this directory, like `.venv`.
2024-10-01 14:18:26 +02:00
Charlie Marsh 1602b5c8d7
Remove unnecessary index location methods (#7826) 2024-10-01 04:44:53 +00:00
Charlie Marsh 462a13c45a
Respect `tool.uv.environments` for legacy virtual workspace roots (#7824)
## Summary

Closes https://github.com/astral-sh/uv/issues/7821.
2024-09-30 20:52:56 -04:00
Charlie Marsh b6de417c94
Use `serde-untagged` to improve some untagged enum error messages (#7822)
## Summary

This is related to https://github.com/astral-sh/uv/issues/7817, but
doesn't close it.
2024-09-30 23:40:21 +00:00
bluss 67769a4985
packaged app: use executable named for the project and main function (#7670)
## Summary

Create a function main as the default for a packaged app. Configure the
default executable as:

`example-packaged-app = "example_packaged_app:main"`

Which is often what you want - the executable has the same name as the
app.
The purpose is to more often hit what the user wants, so they don't have
to even rename the command to start developing.

## Test Plan

- existing tests are updated
2024-09-30 17:19:36 -05:00
Mathieu Kniewallner 04c79aff0a
chore(renovate): enable `regex` manager (#7820)
## Summary

Investigated
https://github.com/astral-sh/uv/pull/7807#issuecomment-2384080360, and
the reason why the PR mentioned in the comment did not work in the end
is because we only opt-in for specific managers in Renovate
configuration. By enabling
[regex](https://docs.renovatebot.com/modules/manager/regex/) manager, we
should now get proper updates to documentation references.

## Test Plan

Tested enabling specific managers (including `regex` one) in
https://github.com/mkniewallner/mkv-playground/pull/18, and Renovate was
still able to detect regex dependencies.
2024-09-30 17:28:19 -04:00
Charlie Marsh f67347e72c
Allow multiple source entries for each package in `tool.uv.sources` (#7745)
## Summary

This PR enables users to provide multiple source entries in
`tool.uv.sources`, e.g.:

```toml
[tool.uv.sources]
httpx = [
  { git = "https://github.com/encode/httpx", tag = "0.27.2", marker = "sys_platform == 'darwin'" },
  { git = "https://github.com/encode/httpx", tag = "0.24.1", marker = "sys_platform == 'linux'" },
]
```

The implementation is relatively straightforward: when we lower the
requirement, we now return an iterator rather than a single requirement.
In other words, the above is transformed into two requirements:

```txt
httpx @ git+https://github.com/encode/httpx@0.27.2 ; sys_platform == 'darwin'
httpx @ git+https://github.com/encode/httpx@0.24.1 ; sys_platform == 'linux'
```

We verify (at deserialization time) that the markers are
non-overlapping.

Closes https://github.com/astral-sh/uv/issues/3397.
2024-09-30 21:16:44 +00:00
Charlie Marsh 71d5661bd8
Add a custom suggestion for `uv add dotenv` (#7799)
## Summary

This was brought up on Twitter recently. `dotenv` hasn't been updated in
years and doesn't build successfully anymore. Users almost always mean
to install `python-dotenv`. I think we can add helpful hints here to
point users in the right direction.

## Test Plan

![Screenshot 2024-09-29 at 9 27
27 PM](https://github.com/user-attachments/assets/72585860-9d98-4478-9eac-2c17ac06178b)
2024-09-30 17:00:31 +00:00