Commit Graph

1786 Commits

Author SHA1 Message Date
konsti a653670d04
Move RequirementsTxtRequirement to its own module (#3235)
Small refactoring, no functional changes.
2024-04-24 11:16:10 +00:00
konsti bed730571d
Fix single crate tokio features (#3234)
Previously, uv-auth would fail to compile due to a missing process
feature. I chose to make all tokio features we use top level features,
so we can share the tokio cache between all test invocations.
2024-04-24 08:55:15 +00:00
Charlie Marsh 8b711d2e4d
Avoid adding extras when expanding constraints (#3232)
## Summary

See the diff in the tests. If you have a constraint with an extra, we
should respect it, but we shouldn't _add_ the extra to the requirements.
2024-04-24 02:00:27 +00:00
Charlie Marsh c7d7b07408
Add test for extra-in-constraint (#3231)
## Summary

We have the wrong behavior here, so starting by adding a test for it.
2024-04-23 21:52:41 -04:00
Charlie Marsh 084408b88f
Upgrade macOS target to 12.0 (#3228)
## Summary

macOS 11 has been EOL for 7 months, and it seems like it's common to
publish ARM-only wheels at 12.0+. I think this is a better default for
ARM macs.

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

## Test Plan

`cargo run pip install scikit-learn==1.3.2 --python-platform macos
--no-build`
2024-04-23 23:28:14 +00:00
Michael Ritsema 936facfb08
Gave a better name to the `--color` placeholder (#3226)
## Summary

The cli gives <COLOR> as value placeholder which is misleading. I
changed this to <COLOR_CHOICE> to make it obvious you don't supply a
color but a ColorChoice value.

## Test Plan

Compiled and verified --help text was correct
2024-04-23 18:13:17 -04:00
samypr100 430ac7c45c
ci: add system test for rocky 9 (#3224)
## Summary

Adding rockylinux:9 per discussion in
https://github.com/astral-sh/uv/pull/3178

## Test Plan

More CI system tests.
2024-04-23 18:12:27 -04:00
Charlie Marsh 41113a8350
Add `RAYON_NUM_THREADS` to environment variable docs (#3223) 2024-04-23 20:44:06 +00:00
samypr100 308f95fce1
chore: use uv-version in uv-virtualenv (#3221)
## Summary

This is mainly a cleanup PR to leverage uv-version in uv-virtualenv
instead of passing it via `uv`.
In #1852 I introduced the ability to pass extra cfg to `gourgeist` for
the primary purpose of passing the uv version, but since the dawn of the
uv-version crate dynamically passing more values to pyvenv.cfg is no
longer needed.

## Test Plan

Existing `uv` tests should still verify `uv = <version>` exists in the
venv and make sure no regressions were introduced.
2024-04-23 16:18:40 -04:00
Nico Neumann f0c0f874ce
Fix documentation for python platform (#3220)
<!--
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

The option `--platform` for `uv pip compile` was added in #3111 and was
later renamed to `--python-platform` #3146.
This PR updates the documentation such that the listed option is working
again.

## Test Plan

```bash
❯ uv --version
uv 0.1.37 (645d0399f 2024-04-23)
```

Before:
```bash
❯ uv pip compile requirements.in --platform=linux
error: unexpected argument '--platform' found

  tip: to pass '--platform' as a value, use '-- --platform'

Usage: uv pip compile <SRC_FILE>...

For more information, try '--help'.
```

After:
```bash
❯ uv pip compile requirements.in --python-platform=linux
Resolved 1 package in 215ms
# This file was autogenerated by uv via the following command:
#    uv pip compile requirements.in --python-platform=linux
uv==0.1.37
```
2024-04-23 20:09:27 +00:00
Charlie Marsh 697d821343
Reinstall package when editable label is removed (#3219)
## Summary

Closes https://github.com/astral-sh/uv/issues/3200.
2024-04-23 19:03:44 +00:00
Charlie Marsh 2c52111006
Fix failing `system-test-macos-x86_64` test (#3218)
## Summary

GitHub recently changed `macos-latest` to `macos-12`, so the x86 test
started failing. I've migrated the tests to use dedicated labels, rather
than the aliases.

See:
https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
2024-04-23 14:37:26 -04:00
haarisr 1c2a7f6a85
Use directory instead of file when searching for uv.toml file (#3203)
## Summary

The function `find_in_directory` joins `uv.toml`. The initial join in
`user` is redundant.

Also a small comment fix.

## Test Plan

Not really sure how to test this. Please suggest if any tests need to be
added.
2024-04-23 14:36:38 -04:00
Zanie Blue 2a9cbdb11f
Upgrade to cargo-dist 0.13.3 (#3217) 2024-04-23 18:18:21 +00:00
Ibraheem Ahmed fa53de9223
Avoid Removing Quotes From Requirement Markers (#3214)
## Summary

Avoid removing quotes from markers, e.g. `numpy (>=1.19) ;
python_version >= "3.7"` should not be rewritten. Fixes
https://github.com/astral-sh/uv/issues/2551.

This PR also makes fixups a bit more flexible internally for fixes that
aren't simple to implement with a pure regex replacement, like this one.
https://github.com/astral-sh/uv/pull/1529 fixed a similar problem but
the current regex is still not smart enough to avoid all markers
completely (like `python_version`).

## Test Plan

Added a few unit tests.
2024-04-23 14:07:51 -04:00
konsti 70ee3b7cd2
An enum and backticks for lookahead error (#3216)
Mostly a small refactor, adds backticks to be coherent with #3004.
2024-04-23 17:28:10 +00:00
konsti 4a49ff4372
Rename ancillary direct url types to parsed url (#3211)
Followup to #3187. Renaming only
2024-04-23 14:51:23 +00:00
Zanie Blue 645d0399fd
Bump version to 0.1.37 (#3208) 2024-04-23 14:35:27 +00:00
Zanie Blue b8302d44de
Improve tracing for keyring provider (#3207) 2024-04-23 09:23:21 -05:00
Zanie Blue 598a67cf31
Fix fetch of credentials when cache is seeded with username (#3206)
Fixes the failure to lookup credentials in
https://github.com/astral-sh/uv/issues/3205

The issue is that we seed the cache with the index URL which includes a
username but no password. We did not ensure that a password was present
in the cached credentials before attempting a request with them. Now,
the cache will not return credentials when a username is provided and
the cached credentials have no password — the cached credentials are
useless in that case.

Tested with a Google Artifact Registry and keyring

```
RUST_LOG=uv=trace cargo run -q -- pip install requests --index-url https://oauth2accesstoken@us-central1-python.pkg.dev/<project>/pypi/simple/ --no-cache --keyring-provider subprocess -v
```
2024-04-23 09:02:29 -05:00
哇呜哇呜呀咦耶 65efaf70da
Make KeyringProvider::fetch_* async (#3089)
To resolve #3073
2024-04-23 07:58:00 -05:00
Charlie Marsh ad923b71a7
Improve `--python-platform` documentation (#3202)
See:
https://github.com/astral-sh/uv/pull/3154#pullrequestreview-2016083883
2024-04-23 02:42:30 +00:00
renovate[bot] 054fa3e439
Update Rust crate zip to v1 (#3175) 2024-04-22 22:17:44 -04:00
Charlie Marsh 14f05f27b3
Add ticks around error messages more consistently (#3004)
## Summary

I found some of these too bare (e.g., when they _just_ show a package
name with no other information). For me, this makes it easier to
differentiate error message copy from data. But open to other opinions.
Take a look at the fixture changes and LMK!
2024-04-22 23:58:36 +00:00
Charlie Marsh 8536e63438
Add `--python-platform` to `sync` and `install` commands (#3154)
## Summary

pip supports providing a `--platform` to `pip install`, which can be
used to seed an environment (e.g., for use in a container or otherwise).
This PR adds `--python-platform` to our commands to support a similar
workflow. It has some caveats, which are documented on the CLI.

Closes #2079.
2024-04-22 19:31:55 -04:00
konsti d10903f0a4
30s default http read timeout (#3182)
Since we're now using read timeouts and not total timeouts, we can use a
lower threshold, a single read shouldn't take 5 min (and not even 10s).

The 10s value is somewhat arbitrary.

Like #3144, this is a breaking change in some sense.
2024-04-22 19:05:44 -04:00
Zanie Blue ccf4a85f89
Fix Docker publish permissions in release pipeline (#3195) 2024-04-22 19:05:21 -04:00
Zanie Blue b9419e67aa
Add preview mode and use for warning in `uv run` (#3192)
Adds hidden `--preview` / `--no-preview` flags with `UV_PREVIEW`
environment variable support. Copies the `PreviewMode` type from Ruff.

Does a little bit of extra work to port `uv run` to the new settings
model.

Note we allow `uv run` invocations without preview and only use its
presence to toggle an experimental warning.

## Test plan

```
❯ cargo run -q -- run --no-workspace -- python --version
warning: `uv run` is experimental and may change without warning.
Python 3.12.2
❯ cargo run -q -- run --no-workspace --preview -- python --version
Python 3.12.2
❯ UV_PREVIEW=1 cargo run -q -- run --no-workspace -- python --version
Python 3.12.2
```
2024-04-22 15:41:15 -05:00
Zanie Blue 11c6a07bb5
Regenerate with cargo-dist 0.13.2 (#3194) 2024-04-22 19:15:14 +00:00
Zanie Blue 78cd9991d7
Bump version to 0.1.36 (#3193) 2024-04-22 13:55:55 -05:00
renovate[bot] 04eaee7e19
Update Rust crate pyo3 to 0.21.0 (#2911) 2024-04-22 18:27:22 +00:00
Zanie Blue f98eca8843
Fix authentication for URLs with a shared realm (#3130)
In #2976 I made some changes that led to regressions:

- We stopped tracking URLs that we had not seen credentials for in the
cache
- This means the cache no longer returns a value to indicate we've seen
a realm before
- We stopped seeding the cache with URLs 
- Combined with the above, this means we no longer had a list of
locations that we would never attempt to fetch credentials for
- We added caching of credentials found on requests
- Previously the cache was only populated from the seed or credentials
found in the netrc or keyring
- This meant that the cache was populated for locations that we
previously did not cache, i.e. GitHub artifacts(?)

Unfortunately this unveiled problems with the granularity of our cache.
We cache credentials per realm (roughly the hostname) but some realms
have mixed authentication modes i.e. different credentials per URL or
URLs that do not require credentials. Applying credentials to a URL that
does not require it can lead to a failed request, as seen in #3123 where
GitHub throws a 401 when receiving credentials.

To resolve this, the cache is expanded to supporting caching at two
levels:

- URL, cached URL must be a prefix of the request URL
- Realm, exact match required

When we don't have URL-level credentials cached, we attempt the request
without authentication first. On failure, we'll search for realm-level
credentials or fetch credentials from external services. This avoids
providing credentials to new URLs unless we know we need them.

Closes https://github.com/astral-sh/uv/issues/3123
2024-04-22 13:06:57 -05:00
Charlie Marsh 41b29b2dc4
Add support for embedded Python on Windows (#3161)
## Summary

References:
-
cad550030a/src/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py (L58-L68)
- https://github.com/pypa/virtualenv/pull/2353
- https://github.com/pypa/virtualenv/issues/2368

Closes https://github.com/astral-sh/uv/issues/1656.
2024-04-22 13:34:27 -04:00
renovate[bot] 79d4a6556a
Update Rust crate rmp-serde to v1.2.0 (#3173) 2024-04-22 13:27:30 -04:00
Charlie Marsh 792a917a97
Restrict observed requirements to direct when `--no-deps` is specified (#3191)
## Summary

This PR avoids: (1) using the lookahead resolver when `--no-deps` is
specified (we'll never use those requirements), and (2) including any
transitive requirements when searching for allowed URLs, etc., when
`--no-deps` is specified.

Closes https://github.com/astral-sh/uv/issues/3183.
2024-04-22 17:17:58 +00:00
Charlie Marsh a4f125ca34
Avoid waiting for metadata for `--no-deps` editables (#3188)
## Summary

We don't emit a request for this, so we shouldn't wait for it either --
we already have the metadata!

Closes https://github.com/astral-sh/uv/issues/3184.
2024-04-22 16:29:19 +00:00
konsti 725004dcf1
Rename the second direct url to parsed url (#3187)
Previously, we got `pypi_types::DirectUrl` (the pypa spec
direct_url.json format) and `distribution_types::DirectUrl` (an enum of
all the url types we support). This lead me to confusion, so i'm
renaming the latter one to the more appropriate `ParsedUrl`.
2024-04-22 14:38:27 +00:00
konsti 82c4772e89
Move unnamed requirements to their own pep508_rs module and requirements-txt (#3186)
Another refactoring in preparation of using a richer requirements type.
No functional changes, only moves code around
2024-04-22 14:02:39 +00:00
konsti f29c991e21
Dedicated error type for direct url parsing (#3181)
Add a dedicated error type for direct url parsing. This change is broken
out from the new uv requirement type, which uses direct url parsing
internally.
2024-04-22 11:57:36 +00:00
Grzegorz Bokota 0e54cfb019
fix typo in readme (#3179)
## Summary

When creating #3162 I used a single quote `'` instead of grave accent ``
` ``
2024-04-22 08:32:05 +01:00
renovate[bot] 5f5e7b574e
Update Rust crate hyper to v1.3.1 (#3168) 2024-04-21 22:53:55 -05:00
renovate[bot] e6a790b3d5
Update Rust crate axoupdater to v0.5.1 (#3167) 2024-04-21 22:53:42 -05:00
renovate[bot] f0d1eea6cd
Update pre-commit dependencies (#3174) 2024-04-21 21:32:00 -05:00
renovate[bot] b15fe1836e
Update Rust crate thiserror to v1.0.59 (#3172) 2024-04-21 21:30:16 -05:00
renovate[bot] 80f4f36a4f
Update Rust crate serde_json to v1.0.116 (#3171) 2024-04-21 21:30:06 -05:00
renovate[bot] 0e7000e894
Update Rust crate serde to v1.0.198 (#3170) 2024-04-21 21:29:56 -05:00
renovate[bot] 79540003fc
Update Rust crate reflink-copy to v0.1.17 (#3169) 2024-04-21 21:29:47 -05:00
Zanie Blue 496303a6a6
Update Rooster config to bump minor on breaking label (#3166)
Following https://github.com/astral-sh/uv/pull/3151
2024-04-21 16:01:08 -05:00
Charlie Marsh 1bf9d879ab
Re-add Docker image to release pipeline (#3155)
## Summary

I already re-created and pushed the image, and set its visibility to
public (it defaults to private) -- see:
https://github.com/astral-sh/uv/pkgs/container/uv.

Closes https://github.com/astral-sh/uv/issues/2774.
2024-04-21 12:02:48 -04:00
Charlie Marsh 6c12e59d13
Add a versioning policy to the README (#3151)
## Summary

Roughly mirrors https://docs.astral.sh/ruff/versioning/, but slimmed
down for now.
2024-04-21 12:02:41 -04:00