mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Make pubgrub an allowed ident (#3399)
Followup to #3361, fix some backtick-quoting.
This commit is contained in:
parent
1efaf3fd31
commit
9de49c8a60
8 changed files with 20 additions and 18 deletions
|
@ -1,5 +1,6 @@
|
|||
doc-valid-idents = [
|
||||
"PyPI",
|
||||
"PubGrub",
|
||||
".." # Include the defaults
|
||||
]
|
||||
|
||||
|
@ -29,4 +30,4 @@ disallowed-methods = [
|
|||
"std::fs::soft_link",
|
||||
"std::fs::symlink_metadata",
|
||||
"std::fs::write",
|
||||
]
|
||||
]
|
||||
|
|
|
@ -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],
|
||||
|
@ -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>,
|
||||
|
|
|
@ -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.,
|
||||
|
@ -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
|
||||
|
@ -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>),
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -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 => {
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -281,7 +281,7 @@ impl<
|
|||
}
|
||||
}
|
||||
|
||||
/// Run the `PubGrub` solver.
|
||||
/// Run the PubGrub solver.
|
||||
#[instrument(skip_all)]
|
||||
async fn solve(
|
||||
&self,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue