Commit graph

1682 commits

Author SHA1 Message Date
Charlie Marsh
d0c6b0a93e
Add local path conversions from lockfile (#3609)
## Summary

Just does the most basic thing to convert from `Distribution` back to
the installable type.
2024-05-15 12:46:45 -04:00
Charlie Marsh
55aedda379
Separate cache construction from initialization (#3607)
## Summary

Ensures that we only initialize the cache for commands that require it.

Closes https://github.com/astral-sh/uv/issues/3539.
2024-05-15 12:29:39 -04:00
Charlie Marsh
647f38be31
Add missing "directory" branch in source match (#3608)
## Summary

Just my oversight.
2024-05-15 16:25:55 +00:00
Charlie Marsh
d76b023cd6
Remove resolve_cli.rs and resolve_many.rs (#3606)
## Summary

These depend on some APIs that I want to be internal-only for the
resolver crate, and we're no longer using them.
2024-05-15 16:04:47 +00:00
Charlie Marsh
913fc91afe
Remove binary from uv-virtualenv crate (#3605)
## Summary

I'm doing some refactoring and it requires updating this binary, but I
doubt we really use it?
2024-05-15 16:02:44 +00:00
Charlie Marsh
ef068f1c01
Respect installed packages in uv run (#3603)
Closes #3601.
2024-05-15 15:48:32 +00:00
Charlie Marsh
85c71d6987
Rename pinned_package to dist (#3598) 2024-05-15 00:42:27 +00:00
Charlie Marsh
9a18d4ff46
Split resolution.rs into multiple files (#3597)
## Summary

No code changes.
2024-05-15 00:16:04 +00:00
Charlie Marsh
c598f86476
Allow local versions in wheel filenames (#3596)
## Summary

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

## Test Plan

`cargo run pip install --verbose
https://github.com/Dao-AILab/flash-attention/releases/download/v2.5.8/flash_attn-2.5.8+cu122torch2.3cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
--no-deps`
2024-05-15 00:02:09 +00:00
Charlie Marsh
8971944a01
Move extras onto annotated distribution (#3592)
## Summary

Like hashes, we can now store these on `AnnotatedDist` rather than
creating a parallel hash map and performing lookups later on.
2024-05-14 23:25:06 +00:00
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
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
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
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
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
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
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