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

Make Python and PyPy install mirrors configurable in uv.toml #8695

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

owenbrooks
Copy link

@owenbrooks owenbrooks commented Oct 30, 2024

Summary

Adds python-install-mirror and pypy-install-mirror as keys for uv.toml, and cli args for uv python install.

Could leave the cli args out if we think the env vars and configs are sufficient.

Fixes #8186

@konstin konstin requested a review from zanieb October 30, 2024 11:32
@@ -129,10 +130,20 @@ impl PythonInstallation {

let download = ManagedPythonDownload::from_request(&request)?;
let client = client_builder.build();
let python_install_mirror = std::env::var(EnvVars::UV_PYTHON_INSTALL_MIRROR).ok();
let pypy_install_mirror = std::env::var(EnvVars::UV_PYPY_INSTALL_MIRROR).ok();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to thread the values through here too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would keep it consistent. Do we want the cli args? Looks like that fetch function ends up being called by quite a few commands.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to add the CLI args everywhere. I'd propagate the settings to here instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we also have to resolve the settings with the environment variable at some point then?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding to this. I worked on this a bit before this pr was made. I tried doing this a bit differently.

  • I added the python and pypy install mirros to GloablOptions in uv-settings
  • the env vars for the same were also added to env (vars not exposed as cli args) inside of the uv crate.
  • the setting from uv.toml and the environment variables are combined in GlobalSettings::resolve
  • There were quite a few functions that had to be changed to include the mirrors as parameters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zanieb -- Should these just be globals, like --allow-insecure-host? (Do they even need to be exposed on the command-line at all?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's reasonable to expose them in uv python install, but I wouldn't expose them elsewhere.

crates/uv-cli/src/lib.rs Outdated Show resolved Hide resolved
crates/uv-cli/src/lib.rs Outdated Show resolved Hide resolved
@owenbrooks owenbrooks force-pushed the mirror_configs branch 4 times, most recently from 9c84690 to 61c55fe Compare November 3, 2024 03:14
@Fau57
Copy link

Fau57 commented Nov 3, 2024

Not sure if this change has happened or will happen or once at all but I am all for it

@owenbrooks owenbrooks force-pushed the mirror_configs branch 3 times, most recently from 61617c7 to 6fabe9a Compare November 4, 2024 22:09
@owenbrooks owenbrooks force-pushed the mirror_configs branch 3 times, most recently from c5e52d4 to 4e5e9f6 Compare November 4, 2024 23:15
@owenbrooks
Copy link
Author

Config has been threaded through the other relevant commands. The CLI args take precedence over env vars which take precedence over config values. CLI args are present only for python install.

@owenbrooks owenbrooks marked this pull request as ready for review November 4, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make UV_PYTHON_INSTALL_MIRROR configurable in uv.toml
5 participants