Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor uv-toolchain types #4121

Merged
merged 6 commits into from
Jun 7, 2024
Merged

Refactor uv-toolchain types #4121

merged 6 commits into from
Jun 7, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jun 7, 2024

Extends #4120
Part of #2607

There should be no behavior changes here. Restructures the discovery API to be focused on a toolchain first perspective in preparation for exposing a find_or_fetch method for toolchains in #4138.

@zanieb zanieb added the internal A refactor or improvement that is not user-facing label Jun 7, 2024
@zanieb zanieb force-pushed the zb/toolchain-ii branch from 932a090 to 1b20055 Compare June 7, 2024 00:14
@zanieb zanieb force-pushed the zb/toolchain-iii branch 3 times, most recently from 448b1b5 to a3d1e00 Compare June 7, 2024 14:54
@zanieb zanieb force-pushed the zb/toolchain-ii branch from 1b20055 to ef512bb Compare June 7, 2024 14:57
@zanieb zanieb force-pushed the zb/toolchain-iii branch 2 times, most recently from 162f821 to a5ad118 Compare June 7, 2024 15:22
@zanieb zanieb marked this pull request as ready for review June 7, 2024 18:14
Base automatically changed from zb/toolchain-ii to main June 7, 2024 18:59
zanieb added a commit that referenced this pull request Jun 7, 2024
In preparation for managed toolchains #2607, just renames the crate to
something broader.

See #4121 and #4138 to see the final
intent.
@zanieb zanieb force-pushed the zb/toolchain-iii branch from a5ad118 to 3b6a685 Compare June 7, 2024 18:59
@zanieb zanieb merged commit 53035d6 into main Jun 7, 2024
46 checks passed
@zanieb zanieb deleted the zb/toolchain-iii branch June 7, 2024 19:20
zanieb added a commit that referenced this pull request Jun 7, 2024
zanieb added a commit that referenced this pull request Jun 10, 2024
…4138)

Extends #4121
Part of #2607 

Adds support for managed toolchain fetching to `uv venv`, e.g.

```
❯ cargo run -q -- venv --python 3.9.18 --preview -v
DEBUG Searching for Python 3.9.18 in search path or managed toolchains
DEBUG Searching for managed toolchains at `/Users/zb/Library/Application Support/uv/toolchains`
DEBUG Found CPython 3.12.3 at `/opt/homebrew/bin/python3` (search path)
DEBUG Found CPython 3.9.6 at `/usr/bin/python3` (search path)
DEBUG Found CPython 3.12.3 at `/opt/homebrew/bin/python3` (search path)
DEBUG Requested Python not found, checking for available download...
DEBUG Using registry request timeout of 30s
INFO Fetching requested toolchain...
DEBUG Downloading https://github.com/indygreg/python-build-standalone/releases/download/20240224/cpython-3.9.18%2B20240224-aarch64-apple-darwin-pgo%2Blto-full.tar.zst to temporary location /Users/zb/Library/Application Support/uv/toolchains/.tmpgohKwp
DEBUG Extracting cpython-3.9.18%2B20240224-aarch64-apple-darwin-pgo%2Blto-full.tar.zst
DEBUG Moving /Users/zb/Library/Application Support/uv/toolchains/.tmpgohKwp/python to /Users/zb/Library/Application Support/uv/toolchains/cpython-3.9.18-macos-aarch64-none
Using Python 3.9.18 interpreter at: /Users/zb/Library/Application Support/uv/toolchains/cpython-3.9.18-macos-aarch64-none/install/bin/python3
Creating virtualenv at: .venv
INFO Removing existing directory
Activate with: source .venv/bin/activate
```

The preview flag is required. The fetch is performed if we can't find an
interpreter that satisfies the request. Once fetched, the toolchain will
be available for later invocations that include the `--preview` flag.
There will be follow-ups to improve toolchain management in general,
there is still outstanding work from the initial implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants