Commit graph

1558 commits

Author SHA1 Message Date
Charlie Marsh
fee9657548
Only ignore bin directory at repo root (#2856)
Closes https://github.com/astral-sh/uv/issues/1304.
2024-04-07 00:36:41 +00:00
Charlie Marsh
bfc4c1aa5a
Turn off text wrapping in non-scenario fixtures (#2854)
## Summary

We do this in the scenarios, but weren't setting it elsewhere.
2024-04-06 23:27:56 +00:00
Charlie Marsh
35940cb885
Remove additional 'because' (#2849)
## Summary

Is this, perhaps, not totally necessary? It doesn't show up in any
fixtures beyond those that I added recently.

Closes https://github.com/astral-sh/uv/issues/2846.
2024-04-06 10:58:23 -04:00
Charlie Marsh
8ffdcced0f
Use miette when printing pip sync resolution failures (#2848)
Closes https://github.com/astral-sh/uv/issues/2845.
2024-04-06 00:35:00 +00:00
Charlie Marsh
00934044aa
Backtrack on distributions with invalid metadata (#2834)
## Summary

Closes https://github.com/astral-sh/uv/issues/2821.
2024-04-05 18:00:48 -04:00
Zanie Blue
f0b0e1943c
Update fetch-version-metadata to only require the stdlib (#2838) 2024-04-05 16:50:56 -05:00
Charlie Marsh
c11e9e5097
Add backtracking tests for distribution incompatibilities (#2839)
## Summary

Demonstrates some suboptimal behavior in how we handle invalid metadata,
which are fixed in https://github.com/astral-sh/uv/pull/2834.

The included wheels were modified by-hand to include invalid structures.
2024-04-05 18:16:18 +00:00
Charlie Marsh
cedb5e4aec
Add a test for --offline direct URLs (#2837) 2024-04-05 17:10:23 +00:00
Ikko Eltociear Ashimine
37225cb920
Fix a typo in source_tree.rs (#2836) 2024-04-05 17:53:09 +01:00
konsti
5474c61fed
Refactor candidate selector for batch prefetching (#2832)
Batch prefetching needs more information from the candidate selector, so
i've split `select` into methods. Split out from #2452. No functional
changes.
2024-04-05 16:51:01 +02:00
Charlie Marsh
a0b8d1a994
Clean up Error enum in Metadata23 (#2835)
## Summary

Rename, and remove a bunch of unused variants.
2024-04-05 14:40:33 +00:00
Charlie Marsh
2f386ef440
Show resolution diagnostics after pip install (#2829)
## Summary

These are shown in `pip compile`, but absent from `pip install`.

See: #2828.
2024-04-05 03:13:01 +00:00
Charlie Marsh
2ac562b40d
Respect --no-build and --no-binary in --find-links (#2826)
## Summary

In working on `--require-hashes`, I noticed that we're missing some
incompatibility tracking for `--find-links` distributions. Specifically,
we don't respect `--no-build` or `--no-binary`, so if we select a wheel
due to `--find-links`, we then throw a hard error when trying to build
it later (if `--no-binary` is provided), rather than selecting the
source distribution instead.

Closes https://github.com/astral-sh/uv/issues/2827.
2024-04-05 02:00:39 +00:00
Charlie Marsh
365cb16fd6
Bump version to v0.1.29 (#2825) 2024-04-04 15:50:52 -04:00
Charlie Marsh
ab8368aa27
Deduplicate editables during install commands (#2820)
## Summary

Closes #2819.
2024-04-04 13:19:44 -04:00
Charlie Marsh
661787b0cb
Document that uv is safe to run concurrently (#2818)
Closes https://github.com/astral-sh/uv/issues/2730.
2024-04-04 04:33:25 +00:00
Charlie Marsh
dd3009ad84
Respect Git tags and branches that look like short commits (#2795)
## Summary

If we're given a Git reference like `20240222`, we currently treat it as
a short commit hash. However... it _could_ be a branch or a tag. This PR
improves the Git reference logic to ensure that ambiguous references
like `20240222` are handled appropriately, by attempting to extract it
as a branch, then a tag, then a short commit hash.

Closes https://github.com/astral-sh/uv/issues/2772.
2024-04-03 22:05:54 -04:00
Charlie Marsh
dc2c289dff
Upgrade rs-async-zip to support data descriptors (#2809)
## Summary

Upgrading `rs-async-zip` enables us to support data descriptors in
streaming. This both greatly improves performance for indexes that use
data descriptors _and_ ensures that we support them in a few other
places (e.g., zipped source distributions created in Finder).

Closes #2808.
2024-04-04 01:31:40 +00:00
Charlie Marsh
34341bd6e9
Allow package lookups across multiple indexes via explicit opt-in (#2815)
## Summary

This partially revives https://github.com/astral-sh/uv/pull/2135 (with
some modifications) to enable users to opt-in to looking for packages
across multiple indexes.

The behavior is such that, in version selection, we take _any_
compatible version from a "higher-priority" index over the compatible
versions of a "lower-priority" index, even if that means we might accept
an "older" version.

Closes https://github.com/astral-sh/uv/issues/2775.
2024-04-03 23:23:37 +00:00
Charlie Marsh
e0d55ef496
Allow no-op --no-compile flag on CLI (#2816)
Closes https://github.com/astral-sh/uv/issues/2771.
2024-04-03 20:36:44 +00:00
Charlie Marsh
8eaaf65456
Avoid unused extras check in pip install for source trees (#2811)
## Summary

This was an oversight in the `-r pyproject.toml` refactor. We can't
enforce unused extras if we have a source tree. We made the correct
changes to `pip compile`, but not `pip install`. This PR just mirrors
those changes to `pip install`, and adds a few tests.

Closes https://github.com/astral-sh/uv/issues/2801.
2024-04-03 11:23:25 -04:00
konsti
691ed09a9b
Fix windows lock race: Lock exclusive after all try lock errors (#2800)
We don't know what kind of error the OS gives us on `try_lock_exclusive`
with an already locked file, so we assume all those errors are an
already locked file and call `lock_exclusive`.

For example the windows error:

```
Os {
    code: 33,
    kind: Uncategorized,
    message: "The process cannot access the file because another process has locked a portion of the file.",
}
```

Fixes #2767
2024-04-03 16:02:40 +02:00
Alex Waygood
6915bc90e0
fix typos (#2804) 2024-04-03 11:57:19 +00:00
Alex Waygood
345b767874
Improve renovate config (#2802) 2024-04-03 11:48:39 +00:00
Zanie Blue
471cb2bfd6
Simplify sorting of site package entries (#2782)
per https://github.com/astral-sh/uv/pull/2780#discussion_r1548340373
2024-04-03 04:33:11 +00:00
Charlie Marsh
189d0d41d0
Remove redirects from the resolver (#2792)
## Summary

Rather than storing the `redirects` on the resolver, this PR just
re-uses the "convert this URL to precise" logic when we convert to a
`Resolution` after-the-fact. I think this is a lot simpler: it removes
state from the resolver, and simplifies a lot of the hooks around
distribution fetching (e.g., `get_or_build_wheel_metadata` no longer
returns `(Metadata23, Option<Url>)`).
2024-04-03 02:43:57 +00:00
Charlie Marsh
ffd4b6fcac
Remove unused download_and_extract_archive method (#2793)
## Summary

This was introduced at some point but then removed in favor of accessing
the database directly.
2024-04-03 02:34:14 +00:00
Charlie Marsh
29492b7754
Fix references to "WerkZeug" in "anyio" tests (#2791)
## Summary

Also fixes up the descriptions (some were wrong).
2024-04-02 22:28:12 -04:00
Zanie Blue
906c1ca71d
Fixups to release.sh and sync_scenarios.sh (#2790)
I missed a few things, sorry!
2024-04-03 01:59:58 +00:00
Zander
4b2e67955f
fixed uv can't create .venv for cpython-x86 on Windows (#2707)
Adaptation to the win32 platform is added.

https://docs.python.org/3/library/sysconfig.html#sysconfig.get_platform


## Summary

fixed uv can't create .venv for cpython-x86 on Windows 

[uv can't create .venv for cpython-x86 on Windows
](https://github.com/astral-sh/rye/issues/952)

---------

Co-authored-by: Nashan <34827878+zhuang1234@users.noreply.github.com>
2024-04-02 20:45:53 -05:00
Charlie Marsh
684f790d5d
Preserve .git suffixes and casing in Git dependencies (#2789)
## Summary

I noticed in #2769 that I was now stripping `.git` suffixes from Git
URLs after resolving to a precise commit. This PR cleans up the internal
caching to use a better canonical representation: a `RepositoryUrl`
along with a `GitReference`, instead of a `GitUrl` which can contain
non-canonical data. This gives us both better fidelity (preserving the
`.git`, along with any casing that the user provided when defining the
URL) and is overall cleaner and more robust.
2024-04-03 00:24:29 +00:00
Charlie Marsh
c30a65ee0c
Allow conflicting Git URLs that refer to the same commit SHA (#2769)
## Summary

This PR leverages our lookahead direct URL resolution to significantly
improve the range of Git URLs that we can accept (e.g., if a user
provides the same requirement, once as a direct dependency, and once as
a tag). We did some of this in #2285, but the solution here is more
general and works for arbitrary transitive URLs.

Closes https://github.com/astral-sh/uv/issues/2614.
2024-04-02 23:36:35 +00:00
Zanie Blue
20d4762776
Move scenario sync script to top-level scripts (#2788)
Same idea as https://github.com/astral-sh/uv/pull/2787
2024-04-02 23:27:05 +00:00
Zanie Blue
4838c4da0a
Move bump.sh to scripts/release.sh (#2787)
I find this more discoverable and since we're putting files in the
top-level `scripts/` folder now this seems okay.
2024-04-02 23:25:27 +00:00
Zanie Blue
4c3e5f0f7d
Use cargo update -p uv for release instead of cargo check (#2786)
This is faster and accomplishes what we want
2024-04-02 18:12:47 -05:00
Zanie Blue
0046a0d596
Bump version to 0.1.28 (#2785) 2024-04-02 21:39:35 +00:00
Charlie Marsh
0382abee70
Bump cargo-dist to 0.13.0-prerelease.3 (#2783)
Closes #2770.
2024-04-02 21:23:55 +00:00
Charlie Marsh
03b709a0e7
Detect Fish via FISH_VERSION (#2781)
## Summary

Apparently `SHELL` isn't always set to Fish:
https://github.com/fish-shell/fish-shell/issues/374.

## Test Plan

`uv venv` after running `fish` in macOS.
2024-04-02 19:50:48 +00:00
Zanie Blue
1ac9672b95
Resolve non-determistic behavior in preferences due to site-packages ordering (#2780)
Originally a regression test for #2779 but we found out that there's
some weird behavior where different `anyio` versions were preferred
based on the platform.
2024-04-02 13:48:33 -05:00
Zanie Blue
119d753cfe
Exclude installed distributions with multiple versions from consideration in the resolver (#2779)
Addresses panic introduced in #2596 and reported in
https://github.com/astral-sh/uv/issues/2763#issuecomment-2030674936

When there are multiple versions of a package available, we remove the
existing packages before installing the resolved version to "fix" the
environment. We must remove all of the package versions and reinstall
because removing _any_ of the package versions could break the others.
Since reinstalls require a pull from the remote, this broke a contract
between the resolver and the planner which must always agree on which
packages should come from the remote. This further demonstrates that we
should be constructing the install plan with more concrete knowledge
from the resolver (i.e. `ResolvedDist` instead of `Requirement`) to
avoid having to manually ensure logic matches.

## Test plan

Fails on `main` with panic succeeds on branch

```
uv venv --seed
source .venv/bin/activate
pip install anyio==3.7.0 --ignore-installed
pip install anyio==4.0.0 --ignore-installed
cargo run -- pip install anyio black -v
```
2024-04-02 12:10:52 -05:00
Charlie Marsh
b73cfbb0de
Use user_display for source tree error (#2768) 2024-04-02 00:42:11 +00:00
Charlie Marsh
ccd457a37e
Use distribution database and index for all pre-resolution phases (#2766)
## Summary

Ensures that if we resolve any distributions before the resolver, we
cache the metadata in-memory.

_Also_ ensures that we lock (important!) when resolving Git
distributions.
2024-04-02 00:34:13 +00:00
Charlie Marsh
dfdcce68fd
Split get_or_build_wheel_metadata into distinct methods (#2765)
## Summary

Internal refactor which makes `DistributionDatabase` for unnamed
requirements (or, at least, source distributions).
2024-04-01 23:52:21 +00:00
Charlie Marsh
f2c9e88f3e
Populate the in-memory index when resolving lookahead URLs (#2761)
## Summary

Just ensures that we don't have to go back to the cache when resolving.
2024-04-01 22:07:54 +00:00
Charlie Marsh
999d653404
Use canonical URL to key redirect map (#2764)
## Summary

This fixes a potential bug that revealed itself in
https://github.com/astral-sh/uv/pull/2761. We don't run into this now
because we always use "allowed URLs", stores the "last" compatible URL
in the map. But the use of the "raw" URL (rather than the "canonical"
URL) means that other writers have to follow that same assumption and
iterate over dependencies in-order.
2024-04-01 17:57:13 -04:00
Charlie Marsh
d2bbc07b76
Rename resolver.rs to unnamed.rs in uv-requirements (#2762)
## Summary

We have a few different "resolvers" in here now so the name is
confusing.
2024-04-01 21:40:03 +00:00
Charlie Marsh
a48bcaecb1
Recursively resolve direct URL references upfront (#2684)
## Summary

This PR would enable us to support transitive URL requirements. The key
idea is to leverage the fact that...

- URL requirements can only come from URL requirements.
- URL requirements identify a _specific_ version, and so don't require
backtracking.

Prior to running the "real" resolver, we recursively resolve any URL
requirements, and collect all the known URLs upfront, then pass those to
the resolver as "lookahead" requirements. This means the resolver knows
upfront that if a given package is included, it _must_ use the provided
URL.

Closes https://github.com/astral-sh/uv/issues/1808.
2024-04-01 21:16:20 +00:00
Charlie Marsh
f60e7495ca
Bump version to v0.1.27 (#2758) 2024-04-01 14:54:50 -04:00
Zanie Blue
ba1e9ef182
Add Homebrew system check test (#2736)
Following #2735 adds a system check that uses Homebrew. I think we were
never were actually using Homebrew's Python in the past, we were mislead
or something changed in the runners recently that broke it.
2024-04-01 14:50:45 +00:00
konsti
05ed7ac64b
Don't use exclude newer manually in test functions (#2697)
With this change, all usages of `EXCLUDE_NEWER` are now in command
wrappers, not in the test functions themselves.

For the venv test, i refactored them into the same kind of test context
abstraction that the other test modules have in the second commit.

The third commit makes`"INSTA_FILTERS` "private", removing the last
remaining individual usage.

Pending windows CI 🤞
2024-04-01 16:07:25 +02:00