Commit graph

4903 commits

Author SHA1 Message Date
Charlie Marsh
c7348589fa
Remove some editable branches in resolution (#3591)
## Summary

Editables should always go down the `Some(url)` branch.
2024-05-14 23:16:06 +00:00
Charlie Marsh
4a42730cae
Add hashes and versions to all distributions (#3589)
## Summary

In `ResolutionGraph::from_state`, we have mechanisms to grab the hashes
and metadata for all distributions -- but we then throw that information
away. This PR preserves it on a new `AnnotatedDist` (yikes, open to
suggestions) that wraps `ResolvedDist` and includes (1) the hashes
(computed or from the registry) and (2) the `Metadata23`, which lets us
extract the version.

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

Closes https://github.com/astral-sh/uv/issues/3357.
2024-05-14 23:07:24 +00:00
Charlie Marsh
7363f31ceb
Rename sourcedist to sdist in lockfile (#3590)
## Summary

I think this is more consistent with Brett's proposal and looks more
natural to me as a user. What do you think, @BurntSushi?
2024-05-14 16:56:00 -04:00
Charlie Marsh
f4cd7d627a
Split extra validation from graph construction (#3586)
## Summary

Splits this into two loops that each handle independent cases, to make
the code a little easier to reason about. No behavioral or logic changes
-- just splitting the `match` across two loops.
2024-05-14 16:41:16 -04:00
Charlie Marsh
30a7475029
Create lib64 symlink for 64-bit, non-macOS, POSIX environments (#3584)
## Summary

Closes
https://github.com/astral-sh/uv/issues/3578#issuecomment-2110675382.

## Test Plan

Verified that in the OpenSUSE test, we create both, and they're
symlinks:

```text
INFO: Creating virtual environment with `venv`...
INFO: Installing into `venv` virtual environment...
DEBUG Found a virtualenv named .venv at: /tmp/tmp4nape29h/.venv
DEBUG Cached interpreter info for Python 3.10.14, skipping probing: .venv/bin/python
DEBUG Using Python 3.10.14 environment at .venv/bin/python
DEBUG Trying to lock if free: .venv/.lock
purelib: "/tmp/tmp4nape29h/.venv/lib/python3.10/site-packages"
platlib: "/tmp/tmp4nape29h/.venv/lib64/python3.10/site-packages"
is_same_file(purelib, platlib): Ok(true)
```
2024-05-14 14:33:44 -04:00
Michał Górny
e64c337cc5
Fix install_registry_source_dist_cached on Gentoo (#3569)
## Summary

Increment the removed file counts in filters
in install_registry_source_dist_cached test, to make it work again on
Gentoo. The tested counts were updated
in 9a92a3ad37, but the filters were not.
That said, the respective count increased in Gentoo as well, so adjust
both input and output strings. I'm updating Windows as a guesswork,
though I suspect that filter may not be necessary anymore, given that CI
was passing.

## Test Plan

`cargo test` on Gentoo :-).
2024-05-14 13:51:51 -04:00
Charlie Marsh
b20d5ad96f
Remove pacman from README (#3582)
## Summary

If we want to enumerate more installers, I think they should go in a
dedicated section.
2024-05-14 13:34:39 -04:00
Charlie Marsh
27c8c5ad44
Explain hash tie-breaking in distribution comparisons (#3581) 2024-05-14 13:34:32 -04:00
Ibraheem Ahmed
8ce9051296
Parse marker tree before evaluation (#3520)
## Summary

Parse `MarkerTree` expressions upfront, instead of lazily during
evaluation.

This makes implementing https://github.com/astral-sh/uv/issues/3355 a
lot easier.
2024-05-14 11:02:30 -04:00
Charlie Marsh
732410f255
Reduce sensitivity of unknown option error (#3580)
Closes https://github.com/astral-sh/uv/issues/3579.
2024-05-14 14:40:02 +00:00
Zanie Blue
d417daad7e
Bump version to v0.1.44 (#3577) 2024-05-14 09:05:31 -05:00
Zanie Blue
759d40ceb9
Revert "Use manylinux: auto for aarch64 builds (#3444)" (#3576)
This reverts #3444 which appears to be the cause of SSL failures when
building aarch64 Linux images on macOS hosts (see
https://github.com/astral-sh/uv/issues/3570)

Closes https://github.com/astral-sh/uv/issues/3570
2024-05-14 08:51:07 -05:00
Adolfo Ochagavía
0ef925aa92
Fix typo in traits.rs (#3574)
## Summary

Fixes a typo in a comment

## Test Plan

I assume there's no need to test comment changes, other than having a
human check they make sense. That's what this PR is for 😉
2024-05-14 06:57:38 -05:00
Charlie Marsh
7c1c5df968
Unify editable handling between sync and install (#3568)
## Summary

Uses the editable handling from `pip sync`, and improves the
abstractions such that we can pass those resolved editables into the
resolver.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-05-14 09:18:29 +00:00
Charlie Marsh
c666e43b90
Move dry-run method to the top-level (#3567)
Trying to pull out some small, no-op refactors.
2024-05-14 02:28:39 +00:00
konsti
025368965e
Reduce GitSourceDist URL usage (#3458)
Refactor the easy-to-remove usage of the `VerbatimUrl` on
`GitSourceDist`
2024-05-14 02:03:55 +00:00
Charlie Marsh
66eea7a5fb
Remove unused installed field from Plan (#3566) 2024-05-14 01:53:48 +00:00
konsti
b263fcff9c
Preserve parsed url in ResolvedDist -> Requirement (#3457)
Lose less information in the `ResolvedDist` -> `Requirement` conversion.
2024-05-14 01:47:20 +00:00
konsti
a24124571a
Use the term path instead of local file consistently (#3430)
Rename `ParsedLocalFileUrl` to `ParsedPathUrl`, eliminating the term
`LocalFile` in favor of path.
2024-05-14 01:35:52 +00:00
Charlie Marsh
325265ec16
Move pip commands into their own module (#3565)
## Summary

Matching the structure of the `project` module and API.
2024-05-14 01:34:14 +00:00
konsti
c22c7cad4c
Add parsed URL fields to Dist variants (#3429)
Avoid reparsing urls by storing the parsed parts across resolution on
`Dist`.

Part 2 of https://github.com/astral-sh/uv/issues/3408 and part of #3409

Closes #3408
2024-05-14 01:23:27 +00:00
konsti
0010954ca7
Add parsed URL to PubGrubPackage (#3426)
Avoid reparsing urls by storing the parsed parts across resolution on
`PubGrubPackage`.

Part 1 of #3408
2024-05-14 00:55:21 +00:00
Charlie Marsh
5132c6a6e2
Bump version to v0.1.43 (#3564) 2024-05-14 00:38:11 +00:00
Charlie Marsh
8cec217eff
Avoid attempting to build editables when fetching metadata (#3563)
## Summary

If we see an editable as a dependency, we currently attempt to fetch its
metadata, when we shouldn't.

Closes https://github.com/astral-sh/uv/issues/3562.
2024-05-14 00:03:53 +00:00
Zanie Blue
88069e1c43
Add test case demonstrating failure with --only-binary and dependent editables (#3561)
As discussed at
https://github.com/astral-sh/uv/issues/3513#issuecomment-2108572246

See https://github.com/astral-sh/uv/issues/3562
2024-05-13 19:55:28 -04:00
Charlie Marsh
7ed14fa124
Make isolated a global argument (#3558)
Closes https://github.com/astral-sh/uv/issues/3557.
2024-05-13 17:51:32 +00:00
Charlie Marsh
44363d25c2
Respect constraints on editable dependencies (#3554)
## Summary

Ensures that constraints are enforced for editable requirements.

Closes #3548.
2024-05-13 17:06:27 +00:00
Charlie Marsh
10ec48299e
Add a PubGrubRequirement struct (#3553)
## Summary

Formalize some of the patterns in here. No behavior changes, just moving
this method onto a struct.
2024-05-13 16:59:10 +00:00
Charlie Marsh
eb8e733790
Rename "constraints" to "dependencies" in resolver (#3552)
## Summary

It's confusing that we use `constraints` here because constraints mean
something else for us (e.g., `--constraint constraints.txt`). These are
really the dependencies of a given `PubGrubPackage` -- the type is even
called `PubGrubDependencies`.
2024-05-13 16:30:16 +00:00
samypr100
790206beb1
feat: speed up windows jobs using ReFS (#3522)
## Summary

Switch to using Virtual HD + ReFS to speed up windows jobs.

Closes #3508
2024-05-13 11:15:54 -05:00
Bas Schoenmaeckers
1218766ea5
Clone individual files on windows ReFS (#3551)
Windows does not support cloning whole directories so clone each file
instead.

closes #3547 

## Test Plan

Ran ` uv pip install setuptools --link-mode=clone` manually
2024-05-13 12:03:39 -04:00
Zanie Blue
b596b460a8
Increase verbosity of credential fetch logs (#3550)
So users do not need to turn on trace logging to see fetch results e.g.
https://github.com/astral-sh/uv/issues/3542

This is more reasonable now that we cache fetches.
2024-05-13 15:55:57 +00:00
Charlie Marsh
9a92a3ad37
Apply advisory locks when building source distributions (#3525)
## Summary

I don't love this, but it turns out that setuptools is not robust to
parallel builds: https://github.com/pypa/setuptools/issues/3119. As a
result, if you run uv from multiple processes, and they each attempt to
build the same source distribution, you can hit failures.

This PR applies an advisory lock to the source distribution directory.
We apply it unconditionally, even if we ultimately find something in the
cache and _don't_ do a build, which helps ensure that we only build the
distribution once (and wait for that build to complete) rather than
kicking off builds from each thread.

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

## Test Plan

Ran:

```sh
#!/bin/bash
make_venv(){
    target/debug/uv venv $1
    source $1/bin/activate
    target/debug/uv pip install opentracing --no-deps --verbose
}

for i in {1..8}
do
   make_venv ./$1/$i &
done
```
2024-05-13 10:42:20 -04:00
Charlie Marsh
42c3bfa351
Make Directory its own distribution kind (#3519)
## Summary

I think this is overall good change because it explicitly encodes (in
the type system) something that was previously implicit. I'm not a huge
fan of the names here, open to input.

It covers some of https://github.com/astral-sh/uv/issues/3506 but I
don't think it _closes_ it.
2024-05-13 10:03:14 -04:00
Zanie Blue
6bbfe555be
Add test case for --only-binary with editable requirement (#3521) 2024-05-13 14:00:11 +00:00
Dimitri Papadopoulos Orfanos
d2ee567fe7
Fix a few typos found by codespell (#3543)
<!--
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

Just fix typos.

While `alpha-numeric` is not really a misspelling:
- it is missing from mainstream curated dictionaries, all of them
suggest `alphanumeric`;
- it is less used than `alphanumeric` (more than ⨉10 less) according to
the Google [Ngram
Viewer](https://books.google.com/ngrams/graph?content=alpha-numeric%2Calphanumeric&year_start=1900&year_end=2019&corpus=en-2019);
- it is [missing from
SCOWL](http://app.aspell.net/lookup?dict=en_US-large;words=alpha-numeric).

## Test Plan

CI jobs.
2024-05-13 11:55:10 +00:00
Charlie Marsh
106c3b583c
Add HTTPS and SSH hints to scheme error (#3536)
Closes https://github.com/astral-sh/uv/issues/3483.
2024-05-13 02:14:58 +00:00
Charlie Marsh
b6f6f58831
Fix cfg_attr ignore for macOS (#3535) 2024-05-13 01:53:04 +00:00
Charlie Marsh
aa6b853d78
Run cargo shear in CI (#3534) 2024-05-12 21:44:58 -04:00
Charlie Marsh
e0da977fc9
Get cargo shear passing (#3533)
## Summary

Remove a few unused deps, and ignore `flate2` (which we include for
feature control).
2024-05-13 01:43:45 +00:00
renovate[bot]
84602c467b
Update Rust crate async-channel to v2.3.0 (#3532) 2024-05-13 01:30:55 +00:00
Fred Stober
457d4526fa
Update activate_this.py to use runpy instead of exec in the docstring (#3442)
## Summary

runpy.run_path was added in python 2.7 and 3.2 - and every python that
is not EOL supports it.

It is arguably nicer to read and the path is only given once in the
command.

At least right now, runpy - unlike exec with S102 - is not flagged by
any bandit-derived ruff check.
(I guess because it loads from a file instead of a simple string...)

Because of the import, it is also not a one-liner anymore. (But that
could be fixed with an __import__('runpy').run_path...)

## Test Plan

import runpy
runpy.run_path('/path/to/venv/bin/activate_this.py')
2024-05-13 01:21:24 +00:00
renovate[bot]
a81752a0cf
Update Rust crate zip to v1.2.3 (#3530) 2024-05-12 20:17:34 -04:00
renovate[bot]
c5528a5384
Update pre-commit dependencies (#3531) 2024-05-12 20:17:29 -04:00
renovate[bot]
3422bea1a7
Update Rust crate axoupdater to v0.6.2 (#3529) 2024-05-12 20:17:18 -04:00
Charlie Marsh
c2452957f9
Remove unused dependencies (#3527)
Surfaced with `cargo shear`.
2024-05-11 13:33:49 -04:00
Charlie Marsh
2c3a6796aa
Remove unused seek methods (#3526) 2024-05-11 17:31:32 +00:00
Charlie Marsh
3b728c16cc
Make cache clearing robust to directories without read permissions (#3524)
## Summary

If you run the script included in the linked issue, then `uv cache
clean`, we hit permissions errors on certain directories created by
`setuptools`. The permissions on those directories look like:

```
❯ sudo ls -l /Users/crmarsh/Library/Caches/uv/built-wheels-v3/pypi/opentracing/2.4.0/M-fYsaHAaQQvedmPMUl9D/opentracing-2.4.0.tar.gz/build/bdist.macosx-14.2-arm64/wheel/opentracing
Password:
total 0
drwxr-xr-x  3 crmarsh  staff  96 May 11 12:51 harness
```

This PR adds logic to make those directories readable by the current
user.

Closes https://github.com/astral-sh/uv/issues/3515.
2024-05-11 17:02:25 +00:00
Henry Schreiner
df43dc9e70
ci: build musllinux_1_1 wheels (#3523)
This is needed to include uv in manylinux, which has both the
musllinux_1_1 and musllinux_1_2 images.

## Summary

We are looking into including uv in the `pypa/manylinux` docker images,
so that cibuildwheel will be able to use it. But to do so, we need all
actively supported images to be able to take it, including
musllinux_1_1.

## Test Plan

The test was updated to make sure Alpine 3.12, which musllinux was based
on, can run uv.

The binary build does need to be triggered on this PR to make sure it
works. Ah,
5b6040184d/.github/workflows/build-binaries.yml (L15-L20)
is a good idea, nice.

Will need a followup to fill out the other platforms `pypa/manylinux`
supports for musllinux.

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-05-11 12:35:40 -04:00
Charlie Marsh
1ba3414dd6
Avoid keyword arguments for PEP 517 build hooks (#3517)
## Summary

pip passes these as positional arguments, and at least one build backend
relies on that. My personal opinion is that it's a spec violation, and
the build backend should be updated, but I'd prefer to favor
compatibility over strictness here.

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

## Test Plan

`cargo run pip install cryptacular==1.6.2`
2024-05-10 17:15:08 -04:00