Make pubgrub an allowed ident (#3399)

Followup to #3361, fix some backtick-quoting.
This commit is contained in:
konsti 2024-05-06 11:10:37 +02:00 committed by GitHub
parent 1efaf3fd31
commit 9de49c8a60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 20 additions and 18 deletions

View file

@ -1,5 +1,6 @@
doc-valid-idents = [ doc-valid-idents = [
"PyPI", "PyPI",
"PubGrub",
".." # Include the defaults ".." # Include the defaults
] ]
@ -29,4 +30,4 @@ disallowed-methods = [
"std::fs::soft_link", "std::fs::soft_link",
"std::fs::symlink_metadata", "std::fs::symlink_metadata",
"std::fs::write", "std::fs::write",
] ]

View file

@ -18,7 +18,7 @@ use crate::ResolveError;
pub struct PubGrubDependencies(Vec<(PubGrubPackage, Range<Version>)>); pub struct PubGrubDependencies(Vec<(PubGrubPackage, Range<Version>)>);
impl PubGrubDependencies { 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)] #[allow(clippy::too_many_arguments)]
pub(crate) fn from_requirements( pub(crate) fn from_requirements(
requirements: &[Requirement], requirements: &[Requirement],
@ -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( fn to_pubgrub(
requirement: &Requirement, requirement: &Requirement,
extra: Option<ExtraName>, extra: Option<ExtraName>,

View file

@ -7,7 +7,7 @@ use crate::resolver::Urls;
/// A PubGrub-compatible wrapper around a "Python package", with two notable characteristics: /// 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. /// 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 /// 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., /// package (e.g., `black[colorama]`), and mark it as a dependency of the real package (e.g.,
@ -26,7 +26,7 @@ pub enum PubGrubPackage {
/// The URL of the package, if it was specified in the requirement. /// 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 /// 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 /// 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 /// appears for the same package, we need to ensure that the direct URL dependency can
@ -70,9 +70,9 @@ pub enum PubGrubPackage {
/// ///
/// The benefit of the proxy package (versus `PubGrubPackage::Package("black", Some("colorama")` /// 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 /// 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 /// 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`. /// metadata for `black[colorama]` versions other than `23.0.1`.
Extra(PackageName, ExtraName, Option<VerbatimUrl>), Extra(PackageName, ExtraName, Option<VerbatimUrl>),
} }

View file

@ -8,9 +8,9 @@ use uv_normalize::PackageName;
use crate::pubgrub::package::PubGrubPackage; 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. /// 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 /// Like `pip`, we prefer packages that are pinned to direct URLs over packages pinned to a single

View file

@ -10,7 +10,7 @@ use crate::ResolveError;
pub(crate) struct PubGrubSpecifier(Range<Version>); pub(crate) struct PubGrubSpecifier(Range<Version>);
impl From<PubGrubSpecifier> for 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 { fn from(specifier: PubGrubSpecifier) -> Self {
specifier.0 specifier.0
} }
@ -19,7 +19,7 @@ impl From<PubGrubSpecifier> for Range<Version> {
impl TryFrom<&VersionSpecifier> for PubGrubSpecifier { impl TryFrom<&VersionSpecifier> for PubGrubSpecifier {
type Error = ResolveError; 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> { fn try_from(specifier: &VersionSpecifier) -> Result<Self, ResolveError> {
let ranges = match specifier.operator() { let ranges = match specifier.operator() {
Operator::Equal => { Operator::Equal => {

View file

@ -64,7 +64,7 @@ pub struct ResolutionGraph {
} }
impl 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)] #[allow(clippy::too_many_arguments)]
pub(crate) fn from_state( pub(crate) fn from_state(
selection: &SelectedDependencies<UvDependencyProvider>, selection: &SelectedDependencies<UvDependencyProvider>,

View file

@ -281,7 +281,7 @@ impl<
} }
} }
/// Run the `PubGrub` solver. /// Run the PubGrub solver.
#[instrument(skip_all)] #[instrument(skip_all)]
async fn solve( async fn solve(
&self, &self,

View file

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