Commit graph

266 commits

Author SHA1 Message Date
Charlie Marsh
f0659e76cf
Rename install-wheel-rs library (#7855)
## Summary

I missed this one in the rename (the crate was renamed, but not the
library).
2024-10-01 20:45:39 -04:00
Charlie Marsh
14507a1793
Add uv- prefix to all internal crates (#7853)
## Summary

Brings more consistency to the repo and ensures that all crates
automatically show up in `--verbose` logging.
2024-10-01 20:15:32 -04:00
Aarni Koskela
ed940300f7
Don't create Python bytecode files during interpreter discovery (#7707) 2024-09-26 13:52:10 +00:00
tfsingh
106633a5e5
Add support for upgrading Python in tool environments (#7605)
This PR adds support for upgrading the build environment of tools with
the addition of a ```--python``` argument to ```uv upgrade```, as
specified in #7471.

Some things to note:
- I added support for individual packages — I didn't think there was a
good reason for ```--python``` to only apply to all packages
- Upgrading with ```--python``` also upgrades the package itself — I
think this is fair as if a user wants to _strictly_ switch the version
of Python being used to build a tool's environment they can use ```uv
install```. This behavior can of course be modified if others don't
agree!

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

Closes https://github.com/astral-sh/uv/issues/7471.
2024-09-25 17:40:28 +00:00
Zanie Blue
bef72a8880
Display skipped managed interpreters during Python discovery (#7668)
e.g.

```
❯ cargo run -- python find 3.11rc2 -v
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/uv python find 3.11rc2 -v`
DEBUG uv 0.4.15
DEBUG Searching for Python 3.11rc2 in managed installations or system path
DEBUG Found `cpython-3.12.1-macos-aarch64-none` at `/Users/zb/workspace/uv/.venv/bin/python3` (active virtual environment)
DEBUG Found `cpython-3.12.1-macos-aarch64-none` at `/Users/zb/workspace/uv/.venv/bin/python3` (virtual environment)
DEBUG Searching for managed installations at `/Users/zb/.local/share/uv/python`
DEBUG Skipping incompatible managed installation `cpython-3.13.0rc2-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `cpython-3.12.1-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `cpython-3.11.7-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `cpython-3.10.13-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `cpython-3.9.18-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `cpython-3.8.18-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `cpython-3.8.12-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `pypy-3.9.19-macos-aarch64-none`
DEBUG Found `cpython-3.12.1-macos-aarch64-none` at `/Users/zb/workspace/uv/.venv/bin/python` (search path)
DEBUG Found `cpython-3.12.1-macos-aarch64-none` at `/Users/zb/workspace/uv/.venv/bin/python3` (search path)
DEBUG Found `cpython-3.12.6-macos-aarch64-none` at `/opt/homebrew/bin/python3` (search path)
DEBUG Found `cpython-3.11.10-macos-aarch64-none` at `/opt/homebrew/bin/python3.11` (search path)
DEBUG Found `cpython-3.9.6-macos-aarch64-none` at `/usr/bin/python3` (search path)
error: No interpreter found for Python 3.11rc2 in virtual environments, managed installations, or system path
```
2024-09-24 14:41:41 -05:00
Zanie Blue
e6cd6c9b01
Use the first pre-release discovered when only pre-release Python versions are available (#7666) 2024-09-24 18:00:28 +00:00
Zanie Blue
a53ddaa24a
Require opt-in to use alternative Python implementations (#7650)
Closes #7118 

This only really affects managed interpreters, as we exclude alternative
Python implementations from the search path during the
`VersionRequest::executable_names` part of discovery.
2024-09-24 12:52:15 -05:00
Bas Schoenmaeckers
77c2496f47
Allow creating venv with free-threaded python builds (#7431)
<!--
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

closes #4828

First iteration for an implementation. I need to add more tests but
wanted your opinion on the implementation first.

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
Currently tested using the following command but will add tests shortly:

```console
D:\repo\uv> cargo run venv -p 3.13t && .venv\Scripts\python.exe
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.52s
     Running `target\debug\uv.exe venv -p 3.13t`
Using Python 3.13.0rc1 interpreter at: C:\Users\bschoen\AppData\Local\Programs\Python\Python313\python3.13t.exe
Creating virtualenv at: .venv
Activate with: .venv\Scripts\activate
Python 3.13.0rc1 experimental free-threading build (tags/v3.13.0rc1:e4a3e78, Jul 31 2024, 21:06:58) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 
```

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-23 17:36:16 -05:00
Zanie Blue
0dea932d83
Improve Python executable name discovery when using alternative implementations (#7649)
There are two parts to this. 

The first is a restructuring and refactoring. We had some debt around
expected executable name generation, which we address here by
consolidating into a single function that generates a combination of
names. This includes a bit of extra code around free-threaded variants
because this was written on top of #7431 — I'll rebase that on top of
this.

The second addresses some bugs around alternative implementations.
Notably, `uv python list` does not discovery executables with
alternative implementation names. Now, we properly generate all of the
executable names for `VersionRequest::Any` (originally implemented in
https://github.com/astral-sh/uv/pull/7508) to properly show all the
implementations we can find:

```
❯ cargo run -q -- python list --no-python-downloads
cpython-3.12.6-macos-aarch64-none     /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
cpython-3.11.10-macos-aarch64-none    /opt/homebrew/opt/python@3.11/bin/python3.11 -> ../Frameworks/Python.framework/Versions/3.11/bin/python3.11
cpython-3.9.6-macos-aarch64-none      /Library/Developer/CommandLineTools/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3
pypy-3.10.14-macos-aarch64-none       /opt/homebrew/bin/pypy3 -> ../Cellar/pypy3.10/7.3.17/bin/pypy3
```

While doing both of these changes, I ended up changing the priority of
interpreter discovery slightly. For example, given that the executables
are in the same directory, do we query `python` or `python3.10` first
when you request `--python 3.10`? Previously, we'd check `python3.10`
but I think that was an incorrect optimization. I think we should always
prefer the bare name (i.e. `python`) first. Similarly, this applies to
`python` and an executable for an alternative implementation like
`pypy`. If it's not compatible with the request, we'll skip it anyway.
We might have to query more interpreters with this approach but it seems
rare.


Closes https://github.com/astral-sh/uv/issues/7286 superseding
https://github.com/astral-sh/uv/pull/7508
2024-09-23 17:17:55 -05:00
Zanie Blue
bbb1d3f85a
Determine if pre-release Python downloads should be allowed using the version specifiers (#7638)
Closes #7637

```
❯ uv python install '>=3.11'
Installed Python 3.12.6 in 1.70s
 + cpython-3.12.6-macos-aarch64-none

❯ uv python install 3.13
Installed Python 3.13.0rc2 in 1.89s
 + cpython-3.13.0rc2-macos-aarch64-none

❯ uv python uninstall --all
Searching for Python installations
Uninstalled 2 versions in 94ms
 - cpython-3.12.6-macos-aarch64-none
 - cpython-3.13.0rc2-macos-aarch64-none

❯ uv python install '>=3.11a1'
Installed Python 3.13.0rc2 in 1.89s
 + cpython-3.13.0rc2-macos-aarch64-none
```
2024-09-23 14:08:59 -05:00
Zanie Blue
9164999f23
Allow system environments during project environment validity check (#7585) 2024-09-20 12:28:17 -05:00
Zanie Blue
6b08aaecad
Avoid warning about bad Python interpreter links for empty project environment directories (#7527)
Someone reported this a while back (will try to find the issue), and I
ran into it working on #7522
2024-09-19 06:49:35 -05:00
Zanie Blue
09a2ebca8b
Add new PythonRequest::Any and VersionRequest::Any variants (#7517)
Follow-up to https://github.com/astral-sh/uv/pull/7514 and #7526 adding
the `Any` variants again with slightly different semantics (i.e., they
allow pre-releases)

We'll be able to use this in https://github.com/astral-sh/uv/pull/7508
to avoid querying a bunch of alternative interpreters unnecessarily in
the non-list case.
2024-09-19 11:19:13 +00:00
Zanie Blue
0f9a2e3870
Rename VersionRequest::Any -> VersionRequest::Default (#7526)
As in https://github.com/astral-sh/uv/pull/7514
2024-09-19 11:05:09 +00:00
Zanie Blue
5941709e55
Rename PythonRequest::Any -> PythonRequest::Default (#7514)
As we support more complex Python discovery behaviors such as:

- #7431 
- #7335 
- #7300 

`Any` is no longer accurate, we actually are looking for a reasonable
default Python version to use which may exclude the first one we find.
Separately, we need the idea of `Any` to improve behavior when listing
versions (e.g., #7286) where we do actually want to match _any_ Python
version. As a first step, we'll rename `Any` to `Default`. Then, we'll
introduce a new `Any` that actually behaves as we'd expect.
2024-09-19 05:56:05 -05:00
Zanie Blue
4611412757
Allow Python pre-releases to be used if they are first on the PATH (#7470)
Closes https://github.com/astral-sh/uv/issues/7469
2024-09-18 10:19:10 -05:00
Zanie Blue
08a7c708d1
Do not allow local versions in Python version requests either (#7468)
Accidentally squashed https://github.com/astral-sh/uv/pull/7465 into the
wrong target.
2024-09-17 16:10:38 +00:00
Zanie Blue
8d7925026d
Add VersionRequest test cases for post and dev segments (#7464) 2024-09-17 10:59:41 -05:00
Mikko Leppänen
bb0ffa32e4
Support pre-releases in Python version requests - command --python <major.minor.pre-release> (#7335)
## Summary

This PR adds support to include Python pre-releases when requesting
versions.
Check out the docs for commands that support the `Python` option: 
```text
--python, -p python
The Python interpreter to use for the virtual environment.
```
At least the following scenarios are supported:
```bash
3.13.0a1
3.13b2
3.13rc4
313rc1
```

## Test Plan

I added a basic unit test to `uv/crates/uv-python/src/discovery.rs`. I
could have added more, but I have not discovered any relevant places.

CI passes

Note: I was unable to execute the entire test set locally. There were at
least some timeout issues (some tests took over 60 seconds).

========== output ===========
beta version
```bash
cargo run -- venv --python 3.13.0b3                                                                                                           ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/uv venv --python 3.13.0b3`
Using Python 3.13.0b3 interpreter at: /home/mikko/.pyenv/versions/3.13.0b3/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
````
release candidate
```bash
 cargo run -- venv --python 3.13.0rc2                                                                                                          ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.83s
     Running `target/debug/uv venv --python 3.13.0rc2`
Using Python 3.13.0rc2 interpreter at: /home/mikko/.pyenv/versions/3.13.0rc2/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

```bash
cargo run -- venv --python 313rc2                                                                                                             ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
     Running `target/debug/uv venv --python 313rc2`
Using Python 3.13.0rc2 interpreter at: /home/mikko/.pyenv/versions/3.13.0rc2/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-17 09:46:46 -05:00
Zanie Blue
f679987fe1
Include the parent interpreter in Python discovery when --system is used (#7440)
Closes https://github.com/astral-sh/uv/issues/7417

Tested with this epic blurb

```
❯ uv pip install --python /Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3 . --break-system-packages --reinstall
Resolved 1 package in 0.91ms
   Built uv @ file:///Users/zb/workspace/uv
Prepared 1 package in 2m 48s
Uninstalled 1 package in 1ms
Installed 1 package in 1ms
 - uv==0.4.10
 + uv==0.4.10 (from file:///Users/zb/workspace/uv)
❯ /Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3 -m uv pip install --system -v httpx
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in system path
DEBUG Found `cpython-3.13.0rc2-macos-aarch64-none` at `/Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3` (parent interpreter)
DEBUG Using Python 3.13.0rc2 environment at /Users/zb/.local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3
```
2024-09-16 22:51:50 -05:00
Zanie Blue
d3e6765cea
Add test case for Python selection when invoked with python -m uv --system (#7439) 2024-09-16 15:42:06 -05:00
Zanie Blue
6066989ed4
Add test case for Python pre-release versions from parent interpreter (#7438) 2024-09-16 15:41:58 -05:00
Zanie Blue
e8899fe7f9
Add test case for Python pre-release versions from VIRTUAL_ENV (#7437) 2024-09-16 15:41:53 -05:00
Charlie Marsh
f895c40a4e
Avoid removing seed packages for uv venv --seed environments (#7410)
## Summary

Closes https://github.com/astral-sh/uv/issues/7121.
2024-09-15 22:27:52 +00:00
Zanie Blue
f22e5ef69a
Avoid selecting prerelease Python installations without opt-in (#7300)
Similar to our semantics for packages with pre-release versions.

We will not use prerelease versions unless there are only prerelease
versions available, a specific version is requested,
or the prerelease version is found in a reasonable source (active
environment, explicit path, etc. but not `PATH`).

For example, `uv python install 3.13 && uv run python --version` will no
longer use `3.13.0rc2` unless that is the only Python version available,
`--python 3.13` is used, or that's the Python version that is present in
`.venv`.
2024-09-11 15:49:33 -05:00
Zanie Blue
c50eb12c51
Include pre-release Python versions in uv python list (#7290)
Follows https://github.com/astral-sh/uv/pull/7278

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

`uv python list` should show installed pre-release versions, even though
we don't select them by default (as defined by #7300 and
https://github.com/astral-sh/uv/pull/7278)
2024-09-11 14:46:16 -05:00
Zanie Blue
77d278f68a
Avoid selecting pre-releases for Python downloads without a version request (#7278)
Following #7263 the 3.13.0rc2 releases are at the top of the download
list but we should not select them unless 3.13 is actually requested.

Prior to this, `uv python install` would install `3.13.0rc2`. 

```
❯ cargo run -- python install --no-config
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/uv python install --no-config`
Searching for Python installations
Installed Python 3.12.6 in 1.33s
 + cpython-3.12.6-macos-aarch64-none
```

```
❯ cargo run -- python install --no-config 3.13
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/uv python install --no-config 3.13`
Searching for Python versions matching: Python 3.13
Installed Python 3.13.0rc2 in 1.18s
 + cpython-3.13.0rc2-macos-aarch64-none
```
2024-09-10 22:20:18 +00:00
Zanie Blue
0e9870078e
Add support for managed Python 3.13 and update CPython versions (#7263)
Adds support for CPython 3.13.0rc2

Also bumps to the latest patch version of all the other CPython minor
versions we support.
2024-09-10 14:36:16 -05:00
Zanie Blue
0dc1f5db21
Improve error message when requested Python version is unsupported (#7269)
Follows test cases in #7265 and validation removal in
https://github.com/astral-sh/uv/pull/7264

It turns out we don't have good error messages for these as-is.
2024-09-10 19:01:36 +00:00
Zanie Blue
aa52952512
Deduplicate implementation for python_installation_from_directory (#7267) 2024-09-10 18:41:31 +00:00
Zanie Blue
533c7e3bfd
Drop Python version range enforcement from PythonVersion::from_str (#7264)
This caused some problems earlier, as it prevented us from _listing_
Python versions <3.7 which seems weird (see
https://github.com/astral-sh/uv/pull/7131#issuecomment-2334929000)

I'm worried that without this the changes to installation key parsing in
https://github.com/astral-sh/uv/pull/7263 would otherwise be too
restrictive.

I think if we want to enforce these ranges, we should do so separately
from the parse step.
2024-09-10 13:34:18 -05:00
Charlie Marsh
fe8880bf3c
Surface dedicated errors for .python-version conflict with requires-python (#7218)
## Summary

I got confused because I had a `.python-version` file that conflicted
with my `requires-python`.
2024-09-09 17:12:53 -04:00
Charlie Marsh
4f2349119c
Add support for dynamic cache keys (#7136)
## Summary

This PR adds a more flexible cache invalidation abstraction for uv, and
uses that new abstraction to improve support for dynamic metadata.

Specifically, instead of relying solely on a timestamp, we now pass
around a `CacheInfo` struct which (as of now) contains
`Option<Timestamp>` and `Option<Commit>`. The `CacheInfo` is saved in
`dist-info` as `uv_cache.json`, so we can test already-installed
distributions for cache validity (along with testing _cached_
distributions for cache validity).

Beyond the defaults (`pyproject.toml`, `setup.py`, and `setup.cfg`
changes), users can also specify additional cache keys, and it's easy
for us to extend support in the future. Right now, cache keys can either
be instructions to include the current commit (for `setuptools_scm` and
similar) or file paths (for `hatch-requirements-txt` and similar):

```toml
[tool.uv]
cache-keys = [{ file = "requirements.txt" }, { git = true }]
```

This change should be fully backwards compatible.

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

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

Closes https://github.com/astral-sh/uv/issues/6860.
2024-09-09 20:19:15 +00:00
Charlie Marsh
64e03ad56c
Direct users towards uv venv to create a virtual environment (#7188)
## Summary

Closes https://github.com/astral-sh/uv/issues/7123.
2024-09-08 22:33:34 +00:00
konsti
aca01f80ef
Clearer registry Python sort (#7178)
Change the registry Python sorting implementation to be easier to
follow, making it clearer what it does and that it is a total order. No
functional changes.
2024-09-07 15:57:01 -04:00
Zanie Blue
8eff8aab0b
Avoid panicking when encountering an invalid Python version during uv python list (#7131)
Closes https://github.com/astral-sh/uv/issues/7129

Not entirely sure about the best approach yet.
2024-09-06 19:23:16 -04:00
Charlie Marsh
8a0e1fde33
Write trailing newline to .python-version files (#7140)
## Summary

Closes https://github.com/astral-sh/uv/issues/7135.
2024-09-06 18:03:52 -04:00
Charlie Marsh
50d7b9c38a
Pin .python-version in uv init (#6869)
## Summary

I'm not convinced that the behavior is correct as-implemented. When the
user passes a `--python >=3.8` or we discover a `requires-python` from
the workspace, we're currently writing that request out to
`.python-version`. I would probably rather that we write the resolved
patch version?

Closes https://github.com/astral-sh/uv/issues/6821.
2024-09-03 19:43:50 -04:00
eth3lbert
ad82b94856
Support file:// URLs for UV_PYTHON_INSTALL_MIRROR (#6950)
## Summary

Closes #6319.

## Test Plan

I tested with `file:///mirror`, `file://localhost/mirror`, and
`http://mirror` to confirm that it was working as expected.

``` shell-session
/private/tmp/mirror-local                                                                                                                                                                      07:08:18
:)  tree mirror 
mirror/
└── 20240814/
   └── cpython-3.12.5+20240814-aarch64-apple-darwin-install_only_stripped.tar.gz
```

<img width="626" alt="image"
src="https://github.com/user-attachments/assets/9c04224d-305c-47ee-a524-4a6abeb79da4">
2024-09-03 01:20:01 +00:00
Ed Morley
a5f1e1c765
Fix typos in docs, error messages and comments (#6910) 2024-09-01 11:37:43 +00:00
Charlie Marsh
95416ad52e
Take unowned request in PythonInstallation::find_or_download (#6868) 2024-08-30 13:49:17 +00:00
konsti
9814852295
Discover Microsoft Store Pythons (#6807)
Microsoft Store Pythons do not always register themselves in the
registry, so we port
<58ce131037/PC/launcher2.c (L1744)>
and look them up on the filesystem in known locations.

## Test Plan

So far I've confirmed that we find a store Python when I use `cargo run
python list`, can we make this a part of any of the platform tests
maybe?
2024-08-29 20:56:41 +00:00
konsti
a39eb61ade
Use windows registry to discover python (#6761)
Our current strategy of parsing the output of `py --list-paths` to get
the installed python versions on windows is brittle (#6524, missing
`py`, etc.) and it's slow (10ms last time i measured).

Instead, we should behave spec-compliant and read the python versions
from the registry following PEP 514.

It's not fully clear which errors we should ignore and which ones we
need to raise.

We're using the official rust-for-windows crates for accessing the
registry.

Fixes #1521
Fixes #6524
2024-08-29 22:48:22 +02:00
Zanie Blue
a17c1e8e40
Add test coverage for Python version discovery with prereleases (#6823)
Coverage for https://github.com/astral-sh/uv/pull/6813 — reverting that
commit causes the 3.11.0b0 test case to fail.
2024-08-29 13:29:22 -05:00
Charlie Marsh
f046e54c64
Ignore pre-release segments when discovering via requires-python (#6813)
## Summary

`3.13.0b0` should be allowed by `>=3.13`.

Closes #6798.
2024-08-29 11:45:29 -05:00
Zanie Blue
e3d5d3d26d
Avoid deadlocks when multiple uv processes lock resources (#6790)
This is achieved by updating the `LockedFile::acquire` API to be async —
as in some cases we were attempting to acquire the lock synchronously,
i.e., without yielding, which blocked the runtime.

Closes https://github.com/astral-sh/uv/issues/6691 — I tested with the
reproduction there and a local release build and no longer reproduce the
deadlock with these changes.

Some additional context in the [internal Discord
thread](1278478941)
2024-08-29 11:16:14 -05:00
github-actions[bot]
3be4fe59d7
Sync latest Python releases (#6784) 2024-08-29 03:41:07 +00:00
renovate[bot]
1309f24c43
Update Rust crate windows-sys to 0.59.0 (#5785)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [windows-sys](https://togithub.com/microsoft/windows-rs) |
workspace.dependencies | minor | `0.52.0` -> `0.59.0` |

---

### Release Notes

<details>
<summary>microsoft/windows-rs (windows-sys)</summary>

###
[`v0.59.0`](https://togithub.com/microsoft/windows-rs/releases/tag/0.59.0)

[Compare
Source](https://togithub.com/microsoft/windows-rs/compare/0.52.0...0.59.0)

This release includes an update to the
[windows-sys](https://crates.io/crates/windows-sys) crate only. The
`windows-sys` crate is updated very infrequently and only when there is
an explicit need to do so. The 0.59.0 release includes a rollup of API
fixes, updates, and additions since the
[0.52.0](https://togithub.com/microsoft/windows-rs/releases/tag/0.52.0)
release nine months ago. Notably:

- This update introduces support for Arm64EC
([#&#8203;2957](https://togithub.com/microsoft/windows-rs/issues/2957))
- Updated bindings for the latest APIs
https://github.com/microsoft/windows-rs/tree/0.59.0/crates/libs/bindgen/default
- Derive standard traits
([#&#8203;3041](https://togithub.com/microsoft/windows-rs/issues/3041))
-   Updates to code generation to handle newer Rust warnings and lints
- Overall smaller crate and more efficient code gen to reduce build time
- Support for feature search
https://microsoft.github.io/windows-rs/features/#/0.59.0
-   MSRV is updated to 1.60

**Full Changelog**:
https://github.com/microsoft/windows-rs/compare/0.52.0...0.59.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/uv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM4LjU2LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImludGVybmFsIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-28 08:43:59 -05:00
Charlie Marsh
d86075fc1e
Add support for --trusted-host (#6591)
## Summary

This PR revives https://github.com/astral-sh/uv/pull/4944, which I think
was a good start towards adding `--trusted-host`. Last night, I tried to
add `--trusted-host` with a custom verifier, but we had to vendor a lot
of `reqwest` code and I eventually hit some private APIs. I'm not
confident that I can implement it correctly with that mechanism, and
since this is security, correctness is the priority.

So, instead, we now use two clients and multiplex between them.

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

## Test Plan

Created self-signed certificate, and ran `python3 -m http.server --bind
127.0.0.1 4443 --directory . --certfile cert.pem --keyfile key.pem` from
the packse index directory.

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
https://127.0.0.1:8443/simple-html` failed with:

```
error: Request failed after 3 retries
  Caused by: error sending request for url (https://127.0.0.1:8443/simple-html/transitive-yanked-and-unyanked-dependency-a-0abad3b6/)
  Caused by: client error (Connect)
  Caused by: invalid peer certificate: Other(OtherError(CaUsedAsEndEntity))
```

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
'https://127.0.0.1:8443/simple-html' --trusted-host '127.0.0.1:8443'`
failed with the expected error (invalid resolution) and made valid
requests.

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
'https://127.0.0.1:8443/simple-html' --trusted-host '127.0.0.2' -n` also
failed.
2024-08-27 09:36:50 -04:00
konsti
ae57d85dfb
Detect musl and error for musl pbs builds (#6643)
As described in #4242, we're currently incorrectly downloading glibc
python-build-standalone on musl target, but we also can't fix this by
using musl python-build-standalone on musl targets since the musl builds
are effectively broken.

We reintroduce the libc detection previously removed in #2381, using it
to detect which libc is the current one before we have a python
interpreter. I changed the strategy a big to support an empty `PATH`
which we use in the tests.

For simplicity, i've decided to just filter out the musl
python-build-standalone archives from the list of available archive,
given this is temporary. This means we show the same error message as if
we don't have a build for the platform. We could also add a dedicated
error message for musl.

Fixes #4242

## Test Plan

Tested manually.

On my ubuntu host, python downloads continue to pass:
```
target/x86_64-unknown-linux-musl/debug/uv python install
```

On alpine, we fail:
```
$ docker run -it --rm -v .:/io alpine /io/target/x86_64-unknown-linux-musl/debug/uv python install
  Searching for Python installations
  error: No download found for request: cpython-any-linux-x86_64-musl
```
2024-08-27 00:06:53 +00:00