Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/uv-audit/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub struct Vulnerability {
}

impl Vulnerability {
pub fn new(
pub(crate) fn new(
dependency: Dependency,
id: VulnerabilityID,
summary: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-auth/src/keyring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl std::fmt::Display for KeyringProviderBackend {

impl KeyringProvider {
/// Create a new [`KeyringProvider::Native`].
pub fn native() -> Self {
pub(crate) fn native() -> Self {
Self {
backend: KeyringProviderBackend::Native,
}
Expand Down
6 changes: 4 additions & 2 deletions crates/uv-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ pub use pyx::{
is_default_pyx_domain,
};
pub use realm::{Realm, RealmRef};
pub use service::{Service, ServiceParseError};
pub use store::{AuthBackend, AuthScheme, TextCredentialStore, TomlCredentialError};
pub use service::Service;
pub(crate) use service::ServiceParseError;
pub(crate) use store::AuthScheme;
pub use store::{AuthBackend, TextCredentialStore, TomlCredentialError};

mod access_token;
mod cache;
Expand Down
8 changes: 4 additions & 4 deletions crates/uv-auth/src/pyx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ fn read_pyx_auth_token() -> Option<AccessToken> {
/// and a new refresh token.
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct PyxOAuthTokens {
pub access_token: AccessToken,
pub refresh_token: String,
pub(crate) access_token: AccessToken,
pub(crate) refresh_token: String,
}

/// An access token with an accompanying API key.
Expand Down Expand Up @@ -583,9 +583,9 @@ impl TokenStoreError {
#[derive(Debug, serde::Deserialize)]
pub struct PyxJwt {
/// The expiration time of the JWT, as a Unix timestamp.
pub exp: Option<i64>,
pub(crate) exp: Option<i64>,
/// The issuer of the JWT.
pub iss: Option<String>,
pub(crate) iss: Option<String>,
/// The name of the organization, if any.
#[serde(rename = "urn:pyx:org_name")]
pub name: Option<String>,
Expand Down
8 changes: 5 additions & 3 deletions crates/uv-auth/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub enum TomlCredentialError {
}

impl TomlCredentialError {
pub fn as_io_error(&self) -> Option<&std::io::Error> {
pub(crate) fn as_io_error(&self) -> Option<&std::io::Error> {
match self {
Self::Io(err) => Some(err),
Self::LockedFile(err) => err.as_io_error(),
Expand Down Expand Up @@ -261,7 +261,7 @@ impl TextCredentialStore {
}

/// Acquire a lock on the credentials file at the given path.
pub async fn lock(path: &Path) -> Result<LockedFile, TomlCredentialError> {
pub(crate) async fn lock(path: &Path) -> Result<LockedFile, TomlCredentialError> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;
}
Expand Down Expand Up @@ -297,7 +297,9 @@ impl TextCredentialStore {
/// Returns [`TextCredentialStore`] and a [`LockedFile`] to hold if mutating the store.
///
/// If the store will not be written to following the read, the lock can be dropped.
pub async fn read<P: AsRef<Path>>(path: P) -> Result<(Self, LockedFile), TomlCredentialError> {
pub(crate) async fn read<P: AsRef<Path>>(
path: P,
) -> Result<(Self, LockedFile), TomlCredentialError> {
let lock = Self::lock(path.as_ref()).await?;
let store = Self::from_file(path)?;
Ok((store, lock))
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-bin-install/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Binary {
/// The name of the binary.
///
/// See [`Binary::executable`] for the platform-specific executable name.
pub fn name(&self) -> &'static str {
pub(crate) fn name(self) -> &'static str {
match self {
Self::Ruff => "ruff",
Self::Uv => "uv",
Expand Down Expand Up @@ -167,7 +167,7 @@ impl Binary {
}

/// Get the executable name
pub fn executable(&self) -> String {
pub(crate) fn executable(self) -> String {
format!("{}{}", self.name(), std::env::consts::EXE_SUFFIX)
}
}
Expand Down
3 changes: 2 additions & 1 deletion crates/uv-build-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ mod settings;
mod source_dist;
mod wheel;

pub use metadata::{PyProjectToml, check_direct_build};
pub(crate) use metadata::PyProjectToml;
pub use metadata::check_direct_build;
pub use settings::{BuildBackendSettings, WheelDataIncludes};
pub use source_dist::{build_source_dist, list_source_dist};
use uv_warnings::warn_user_once;
Expand Down
18 changes: 9 additions & 9 deletions crates/uv-build-backend/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct BuildBackendSettings {
value_type = "str",
example = r#"module-root = """#
)]
pub module_root: PathBuf,
pub(crate) module_root: PathBuf,

/// The name of the module directory inside `module-root`.
///
Expand All @@ -46,7 +46,7 @@ pub struct BuildBackendSettings {
value_type = "str | list[str]",
example = r#"module-name = "sklearn""#
)]
pub module_name: Option<ModuleName>,
pub(crate) module_name: Option<ModuleName>,

/// Glob expressions which files and directories to additionally include in the source
/// distribution.
Expand All @@ -57,7 +57,7 @@ pub struct BuildBackendSettings {
value_type = "list[str]",
example = r#"source-include = ["tests/**"]"#
)]
pub source_include: Vec<String>,
pub(crate) source_include: Vec<String>,

/// If set to `false`, the default excludes aren't applied.
///
Expand All @@ -67,7 +67,7 @@ pub struct BuildBackendSettings {
value_type = "bool",
example = r#"default-excludes = false"#
)]
pub default_excludes: bool,
pub(crate) default_excludes: bool,

/// Glob expressions which files and directories to exclude from the source distribution.
///
Expand All @@ -78,15 +78,15 @@ pub struct BuildBackendSettings {
value_type = "list[str]",
example = r#"source-exclude = ["*.bin"]"#
)]
pub source_exclude: Vec<String>,
pub(crate) source_exclude: Vec<String>,

/// Glob expressions which files and directories to exclude from the wheel.
#[option(
default = r#"[]"#,
value_type = "list[str]",
example = r#"wheel-exclude = ["*.bin"]"#
)]
pub wheel_exclude: Vec<String>,
pub(crate) wheel_exclude: Vec<String>,

/// Build a namespace package.
///
Expand Down Expand Up @@ -136,7 +136,7 @@ pub struct BuildBackendSettings {
value_type = "bool",
example = r#"namespace = true"#
)]
pub namespace: bool,
pub(crate) namespace: bool,

/// Data includes for wheels.
///
Expand Down Expand Up @@ -170,7 +170,7 @@ pub struct BuildBackendSettings {
value_type = "dict[str, str]",
example = r#"data = { headers = "include/headers", scripts = "bin" }"#
)]
pub data: WheelDataIncludes,
pub(crate) data: WheelDataIncludes,
}

impl Default for BuildBackendSettings {
Expand Down Expand Up @@ -216,7 +216,7 @@ pub struct WheelDataIncludes {

impl WheelDataIncludes {
/// Yield all data directories name and corresponding paths.
pub fn iter(&self) -> impl Iterator<Item = (&'static str, &Path)> {
pub(crate) fn iter(&self) -> impl Iterator<Item = (&'static str, &Path)> {
[
("purelib", self.purelib.as_deref()),
("platlib", self.platlib.as_deref()),
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-build-frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ impl SourceBuild {

/// Try calling `prepare_metadata_for_build_wheel` to get the metadata without executing the
/// actual build.
pub async fn get_metadata_without_build(&mut self) -> Result<Option<PathBuf>, Error> {
pub(crate) async fn get_metadata_without_build(&mut self) -> Result<Option<PathBuf>, Error> {
// We've already called this method; return the existing result.
if let Some(metadata_dir) = &self.metadata_directory {
return Ok(Some(metadata_dir.clone()));
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-cache/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Default for ArchiveId {

impl ArchiveId {
/// Generate a new unique identifier for an archive.
pub fn new() -> Self {
pub(crate) fn new() -> Self {
Self(uv_fastid::Id::insecure().to_string())
}
}
Expand Down
21 changes: 1 addition & 20 deletions crates/uv-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,6 @@ impl Cache {
&self.root
}

/// Return the [`Refresh`] policy for the cache.
pub fn refresh(&self) -> &Refresh {
&self.refresh
}

/// The folder for a specific cache bucket
pub fn bucket(&self, cache_bucket: CacheBucket) -> PathBuf {
self.root.join(cache_bucket.to_str())
Expand Down Expand Up @@ -1321,7 +1316,7 @@ impl CacheBucket {
}

/// Return an iterator over all cache buckets.
pub fn iter() -> impl Iterator<Item = Self> {
pub(crate) fn iter() -> impl Iterator<Item = Self> {
[
Self::Wheels,
Self::SourceDistributions,
Expand Down Expand Up @@ -1390,20 +1385,6 @@ impl Refresh {
}
}

/// Return the [`Timestamp`] associated with the refresh policy.
pub fn timestamp(&self) -> Timestamp {
match self {
Self::None(timestamp) => *timestamp,
Self::Packages(.., timestamp) => *timestamp,
Self::All(timestamp) => *timestamp,
}
}

/// Returns `true` if no packages should be reinstalled.
pub fn is_none(&self) -> bool {
matches!(self, Self::None(_))
}

/// Combine two [`Refresh`] policies, taking the "max" of the two policies.
#[must_use]
pub fn combine(self, other: Self) -> Self {
Expand Down
Loading
Loading