Support constraints in requirements.in files (#212)

Closes #172.
This commit is contained in:
Charlie Marsh 2023-10-26 17:41:02 -07:00 committed by GitHub
parent 58011f98b6
commit 8b83385763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 476 additions and 89 deletions

View file

@ -1,6 +1,6 @@
pub use error::ResolveError;
pub use resolution::{Graph, PinnedPackage};
pub use resolver::{Manifest, Resolver};
pub use resolver::{ResolutionManifest, Resolver};
pub use selector::ResolutionMode;
pub use source_distribution::BuiltSourceDistributionCache;
pub use wheel_finder::{Reporter, WheelFinder};

View file

@ -41,14 +41,14 @@ use crate::BuiltSourceDistributionCache;
/// A manifest of requirements, constraints, and preferences.
#[derive(Debug)]
pub struct Manifest {
pub struct ResolutionManifest {
requirements: Vec<Requirement>,
constraints: Vec<Requirement>,
preferences: Vec<Requirement>,
mode: ResolutionMode,
}
impl Manifest {
impl ResolutionManifest {
pub fn new(
requirements: Vec<Requirement>,
constraints: Vec<Requirement>,
@ -78,7 +78,7 @@ pub struct Resolver<'a, Context: BuildContext + Sync> {
impl<'a, Context: BuildContext + Sync> Resolver<'a, Context> {
/// Initialize a new resolver.
pub fn new(
manifest: Manifest,
manifest: ResolutionManifest,
markers: &'a MarkerEnvironment,
tags: &'a Tags,
client: &'a RegistryClient,

View file

@ -16,7 +16,7 @@ use platform_host::{Arch, Os, Platform};
use platform_tags::Tags;
use puffin_client::RegistryClientBuilder;
use puffin_interpreter::{InterpreterInfo, Virtualenv};
use puffin_resolver::{Manifest, ResolutionMode, Resolver};
use puffin_resolver::{ResolutionManifest, ResolutionMode, Resolver};
use puffin_traits::BuildContext;
struct DummyContext;
@ -64,7 +64,7 @@ async fn pylint() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("pylint==2.3.0").unwrap()],
vec![],
vec![],
@ -85,7 +85,7 @@ async fn black() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![],
vec![],
@ -106,7 +106,7 @@ async fn black_colorama() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black[colorama]<=23.9.1").unwrap()],
vec![],
vec![],
@ -127,7 +127,7 @@ async fn black_python_310() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![],
vec![],
@ -150,7 +150,7 @@ async fn black_mypy_extensions() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![Requirement::from_str("mypy-extensions<1").unwrap()],
vec![],
@ -173,7 +173,7 @@ async fn black_mypy_extensions_extra() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![Requirement::from_str("mypy-extensions[extra]<1").unwrap()],
vec![],
@ -196,7 +196,7 @@ async fn black_flake8() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![Requirement::from_str("flake8<1").unwrap()],
vec![],
@ -217,7 +217,7 @@ async fn black_lowest() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black>21").unwrap()],
vec![],
vec![],
@ -238,7 +238,7 @@ async fn black_lowest_direct() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black>21").unwrap()],
vec![],
vec![],
@ -259,7 +259,7 @@ async fn black_respect_preference() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![],
vec![Requirement::from_str("black==23.9.0").unwrap()],
@ -280,7 +280,7 @@ async fn black_ignore_preference() -> Result<()> {
let client = RegistryClientBuilder::default().build();
let manifest = Manifest::new(
let manifest = ResolutionManifest::new(
vec![Requirement::from_str("black<=23.9.1").unwrap()],
vec![],
vec![Requirement::from_str("black==23.9.2").unwrap()],