Skip to content

Commit

Permalink
Make pubgrub an allowed ident (#3399)
Browse files Browse the repository at this point in the history
Followup to #3361, fix some backtick-quoting.
  • Loading branch information
konstin committed May 6, 2024
1 parent 1efaf3f commit 9de49c8
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
3 changes: 2 additions & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
doc-valid-idents = [
"PyPI",
"PubGrub",
".." # Include the defaults
]

Expand Down Expand Up @@ -29,4 +30,4 @@ disallowed-methods = [
"std::fs::soft_link",
"std::fs::symlink_metadata",
"std::fs::write",
]
]
4 changes: 2 additions & 2 deletions crates/uv-resolver/src/pubgrub/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::ResolveError;
pub struct PubGrubDependencies(Vec<(PubGrubPackage, Range<Version>)>);

impl PubGrubDependencies {
/// Generate a set of `PubGrub` dependencies from a set of requirements.
/// Generate a set of PubGrub dependencies from a set of requirements.
#[allow(clippy::too_many_arguments)]
pub(crate) fn from_requirements(
requirements: &[Requirement],
Expand Down Expand Up @@ -178,7 +178,7 @@ impl From<PubGrubDependencies> for Vec<(PubGrubPackage, Range<Version>)> {
}
}

/// Convert a [`Requirement`] to a `PubGrub`-compatible package and range.
/// Convert a [`Requirement`] to a PubGrub-compatible package and range.
fn to_pubgrub(
requirement: &Requirement,
extra: Option<ExtraName>,
Expand Down
8 changes: 4 additions & 4 deletions crates/uv-resolver/src/pubgrub/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::resolver::Urls;

/// A PubGrub-compatible wrapper around a "Python package", with two notable characteristics:
///
/// 1. Includes a [`PubGrubPackage::Root`] variant, to satisfy `PubGrub`'s requirement that a
/// 1. Includes a [`PubGrubPackage::Root`] variant, to satisfy PubGrub's requirement that a
/// resolution starts from a single root.
/// 2. Uses the same strategy as pip and posy to handle extras: for each extra, we create a virtual
/// package (e.g., `black[colorama]`), and mark it as a dependency of the real package (e.g.,
Expand All @@ -26,7 +26,7 @@ pub enum PubGrubPackage {
/// The URL of the package, if it was specified in the requirement.
///
/// There are a few challenges that come with URL-based packages, and how they map to
/// `PubGrub`.
/// PubGrub.
///
/// If the user declares a direct URL dependency, and then a transitive dependency
/// appears for the same package, we need to ensure that the direct URL dependency can
Expand Down Expand Up @@ -70,9 +70,9 @@ pub enum PubGrubPackage {
///
/// The benefit of the proxy package (versus `PubGrubPackage::Package("black", Some("colorama")`
/// on its own) is that it enables us to avoid attempting to retrieve metadata for irrelevant
/// versions the extra variants by making it clear to `PubGrub` that the extra variant must match
/// versions the extra variants by making it clear to PubGrub that the extra variant must match
/// the exact same version of the base variant. Without the proxy package, then when provided
/// requirements like `black==23.0.1` and `black[colorama]`, `PubGrub` may attempt to retrieve
/// requirements like `black==23.0.1` and `black[colorama]`, PubGrub may attempt to retrieve
/// metadata for `black[colorama]` versions other than `23.0.1`.
Extra(PackageName, ExtraName, Option<VerbatimUrl>),
}
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-resolver/src/pubgrub/priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use uv_normalize::PackageName;

use crate::pubgrub::package::PubGrubPackage;

/// A prioritization map to guide the `PubGrub` resolution process.
/// A prioritization map to guide the PubGrub resolution process.
///
/// During resolution, `PubGrub` needs to decide which package to consider next. The priorities
/// During resolution, PubGrub needs to decide which package to consider next. The priorities
/// encoded here are used to guide that decision.
///
/// Like `pip`, we prefer packages that are pinned to direct URLs over packages pinned to a single
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-resolver/src/pubgrub/specifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::ResolveError;
pub(crate) struct PubGrubSpecifier(Range<Version>);

impl From<PubGrubSpecifier> for Range<Version> {
/// Convert a `PubGrub` specifier to a range of versions.
/// Convert a PubGrub specifier to a range of versions.
fn from(specifier: PubGrubSpecifier) -> Self {
specifier.0
}
Expand All @@ -19,7 +19,7 @@ impl From<PubGrubSpecifier> for Range<Version> {
impl TryFrom<&VersionSpecifier> for PubGrubSpecifier {
type Error = ResolveError;

/// Convert a PEP 508 specifier to a `PubGrub`-compatible version range.
/// Convert a PEP 508 specifier to a PubGrub-compatible version range.
fn try_from(specifier: &VersionSpecifier) -> Result<Self, ResolveError> {
let ranges = match specifier.operator() {
Operator::Equal => {
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-resolver/src/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct ResolutionGraph {
}

impl ResolutionGraph {
/// Create a new graph from the resolved `PubGrub` state.
/// Create a new graph from the resolved PubGrub state.
#[allow(clippy::too_many_arguments)]
pub(crate) fn from_state(
selection: &SelectedDependencies<UvDependencyProvider>,
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-resolver/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl<
}
}

/// Run the `PubGrub` solver.
/// Run the PubGrub solver.
#[instrument(skip_all)]
async fn solve(
&self,
Expand Down
11 changes: 6 additions & 5 deletions crates/uv/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ use std::path::Path;

/// Shells for which virtualenv activation scripts are available.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[allow(clippy::doc_markdown)]
pub(crate) enum Shell {
/// Bourne Again `SHell` (bash)
/// Bourne Again SHell (bash)
Bash,
/// Friendly Interactive `SHell` (fish)
/// Friendly Interactive SHell (fish)
Fish,
/// `PowerShell`
/// PowerShell
Powershell,
/// Cmd (Command Prompt)
Cmd,
/// Z `SHell` (zsh)
/// Z SHell (zsh)
Zsh,
/// Nushell
Nushell,
/// C `SHell` (csh)
/// C SHell (csh)
Csh,
}

Expand Down

0 comments on commit 9de49c8

Please sign in to comment.