mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Document methods and fields
This commit is contained in:
parent
8897a3df0b
commit
57945caf96
5 changed files with 27 additions and 11 deletions
|
@ -4753,7 +4753,12 @@ pub struct IndexArgs {
|
|||
#[arg(long, env = EnvVars::UV_EXTRA_INDEX_URL, value_delimiter = ' ', value_parser = parse_extra_index_url, help_heading = "Index options")]
|
||||
pub extra_index_url: Option<Vec<Maybe<PipExtraIndex>>>,
|
||||
|
||||
/// FIXME Document
|
||||
/// A proxy URL for an index replaces the canonical index URL specified in
|
||||
/// configuration. It will be used for dependency resolution and installation,
|
||||
/// but the canonical URL will be written to the lockfile.
|
||||
///
|
||||
/// Accepts either a repository compliant with PEP 503 (the simple repository API), or a local
|
||||
/// directory laid out in the same format.
|
||||
#[arg(long, env = EnvVars::UV_INDEX_PROXY_URL, value_delimiter = ' ', value_parser = parse_index_proxy_url, help_heading = "Index options")]
|
||||
pub index_proxy_url: Option<Vec<Maybe<ProxyUrl>>>,
|
||||
|
||||
|
|
|
@ -82,7 +82,11 @@ pub struct Index {
|
|||
/// publish-url = "https://upload.pypi.org/legacy/"
|
||||
/// ```
|
||||
pub publish_url: Option<Url>,
|
||||
/// FIXME Document
|
||||
/// The optional URL of the index proxy. If provided, it will be used instead
|
||||
/// of `Index.url` for resolution and installation. `Index.url` will still be
|
||||
/// written to the lockfile.
|
||||
///
|
||||
/// Expects to receive a URL (e.g., `https://pypi.org/simple`) or a local path.
|
||||
pub proxy_url: Option<IndexUrl>,
|
||||
}
|
||||
|
||||
|
@ -263,8 +267,12 @@ pub enum IndexSourceError {
|
|||
#[derive(Debug, Clone, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub struct ProxyWithCanonicalUrl {
|
||||
/// The full index proxy URL, e.g., `http://localhost:3141/a/b/`.
|
||||
pub url: IndexUrl,
|
||||
/// The index proxy base URL, e.g., `http://localhost:3141/`.
|
||||
pub url_base: Url,
|
||||
/// The canonical index URL, written to the lockfile but replaced by the
|
||||
/// proxy URL during resolution and installation.
|
||||
pub canonical_url: IndexUrl,
|
||||
}
|
||||
|
||||
|
@ -284,7 +292,6 @@ impl ProxyWithCanonicalUrl {
|
|||
}
|
||||
}
|
||||
|
||||
/// FIXME Document
|
||||
#[derive(Debug, Clone, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub struct ProxyUrl {
|
||||
|
|
|
@ -972,7 +972,7 @@ impl Lock {
|
|||
Ok(doc.to_string())
|
||||
}
|
||||
|
||||
/// FIXME Document
|
||||
/// Sets all `Package` URLs to be proxy URLs instead of canonical URLs.
|
||||
pub fn with_proxy_urls(
|
||||
mut self,
|
||||
proxies: Option<&[ProxyWithCanonicalUrl]>,
|
||||
|
@ -994,7 +994,7 @@ impl Lock {
|
|||
Ok(self)
|
||||
}
|
||||
|
||||
/// FIXME Document
|
||||
/// Replaces all proxy URLs found in `Package`s with canonical URLs.
|
||||
pub fn substitute_canonical_urls(
|
||||
&mut self,
|
||||
proxies: Option<&[ProxyWithCanonicalUrl]>,
|
||||
|
@ -1956,7 +1956,7 @@ pub struct Package {
|
|||
}
|
||||
|
||||
impl Package {
|
||||
/// FIXME Document
|
||||
/// Replaces pattern `old` with `new` in all URLs.
|
||||
pub fn replace_urls(&mut self, old: &str, new: &str) {
|
||||
self.id.replace_url(new);
|
||||
if let Some(sdist) = &mut self.sdist {
|
||||
|
@ -2982,7 +2982,8 @@ impl PackageId {
|
|||
}
|
||||
}
|
||||
|
||||
/// FIXME Document
|
||||
/// Replaces the URL with `new_url` if `Source::Registry` is a
|
||||
/// `RegistrySource::Url`.
|
||||
fn replace_url(&mut self, new_url: &str) {
|
||||
if let Source::Registry(RegistrySource::Url(..)) = self.source {
|
||||
let new_url = UrlString::new(SmallString::from(new_url));
|
||||
|
@ -3654,7 +3655,7 @@ impl SourceDist {
|
|||
}
|
||||
}
|
||||
|
||||
/// FIXME Document
|
||||
/// Replaces pattern `old_url` with `new_url`.
|
||||
fn replace_url(&mut self, old_url: &str, new_url: &str) {
|
||||
if let Self::Url { url, .. } = self {
|
||||
*url = UrlString::new(url.base_str().replace(old_url, new_url).into());
|
||||
|
@ -4166,7 +4167,7 @@ impl Wheel {
|
|||
}
|
||||
}
|
||||
|
||||
/// FIXME Document
|
||||
/// Replaces pattern `old_url` with `new_url` if it's a `WheelWireSource::Url`.
|
||||
fn replace_url(&mut self, old: &str, new: &str) {
|
||||
if let WheelWireSource::Url { url } = &self.url {
|
||||
self.url = WheelWireSource::Url {
|
||||
|
|
|
@ -443,7 +443,9 @@ pub struct ResolverInstallerOptions {
|
|||
"#
|
||||
)]
|
||||
pub extra_index_url: Option<Vec<PipExtraIndex>>,
|
||||
/// FIXME Document
|
||||
/// The optional URL of the index proxy. If it exists, it will be used instead
|
||||
/// of the canonical index URL for resolution and installation. The canonical
|
||||
/// URL will still be written to the lockfile.
|
||||
pub proxy_urls: Option<Vec<ProxyUrl>>,
|
||||
/// Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and
|
||||
/// those provided via `--find-links`.
|
||||
|
|
|
@ -3130,7 +3130,8 @@ impl PublishSettings {
|
|||
}
|
||||
}
|
||||
|
||||
/// FIXME: Document
|
||||
/// Adds proxy urls to any matching indexes and returns `ProxyWithCanonicalUrl`s for
|
||||
/// any matches found.
|
||||
fn update_indexes_with_proxies(
|
||||
indexes: &mut [Index],
|
||||
proxy_urls: Option<&Vec<ProxyUrl>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue