Commit graph

2162 commits

Author SHA1 Message Date
konsti
f4533c3a85
Ignore libc on other platforms (#3825)
Libc variants are only relevant on linux, we can ignore it on non
{linux, windows, mac}, e.g. BSDs.

Closes #3824
2024-05-25 10:05:10 +00:00
Charlie Marsh
c2931e806d
Remove discovery group from CLI (#3830)
## Summary

Allows, e.g., `UV_SYSTEM_PYTHON=false uv pip install --python
.venv/bin/python`.

This was intended to work after fixing
https://github.com/astral-sh/uv/issues/3000, but I think I misdiagnosed
the scope when closing that issue, and the linked PR there only fixed
some _other_ problems around index URLs.

The only thing we really lose here is we no longer error when
`--break-system-packages` is provided without `--system`, but we can
enforce that elsewhere if we want.

Closes https://github.com/astral-sh/uv/issues/3829.
2024-05-24 19:03:44 +00:00
Charlie Marsh
6682765630
Require pinned version in Preference type (#3828)
## Summary

This PR makes a variety of invalid states unrepresentable by changing
`Preference` to require a `PackageName` and `Version`, rather than
accepting a generic `Requirement`. There should be no meaningful
behavior changes.
2024-05-24 18:48:36 +00:00
Zanie Blue
ce4d862b06
Bump version to 0.2.3 (#3827) 2024-05-24 13:19:28 -05:00
Charlie Marsh
688f4f43d4
Ignore unnamed requirements in preferences (#3826)
## Summary

We actually _already_ ignore these (preferences only apply to versions,
not URLs), it just happens later on. This PR thus just avoids crashing.
The behavior is unchanged.

Closes #3822.
2024-05-24 17:32:20 +00:00
Zanie Blue
674d167a50
Fix interpreter cache collisions for relative virtualenv paths (#3823)
Closes #3784

The cache did not use an absolute path. I'm not sure this is actually a
new bug, as this code wasn't touched in #3266 but perhaps there was a
slight difference in the paths we were passing around. Note, just
canonicalizing the path as soon as we see it doesn't work because then
we jump out of the virtual environmnent into the system interpreter.

## Test plan

```
❯ uv venv
Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
❯ uv pip install anyio
Resolved 3 packages in 81ms
Installed 3 packages in 4ms
 + anyio==4.3.0
 + idna==3.7
 + sniffio==1.3.1
❯ mkdir uv-issue-3784 && cd uv-issue-3784
❯ uv venv
Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate

❯ gcm
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
❯ cargo run -q -- pip list -v -p .venv
DEBUG Checking for Python interpreter in directory `.venv`
TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3
DEBUG Using Python 3.12.3 environment at .venv/bin/python3
Package Version
------- -------
anyio   4.3.0
idna    3.7
sniffio 1.3.1
❯ cd uv-issue-3784
❯ cargo run -q -- pip list -v -p .venv
DEBUG Checking for Python interpreter in directory `.venv`
TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3
DEBUG Using Python 3.12.3 environment at /Users/zb/workspace/uv/.venv/bin/python3
Package Version
------- -------
anyio   4.3.0
idna    3.7
sniffio 1.3.1

❯ cd ..
❯ gco zb/fix-relative-venv
Switched to branch 'zb/fix-relative-venv'
❯ cargo run -q -- pip list -v -p .venv
DEBUG Checking for Python interpreter in directory `.venv`
TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3
DEBUG Using Python 3.12.3 environment at .venv/bin/python3
Package Version
------- -------
anyio   4.3.0
idna    3.7
sniffio 1.3.1
❯ cd uv-issue-3784
❯ cargo run -q -- pip list -v -p .venv
DEBUG Checking for Python interpreter in directory `.venv`
TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3
DEBUG Using Python 3.12.3 environment at .venv/bin/python3
```
2024-05-24 11:18:49 -05:00
Charlie Marsh
999d072ae9
Always include package names for Git and HTTPS dependencies (#3821)
## Summary

Related to https://github.com/astral-sh/uv/issues/3818. We should
_always_ include the package name if we know it's not a file path, even
if it starts with an environment variable.
2024-05-24 14:01:38 +00:00
Charlie Marsh
73f67089e1
Add JSON alias for unsafe-any-match (#3820)
Closes https://github.com/astral-sh/uv/issues/3819.
2024-05-24 13:31:46 +00:00
Zanie Blue
c2a58cd303
Add integration test for GitHub Actions CI patterns (#3805) 2024-05-23 23:25:06 -05:00
Charlie Marsh
8d566e553d
Use a cross-platform representation for relative paths in pip compile (#3804)
## Summary

I haven't tested on Windows yet, but the idea here is that we should use
a portable representation when printing paths.

I decided to limit the scope here to paths that we write to output
files.

Closes https://github.com/astral-sh/uv/issues/3800.
2024-05-24 03:02:42 +00:00
Charlie Marsh
a7d486bc71
Move render-benchmarks under a Cargo feature (#3815)
## Summary

Avoid compiling these large dependencies when we typically don't need
them.
2024-05-24 03:00:53 +00:00
Charlie Marsh
ce38fccdc9
Remove tracing-indicatif dependency (#3816)
## Summary

It's only used in `uv-dev`; can restore later if important.
2024-05-24 02:59:26 +00:00
Charlie Marsh
dd27f2f710
Make anyhow a dev dependency in uv-configuration (#3814) 2024-05-24 02:49:31 +00:00
Charlie Marsh
e8e826949d
Remove WerkZeug source builds from tests (#3813) 2024-05-24 02:16:34 +00:00
Charlie Marsh
c25a6f08cd
Remove anyio source builds from hash tests (#3812) 2024-05-24 01:51:59 +00:00
Charlie Marsh
c7b9823b64
Remove ujson test (#3811)
## Summary

I believe this is tested by the following test
(`install_build_system_no_backend`), which seems to have identical
constraints.

Closes #3743.
2024-05-24 01:40:30 +00:00
Charlie Marsh
6860b04f28
Remove anyio Git builds from tests (#3810) 2024-05-24 01:33:24 +00:00
Charlie Marsh
e654c62e2e
Remove bz2 builds from tests (#3809) 2024-05-23 21:26:41 -04:00
Charlie Marsh
585146391a
Remove tqdm builds from tests (#3808) 2024-05-24 01:17:45 +00:00
Charlie Marsh
a02e225eec
Remove werkzeug Git builds from tests (#3806) 2024-05-23 21:17:07 -04:00
Charlie Marsh
710c11c6ad
Remove future builds from tests (#3807) 2024-05-24 01:09:39 +00:00
Zanie Blue
99b8633ce3
Search for python3 in unix virtual environments (#3798) 2024-05-23 19:33:34 -05:00
Zanie Blue
73b6a80f23
Remove extra details from interpreter query traces (#3803)
Cherry-picked from
8f135c26f4
2024-05-23 18:18:05 -05:00
Charlie Marsh
a9d9a6c13f
Incorporate build tag into wheel prioritization (#3781)
## Summary

It turns out that in the
[spec](https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-name-convention),
if a wheel filename includes a build tag, then we need to use it to
break ties. This PR implements that behavior. (Previously, we dropped
the build tag entirely.)

Closes #3779.

## Test Plan

Run: `cargo run pip install -i https://pypi.anaconda.org/intel/simple
mkl_fft==1.3.8 --python-platform linux --python-version 3.10`. This now
resolves without error. Previously, we selected build tag 63 of
`mkl_fft==1.3.8`, which led to an incompatibility with NumPy. Now, we
select build tag 70.
2024-05-23 21:12:53 +00:00
Charlie Marsh
5bebaddc24
Make anyhow a dev dependency in pypi-types (#3801) 2024-05-23 16:58:22 -04:00
konsti
4db468e27f
Use VerbatimParsedUrl in pep508_rs (#3758)
When parsing requirements from any source, directly parse the url parts
(and reject unsupported urls) instead of parsing url parts at a later
stage. This removes a bunch of error branches and concludes the work
parsing url parts once and passing them around everywhere.

Many usages of the assembled `VerbatimUrl` remain, but these can be
removed incrementally.

Please review commit-by-commit.
2024-05-23 19:52:47 +00:00
Ibraheem Ahmed
0d2f3fc4e4
Add airflow benchmark (#3643)
## Summary

This seems to be one of the most consistent benchmark cases we have in
terms of standard deviation:
```
➜  hyperfine "target/profiling/main pip compile scripts/requirements/airflow.in" --runs 200
Benchmark 1: target/profiling/main pip compile scripts/requirements/airflow.in
  Time (mean ± σ):     292.6 ms ±   6.6 ms    [User: 414.1 ms, System: 194.2 ms]
  Range (min … max):   282.7 ms … 320.1 ms    200 runs
```

For smaller benchmarks, scispacy and dtlssocket seem to be a bit more
consistent than our current jupyter benchmark, but it hasn't given us
any problems so I'll leave it for now.
2024-05-23 13:25:54 -04:00
Zanie Blue
8f0f4d2e0c
Improve logging during interpreter discovery (#3790) 2024-05-23 10:25:22 -05:00
Zanie Blue
d2a9192e39
Avoid displaying log for satisfied editables if none are requested (#3795)
e.g. in `uv pip install anyio -v` this message is just noise

```
DEBUG Requirement satisfied: anyio
DEBUG Requirement satisfied: idna>=2.8
DEBUG Requirement satisfied: sniffio>=1.1
DEBUG All editables satisfied: 
```
2024-05-23 15:07:35 +00:00
Zanie Blue
306a4d7ce3
Improve logging of interpreter implementation (#3791)
```
Found Python interpreter CPython 3.12.3 at...
```

instead of

```
Found Python interpreter cpython 3.12.3 at
```
2024-05-23 10:00:45 -05:00
Zanie Blue
81eff0ecc8
Improve logging for environment locking (#3792)
```
DEBUG Acquired lock for `.venv`
```

instead of

```
DEBUG Trying to lock if free: .venv/.lock
```

At trace level, this includes the pre-lock message as well

```
TRACE Checking lock for `.venv`
DEBUG Acquired lock for `.venv`
```

We'll still display the lock file path when something goes wrong
2024-05-23 09:27:07 -05:00
Zanie Blue
ddfbee1cb6
Add InterpreterRequest::Any instead of using VersionRequest::Any (#3789)
A follow-up to #3266 addressing some awkwardness where there was no
"empty" or default interpreter request kind.
2024-05-23 13:22:34 +00:00
konsti
91ed1c6c7c
Fix interpreter discovery for tests (#3785)
The venv subcommand requires a system interpreter. The tests python path
discovery would previously allow a venv interpreter, failing the venv
tests that don't have system interpreter anymore.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-05-23 12:56:19 +00:00
konsti
2a17309782
Use colon more consistently in error messages (#3788)
Make the error messages more consistent with the format use elsewhere.
Split out from https://github.com/astral-sh/uv/pull/3705
2024-05-23 14:33:21 +02:00
Zanie Blue
9b870f20f1
Allow specification of additional requirements in uv tool run (#3678)
Allows requesting additional transitive dependencies when running a
tool.

e.g. `uv tool run -v --with anyio ruff check example.py` (Why would you
want anyio with ruff? Who knows 😄)

The motivation for doing this now is that I think the first
implementation of `uv tool install` might just shim into `uv tool run`
with pinned dependencies? Regardless this is something we need in the
long run and is a trivial addition right now.
2024-05-22 20:59:04 -05:00
Charlie Marsh
bb61c2d534
Revert "Revert "ci: drop native manylinux wheel for dual-tagged one (#3685)" (#3762)" (#3778)
Now that we have https://github.com/astral-sh/uv/pull/3761, it should be
safe to drop these.
2024-05-22 20:02:30 -04:00
Charlie Marsh
be81eee099
Remove aarch64-unknown-linux-gnu from list of expected binaries (#3761)
## Summary

We now only ship the static `aarch64-unknown-linux-musl` binary here.

Closes #3760.
2024-05-22 19:53:28 -04:00
Charlie Marsh
79fecdf251
Add a diagnostic trait (#3777) 2024-05-22 19:44:37 -04:00
Charlie Marsh
9db6852f64
Initialize cache in tool run (#3776)
## Summary

Closes https://github.com/astral-sh/uv/issues/3775.
2024-05-22 22:59:35 +00:00
Zanie Blue
e52ae0e2bc
Bump version to 0.2.2 (#3774) 2024-05-22 21:45:00 +00:00
Zanie Blue
17ec349437
Add test case for Conda CI (#3773)
Integration test coverage for #3769 

Failure against `main` on
2530051001

Rebased against #3771 to check for fix
2024-05-22 21:37:26 +00:00
Zanie Blue
5cd3af8ab4
Use uv tool run for release script (#3764)
Dogfooding!
2024-05-22 16:31:13 -05:00
Zanie Blue
a6043553c8
Improve error message when default Python is not found (#3770) 2024-05-22 16:28:52 -05:00
Zanie Blue
87b73ef7a9
Do not treat interpereters discovered via CONDA_PREFIX as system interpreters (#3771)
Closes https://github.com/astral-sh/uv/issues/3769
2024-05-22 16:27:33 -05:00
Charlie Marsh
74c494d7dd
Report yanks for cached and resolved packages (#3772)
## Summary

We now show yanks as part of the resolution diagnostics, so they now
appear for `sync`, `install`, `compile`, and any other operations.
Further, they'll also appear for cached packages (but not packages that
are _already_ installed).

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

Closes #3766.
2024-05-22 21:21:37 +00:00
Charlie Marsh
1fc71ea736
Bump version to v0.2.1 (#3763) 2024-05-22 20:05:17 +00:00
Charlie Marsh
dc4f63d2e5
Revert "ci: drop native manylinux wheel for dual-tagged one (#3685)" (#3762)
## Summary

Reverts https://github.com/astral-sh/uv/pull/3685. We need to figure out
how to update the installer to handle this correctly.
2024-05-22 15:53:17 -04:00
Zanie Blue
d66d326954
Allow users to specify a custom source package to uv tool run (#3677)
We usually infer the package the tool is pulled from to be the same name
as the tool itself, but that's not always the case. This allows users to
provide a custom package.
2024-05-22 14:48:54 -05:00
Charlie Marsh
0efc5d0cab
Reuse reporting operation in venv (#3755) 2024-05-22 15:43:20 -04:00
Charlie Marsh
3a75b50d5b
Use pip "operations" API in project commands (#3759)
## Summary

This PR removes most of the code in `project/mod.rs` in favor of the
routines exposed in `pip/operations.rs`.

I think we can do a lot more to add more abstraction here and reduce the
verbosity, but for now it deduplicates a _ton_ of logic. The remaining
logic is just instantiating settings etc.
2024-05-22 15:43:12 -04:00