mirror of
				https://github.com/astral-sh/uv.git
				synced 2025-11-04 05:34:28 +00:00 
			
		
		
		
	Fix non-optional uv-pep440 features (#8693)
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				CI / Determine changes (push) Waiting to run
				
			
		
			
				
	
				CI / lint (push) Waiting to run
				
			
		
			
				
	
				CI / cargo clippy | ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / cargo clippy | windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / cargo dev generate-all (push) Blocked by required conditions
				
			
		
			
				
	
				CI / cargo shear (push) Waiting to run
				
			
		
			
				
	
				CI / cargo test | ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / cargo test | macos (push) Blocked by required conditions
				
			
		
			
				
	
				CI / test windows trampoline | x86_64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / cargo test | windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check windows trampoline | aarch64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check windows trampoline | i686 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check windows trampoline | x86_64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / test windows trampoline | i686 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / typos (push) Waiting to run
				
			
		
			
				
	
				CI / mkdocs (push) Waiting to run
				
			
		
			
				
	
				CI / build binary | linux (push) Blocked by required conditions
				
			
		
			
				
	
				CI / build binary | macos aarch64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / build binary | macos x86_64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / build binary | windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / build binary | freebsd (push) Blocked by required conditions
				
			
		
			
				
	
				CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
				
			
		
			
				
	
				CI / ecosystem test | pallets/flask (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | conda on ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | free-threaded on linux (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | free-threaded on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | pypy on ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | pypy on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | graalpy on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | github actions (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | determine publish changes (push) Blocked by required conditions
				
			
		
			
				
	
				CI / integration test | uv publish (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check cache | ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check cache | macos aarch64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on debian (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on fedora (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on opensuse (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on rocky linux 8 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on rocky linux 9 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | pypy on ubuntu (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | pyston (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | alpine (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on macos aarch64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python on macos x86_64 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python3.10 on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python3.13 on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python3.9 via pyenv (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | python3.13 (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | conda3.11 on linux (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | conda3.8 on linux (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | conda3.11 on macos (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | conda3.8 on macos (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | conda3.11 on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | conda3.8 on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | amazonlinux (push) Blocked by required conditions
				
			
		
			
				
	
				CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
				
			
		
			
				
	
				CI / benchmarks (push) Blocked by required conditions
				
			
		
		
	
	
				
					
				
			
		
			Some checks are pending
		
		
	
	CI / Determine changes (push) Waiting to run
				
			CI / lint (push) Waiting to run
				
			CI / cargo clippy | ubuntu (push) Blocked by required conditions
				
			CI / cargo clippy | windows (push) Blocked by required conditions
				
			CI / cargo dev generate-all (push) Blocked by required conditions
				
			CI / cargo shear (push) Waiting to run
				
			CI / cargo test | ubuntu (push) Blocked by required conditions
				
			CI / cargo test | macos (push) Blocked by required conditions
				
			CI / test windows trampoline | x86_64 (push) Blocked by required conditions
				
			CI / cargo test | windows (push) Blocked by required conditions
				
			CI / check windows trampoline | aarch64 (push) Blocked by required conditions
				
			CI / check windows trampoline | i686 (push) Blocked by required conditions
				
			CI / check windows trampoline | x86_64 (push) Blocked by required conditions
				
			CI / test windows trampoline | i686 (push) Blocked by required conditions
				
			CI / typos (push) Waiting to run
				
			CI / mkdocs (push) Waiting to run
				
			CI / build binary | linux (push) Blocked by required conditions
				
			CI / build binary | macos aarch64 (push) Blocked by required conditions
				
			CI / build binary | macos x86_64 (push) Blocked by required conditions
				
			CI / build binary | windows (push) Blocked by required conditions
				
			CI / build binary | freebsd (push) Blocked by required conditions
				
			CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
				
			CI / ecosystem test | pallets/flask (push) Blocked by required conditions
				
			CI / integration test | conda on ubuntu (push) Blocked by required conditions
				
			CI / integration test | free-threaded on linux (push) Blocked by required conditions
				
			CI / integration test | free-threaded on windows (push) Blocked by required conditions
				
			CI / integration test | pypy on ubuntu (push) Blocked by required conditions
				
			CI / integration test | pypy on windows (push) Blocked by required conditions
				
			CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
				
			CI / integration test | graalpy on windows (push) Blocked by required conditions
				
			CI / integration test | github actions (push) Blocked by required conditions
				
			CI / integration test | determine publish changes (push) Blocked by required conditions
				
			CI / integration test | uv publish (push) Blocked by required conditions
				
			CI / check cache | ubuntu (push) Blocked by required conditions
				
			CI / check cache | macos aarch64 (push) Blocked by required conditions
				
			CI / check system | python on debian (push) Blocked by required conditions
				
			CI / check system | python on fedora (push) Blocked by required conditions
				
			CI / check system | python on ubuntu (push) Blocked by required conditions
				
			CI / check system | python on opensuse (push) Blocked by required conditions
				
			CI / check system | python on rocky linux 8 (push) Blocked by required conditions
				
			CI / check system | python on rocky linux 9 (push) Blocked by required conditions
				
			CI / check system | pypy on ubuntu (push) Blocked by required conditions
				
			CI / check system | pyston (push) Blocked by required conditions
				
			CI / check system | alpine (push) Blocked by required conditions
				
			CI / check system | python on macos aarch64 (push) Blocked by required conditions
				
			CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
				
			CI / check system | python on macos x86_64 (push) Blocked by required conditions
				
			CI / check system | python3.10 on windows (push) Blocked by required conditions
				
			CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
				
			CI / check system | python3.13 on windows (push) Blocked by required conditions
				
			CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
				
			CI / check system | python3.9 via pyenv (push) Blocked by required conditions
				
			CI / check system | python3.13 (push) Blocked by required conditions
				
			CI / check system | conda3.11 on linux (push) Blocked by required conditions
				
			CI / check system | conda3.8 on linux (push) Blocked by required conditions
				
			CI / check system | conda3.11 on macos (push) Blocked by required conditions
				
			CI / check system | conda3.8 on macos (push) Blocked by required conditions
				
			CI / check system | conda3.11 on windows (push) Blocked by required conditions
				
			CI / check system | conda3.8 on windows (push) Blocked by required conditions
				
			CI / check system | amazonlinux (push) Blocked by required conditions
				
			CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
				
			CI / benchmarks (push) Blocked by required conditions
				
			This commit is contained in:
		
							parent
							
								
									2b0e16cb75
								
							
						
					
					
						commit
						4bf01ed337
					
				
					 3 changed files with 15 additions and 25 deletions
				
			
		| 
						 | 
				
			
			@ -6,6 +6,7 @@ use crate::{
 | 
			
		|||
    version, Operator, OperatorParseError, Version, VersionPattern, VersionPatternParseError,
 | 
			
		||||
};
 | 
			
		||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
 | 
			
		||||
#[cfg(feature = "tracing")]
 | 
			
		||||
use tracing::warn;
 | 
			
		||||
 | 
			
		||||
/// Sorted version specifiers, such as `>=2.1,<3`.
 | 
			
		||||
| 
						 | 
				
			
			@ -23,19 +24,12 @@ use tracing::warn;
 | 
			
		|||
/// // VersionSpecifiers derefs into a list of specifiers
 | 
			
		||||
/// assert_eq!(version_specifiers.iter().position(|specifier| *specifier.operator() == Operator::LessThan), Some(1));
 | 
			
		||||
/// ```
 | 
			
		||||
#[derive(
 | 
			
		||||
    Eq,
 | 
			
		||||
    PartialEq,
 | 
			
		||||
    Ord,
 | 
			
		||||
    PartialOrd,
 | 
			
		||||
    Debug,
 | 
			
		||||
    Clone,
 | 
			
		||||
    Hash,
 | 
			
		||||
    rkyv::Archive,
 | 
			
		||||
    rkyv::Deserialize,
 | 
			
		||||
    rkyv::Serialize,
 | 
			
		||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)]
 | 
			
		||||
#[cfg_attr(
 | 
			
		||||
    feature = "rkyv",
 | 
			
		||||
    derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
 | 
			
		||||
)]
 | 
			
		||||
#[rkyv(derive(Debug))]
 | 
			
		||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug)))]
 | 
			
		||||
pub struct VersionSpecifiers(Vec<VersionSpecifier>);
 | 
			
		||||
 | 
			
		||||
impl std::ops::Deref for VersionSpecifiers {
 | 
			
		||||
| 
						 | 
				
			
			@ -97,6 +91,7 @@ impl VersionSpecifiers {
 | 
			
		|||
                    specifiers.push(VersionSpecifier::not_equals_star_version(prev.clone()));
 | 
			
		||||
                }
 | 
			
		||||
                _ => {
 | 
			
		||||
                    #[cfg(feature = "tracing")]
 | 
			
		||||
                    warn!("Ignoring unsupported gap in `requires-python` version: {next:?} -> {lower:?}");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -239,19 +234,12 @@ impl std::error::Error for VersionSpecifiersParseError {}
 | 
			
		|||
/// let version_specifier = VersionSpecifier::from_str("== 1.*").unwrap();
 | 
			
		||||
/// assert!(version_specifier.contains(&version));
 | 
			
		||||
/// ```
 | 
			
		||||
#[derive(
 | 
			
		||||
    Eq,
 | 
			
		||||
    Ord,
 | 
			
		||||
    PartialEq,
 | 
			
		||||
    PartialOrd,
 | 
			
		||||
    Debug,
 | 
			
		||||
    Clone,
 | 
			
		||||
    Hash,
 | 
			
		||||
    rkyv::Archive,
 | 
			
		||||
    rkyv::Deserialize,
 | 
			
		||||
    rkyv::Serialize,
 | 
			
		||||
#[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Clone, Hash)]
 | 
			
		||||
#[cfg_attr(
 | 
			
		||||
    feature = "rkyv",
 | 
			
		||||
    derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
 | 
			
		||||
)]
 | 
			
		||||
#[rkyv(derive(Debug))]
 | 
			
		||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug)))]
 | 
			
		||||
pub struct VersionSpecifier {
 | 
			
		||||
    /// ~=|==|!=|<=|>=|<|>|===, plus whether the version ended with a star
 | 
			
		||||
    pub(crate) operator: Operator,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,6 @@ regex = { workspace = true }
 | 
			
		|||
rustc-hash = { workspace = true }
 | 
			
		||||
schemars = { workspace = true, optional = true }
 | 
			
		||||
serde = { workspace = true, features = ["derive", "rc"] }
 | 
			
		||||
serde_json = { workspace = true, optional = true }
 | 
			
		||||
smallvec = { workspace = true }
 | 
			
		||||
thiserror = { workspace = true }
 | 
			
		||||
tracing = { workspace = true, optional = true }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,6 +38,9 @@ pub use origin::RequirementOrigin;
 | 
			
		|||
#[cfg(feature = "non-pep508-extensions")]
 | 
			
		||||
pub use unnamed::{UnnamedRequirement, UnnamedRequirementUrl};
 | 
			
		||||
pub use uv_normalize::{ExtraName, InvalidNameError, PackageName};
 | 
			
		||||
/// Version and version specifiers used in requirements (reexport).
 | 
			
		||||
// https://github.com/konstin/pep508_rs/issues/19
 | 
			
		||||
pub use uv_pep440;
 | 
			
		||||
use uv_pep440::{Version, VersionSpecifier, VersionSpecifiers};
 | 
			
		||||
pub use verbatim_url::{
 | 
			
		||||
    expand_env_vars, split_scheme, strip_host, Scheme, VerbatimUrl, VerbatimUrlError,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue