Allow setting proxy variables via global / user configuration (#16918)
<!-- 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 <!-- What's the purpose of the change? What does it do, and why? --> This allows users to set the HTTP, HTTPS, and no proxy variables via the configuration files like ~pyproject.toml~ and uv.toml. Users can set like so: `uv.toml` ```toml https-proxy = "http://my_cool_proxy:10500" http-proxy = "http://my_cool_proxy:10500" no-proxy = [ "dontproxyme.com", "localhost", ] ``` Resolves https://github.com/astral-sh/uv/issues/9472 ## Test Plan <!-- How was it tested? --> It also adds a new integration test for the proxy support in `uv-client`. This was tested on some of our developer machines with our proxy setup using `~/.config/uv/uv.toml` with values like: ```toml https-proxy = "http://my_cool_proxy:10500" http-proxy = "http://my_cool_proxy:10500" no-proxy = [ "dontproxyme.com", "localhost", ] ``` --------- Signed-off-by: Eli Uriegas <eliuriegas@meta.com> Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
@@ -283,26 +283,40 @@ fn emit_field(output: &mut String, name: &str, field: &OptionField, parents: &[S
|
||||
option_type: OptionType::Configuration,
|
||||
..
|
||||
} => {
|
||||
output.push_str(&format_tab(
|
||||
"pyproject.toml",
|
||||
&format_header(
|
||||
field.scope,
|
||||
// For uv_toml_only options, only show the uv.toml tab
|
||||
if field.uv_toml_only {
|
||||
output.push_str(&format_code(
|
||||
"uv.toml",
|
||||
&format_header(
|
||||
field.scope,
|
||||
field.example,
|
||||
parents,
|
||||
ConfigurationFile::UvToml,
|
||||
),
|
||||
field.example,
|
||||
parents,
|
||||
ConfigurationFile::PyprojectToml,
|
||||
),
|
||||
field.example,
|
||||
));
|
||||
output.push_str(&format_tab(
|
||||
"uv.toml",
|
||||
&format_header(
|
||||
field.scope,
|
||||
));
|
||||
} else {
|
||||
output.push_str(&format_tab(
|
||||
"pyproject.toml",
|
||||
&format_header(
|
||||
field.scope,
|
||||
field.example,
|
||||
parents,
|
||||
ConfigurationFile::PyprojectToml,
|
||||
),
|
||||
field.example,
|
||||
parents,
|
||||
ConfigurationFile::UvToml,
|
||||
),
|
||||
field.example,
|
||||
));
|
||||
));
|
||||
output.push_str(&format_tab(
|
||||
"uv.toml",
|
||||
&format_header(
|
||||
field.scope,
|
||||
field.example,
|
||||
parents,
|
||||
ConfigurationFile::UvToml,
|
||||
),
|
||||
field.example,
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user