astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
19.93k stars 591 forks source link

Add Prompts to use System or Managed Python versions or add "auto" option for python preferences #6592

Open vasudev-gm opened 2 weeks ago

vasudev-gm commented 2 weeks ago

Well sorry for another late Feature request. Ran into an issue at work wherein the downloaded python versions through uv were not detected when passing the command: uv venv --python 3.8

until I had to re-check the documentation and pass the python preference to be system or managed with command: uv venv --python 3.8 -p managed

Will it be possible for uv to prompt the user which version to install or can we set it globally to prefer only managed versions?

Thanks.

charliermarsh commented 2 weeks ago

Just confirming, is this on v0.3.0 or later?

vasudev-gm commented 2 weeks ago

Yes 0.3.0 and later. I am using uv 0.3.2.


From: Charlie Marsh @.> Sent: Sunday, August 25, 2024 8:01:09 AM To: astral-sh/uv @.> Cc: Vasudev @.>; Author @.> Subject: Re: [astral-sh/uv] Add Prompts to use System or Managed Python versions or add "auto" option for python preferences (Issue #6592)

Just confirming, is this on v0.3.0 or later?

— Reply to this email directly, view it on GitHubhttps://github.com/astral-sh/uv/issues/6592#issuecomment-2308627528, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANCXKEYSLMM6VLF6JG7MI5DZTE6W3AVCNFSM6AAAAABNB6AI76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGYZDONJSHA. You are receiving this because you authored the thread.Message ID: @.***>

zanieb commented 2 weeks ago

Are you saying that you had not run uv python install 3.8 but you wanted us to install and use a managed Python version?

uv venv --python 3.8 -p managed should be the same as uv venv --python 3.8 — the default preference is managed.

For global configuration, you'll want to to set python-preference to "only-managed" in a user-level uv.toml.

vasudev-gm commented 2 weeks ago

I did install the python versions. Currently I have pipenv installed and managing venv. So there's no way to declare globally besides using toml config? I had to declare --python- preference managed in cmdline


From: Zanie Blue @.> Sent: Monday, August 26, 2024 10:17:13 pm To: astral-sh/uv @.> Cc: Vasudev @.>; Author @.> Subject: Re: [astral-sh/uv] Add Prompts to use System or Managed Python versions or add "auto" option for python preferences (Issue #6592)

Are you saying that you had not run uv python install 3.8 but you wanted us to install and use a managed Python version?

For global configuration, you'll want to to set python-preferencehttps://docs.astral.sh/uv/reference/settings/#python-preference to "only-managed" in a user-level uv.tomlhttps://docs.astral.sh/uv/configuration/files/.

— Reply to this email directly, view it on GitHubhttps://github.com/astral-sh/uv/issues/6592#issuecomment-2310634669, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANCXKE4WK6KXTXNXOOGN5STZTNLY3AVCNFSM6AAAAABNB6AI76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGYZTINRWHE. You are receiving this because you authored the thread.Message ID: @.***>

zanieb commented 2 weeks ago

I still don't quite follow what you're saying, because --python-preference managed matches out default and should have no effect. Anyway, you can also use UV_PYTHON_PREFERENCE to configure this globally.

vasudev-gm commented 2 weeks ago

I still don't quite follow what you're saying, because --python-preference managed matches out default and should have no effect. Anyway, you can also use UV_PYTHON_PREFERENCE to configure this globally.

I will try to be clear as possible. So I wanted to ask if uv options can be set globally without needing .toml file OR uv should prompt the user asking whether to use system or managed installed when python runtimes are detected without the need for passing --python-preference [managed|system] in the command line.

zanieb commented 2 weeks ago

I don't think we'll block commands for interactive prompting on which Python interpreter to use. We use whatever interpreter we can find to satisfy the Python version — this default is very intentional. If you don't want to use the system interpreters at all, we have several ways to configure that globally and per invocation.

vasudev-gm commented 2 weeks ago

I'll try the uv commands. Is there a documentation link for global commands for uv.


From: Zanie Blue @.> Sent: Tuesday, August 27, 2024 12:08:12 AM To: astral-sh/uv @.> Cc: Vasudev @.>; Author @.> Subject: Re: [astral-sh/uv] Add Prompts to use System or Managed Python versions or add "auto" option for python preferences (Issue #6592)

I don't think we'll block commands for interactive prompting on which Python interpreter to use. We use whatever interpreter we can find to satisfy the Python version — this default is very intentional. If you don't want to use the system interpreters at all, we have several ways to configure that globally and per invocation.

— Reply to this email directly, view it on GitHubhttps://github.com/astral-sh/uv/issues/6592#issuecomment-2310830097, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANCXKE4YTPMTWLEGHVOMPOLZTNYZJAVCNFSM6AAAAABNB6AI76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQHAZTAMBZG4. You are receiving this because you authored the thread.Message ID: @.***>

zanieb commented 2 weeks ago

Like https://docs.astral.sh/uv/reference/cli/ ?

vasudev-gm commented 2 weeks ago

Didn't know there it's a web version of entire commands. Been using uv --help to find how to use the commands. Thanks


From: Zanie Blue @.> Sent: Tuesday, August 27, 2024 9:22:10 PM To: astral-sh/uv @.> Cc: Vasudev @.>; Author @.> Subject: Re: [astral-sh/uv] Add Prompts to use System or Managed Python versions or add "auto" option for python preferences (Issue #6592)

Like https://docs.astral.sh/uv/reference/cli/ ?

— Reply to this email directly, view it on GitHubhttps://github.com/astral-sh/uv/issues/6592#issuecomment-2312937145, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANCXKE7JGCNM3DXWTZNWQBTZTSOCVAVCNFSM6AAAAABNB6AI76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJSHEZTOMJUGU. You are receiving this because you authored the thread.Message ID: @.***>

zanieb commented 2 weeks ago

Yep no problem! It's generated from the uv help reference which is more verbose than uv --help.