mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-26 12:09:12 +00:00
Split puffin-package
into requirements.txt parser and pypi-types
(#341)
There are only two things left in this crate and they don't really have anything to do with one another.
This commit is contained in:
parent
1f447892f3
commit
24e30e6557
60 changed files with 135 additions and 97 deletions
|
@ -27,7 +27,8 @@ puffin-distribution = { path = "../puffin-distribution" }
|
|||
puffin-installer = { path = "../puffin-installer" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
requirements-txt = { path = "../requirements-txt" }
|
||||
puffin-resolver = { path = "../puffin-resolver", features = ["clap"] }
|
||||
puffin-workspace = { path = "../puffin-workspace" }
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use fs_err as fs;
|
|||
|
||||
use pep508_rs::Requirement;
|
||||
use puffin_normalize::{ExtraName, PackageName};
|
||||
use puffin_package::requirements_txt::RequirementsTxt;
|
||||
use requirements_txt::RequirementsTxt;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum RequirementsSource {
|
||||
|
|
|
@ -8,7 +8,7 @@ distribution-filename = { path = "../distribution-filename" }
|
|||
install-wheel-rs = { path = "../install-wheel-rs" }
|
||||
puffin-cache = { path = "../puffin-cache" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
|
||||
async_http_range_reader = { workspace = true }
|
||||
async_zip = { workspace = true }
|
||||
|
|
|
@ -21,7 +21,7 @@ use url::Url;
|
|||
use distribution_filename::WheelFilename;
|
||||
use install_wheel_rs::find_dist_info_metadata;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_package::pypi_types::{File, Metadata21, SimpleJson};
|
||||
use pypi_types::{File, Metadata21, SimpleJson};
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::remote_metadata::{
|
||||
|
|
|
@ -5,7 +5,6 @@ use async_zip::error::ZipError;
|
|||
use thiserror::Error;
|
||||
|
||||
use distribution_filename::WheelFilename;
|
||||
use puffin_package::pypi_types;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
|
|
|
@ -10,7 +10,7 @@ use url::Url;
|
|||
use distribution_filename::WheelFilename;
|
||||
use install_wheel_rs::find_dist_info_metadata;
|
||||
use puffin_cache::CanonicalUrl;
|
||||
use puffin_package::pypi_types::Metadata21;
|
||||
use pypi_types::Metadata21;
|
||||
|
||||
use crate::Error;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ puffin-build = { path = "../puffin-build" }
|
|||
puffin-client = { path = "../puffin-client" }
|
||||
puffin-dispatch = { path = "../puffin-dispatch" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
puffin-traits = { path = "../puffin-traits" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
|
|
|
@ -20,9 +20,9 @@ puffin-client = { path = "../puffin-client" }
|
|||
puffin-distribution = { path = "../puffin-distribution" }
|
||||
puffin-installer = { path = "../puffin-installer" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
puffin-resolver = { path = "../puffin-resolver" }
|
||||
puffin-traits = { path = "../puffin-traits" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
|
|
|
@ -14,7 +14,7 @@ pep440_rs = { path = "../pep440-rs" }
|
|||
puffin-cache = { path = "../puffin-cache" }
|
||||
puffin-git = { path = "../puffin-git" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
|
|
@ -8,7 +8,7 @@ use url::Url;
|
|||
use pep440_rs::Version;
|
||||
use puffin_cache::CanonicalUrl;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_package::pypi_types::File;
|
||||
use pypi_types::File;
|
||||
|
||||
pub mod source;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ authors = { workspace = true }
|
|||
license = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
install-wheel-rs = { path = "../install-wheel-rs", default-features = false }
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
|
@ -19,9 +20,8 @@ puffin-distribution = { path = "../puffin-distribution" }
|
|||
puffin-git = { path = "../puffin-git" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
puffin-traits = { path = "../puffin-traits" }
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
cacache = { workspace = true }
|
||||
|
|
|
@ -5,14 +5,6 @@ edition = "2021"
|
|||
description = "Normalization for distribution, package and extra anmes"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
indoc = { version = "2.0.4" }
|
||||
insta = { version = "1.34.0" }
|
||||
serde_json = { version = "1.0.108" }
|
||||
tempfile = { version = "3.8.1" }
|
||||
test-case = { version = "3.2.1" }
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
pub mod pypi_types;
|
||||
pub mod requirements_txt;
|
|
@ -10,6 +10,7 @@ authors = { workspace = true }
|
|||
license = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
install-wheel-rs = { path = "../install-wheel-rs" }
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
|
@ -19,11 +20,10 @@ pubgrub = { path = "../../vendor/pubgrub" }
|
|||
puffin-cache = { path = "../puffin-cache" }
|
||||
puffin-client = { path = "../puffin-client" }
|
||||
puffin-distribution = { path = "../puffin-distribution" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-package = { path = "../puffin-package" }
|
||||
puffin-traits = { path = "../puffin-traits" }
|
||||
puffin-git = { path = "../puffin-git" }
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-traits = { path = "../puffin-traits" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
bitflags = { workspace = true }
|
||||
|
|
|
@ -7,7 +7,7 @@ use zip::ZipArchive;
|
|||
use distribution_filename::WheelFilename;
|
||||
use platform_tags::Tags;
|
||||
use puffin_distribution::RemoteDistributionRef;
|
||||
use puffin_package::pypi_types::Metadata21;
|
||||
use pypi_types::Metadata21;
|
||||
|
||||
/// A cached wheel built from a remote source.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -17,8 +17,8 @@ use puffin_client::RegistryClient;
|
|||
use puffin_distribution::source::Source;
|
||||
use puffin_distribution::RemoteDistributionRef;
|
||||
use puffin_git::{Git, GitSource};
|
||||
use puffin_package::pypi_types::Metadata21;
|
||||
use puffin_traits::BuildContext;
|
||||
use pypi_types::Metadata21;
|
||||
|
||||
use crate::distribution::cached_wheel::CachedWheel;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use distribution_filename::WheelFilename;
|
|||
use platform_tags::Tags;
|
||||
use puffin_client::RegistryClient;
|
||||
use puffin_distribution::RemoteDistributionRef;
|
||||
use puffin_package::pypi_types::Metadata21;
|
||||
use pypi_types::Metadata21;
|
||||
|
||||
use crate::distribution::cached_wheel::CachedWheel;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use distribution_filename::{SourceDistributionFilename, WheelFilename};
|
||||
use std::ops::Deref;
|
||||
|
||||
use puffin_package::pypi_types::File;
|
||||
use pypi_types::File;
|
||||
|
||||
/// A distribution can either be a wheel or a source distribution.
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -15,7 +15,7 @@ use platform_tags::Tags;
|
|||
use puffin_client::RegistryClient;
|
||||
use puffin_distribution::RemoteDistribution;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_package::pypi_types::{File, SimpleJson};
|
||||
use pypi_types::{File, SimpleJson};
|
||||
|
||||
use crate::error::ResolveError;
|
||||
use crate::resolution::Resolution;
|
||||
|
|
|
@ -13,7 +13,7 @@ use pep440_rs::{Version, VersionSpecifier, VersionSpecifiers};
|
|||
use pep508_rs::{Requirement, VersionOrUrl};
|
||||
use puffin_distribution::RemoteDistribution;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_package::pypi_types::File;
|
||||
use pypi_types::File;
|
||||
|
||||
use crate::pubgrub::{PubGrubPackage, PubGrubPriority, PubGrubVersion};
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ use puffin_cache::{CanonicalUrl, RepositoryUrl};
|
|||
use puffin_client::RegistryClient;
|
||||
use puffin_distribution::{RemoteDistributionRef, VersionOrUrl};
|
||||
use puffin_normalize::{ExtraName, PackageName};
|
||||
use puffin_package::pypi_types::{File, Metadata21, SimpleJson};
|
||||
use puffin_traits::BuildContext;
|
||||
use pypi_types::{File, Metadata21, SimpleJson};
|
||||
|
||||
use crate::candidate_selector::CandidateSelector;
|
||||
use crate::distribution::{SourceDistributionFetcher, WheelFetcher};
|
||||
|
|
30
crates/pypi-types/Cargo.toml
Normal file
30
crates/pypi-types/Cargo.toml
Normal file
|
@ -0,0 +1,30 @@
|
|||
[package]
|
||||
name = "pypi-types"
|
||||
version = "0.0.1"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
documentation = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs", features = ["serde"] }
|
||||
pep508_rs = { path = "../pep508-rs", features = ["serde"] }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
|
||||
mailparse = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
rfc2047-decoder = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
indoc = { version = "2.0.4" }
|
||||
insta = { version = "1.34.0" }
|
||||
serde_json = { version = "1.0.108" }
|
||||
tempfile = { version = "3.8.1" }
|
||||
test-case = { version = "3.2.1" }
|
|
@ -1,25 +1,29 @@
|
|||
[package]
|
||||
name = "puffin-package"
|
||||
name = "requirements-txt"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
documentation = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs", features = ["serde"] }
|
||||
pep508_rs = { path = "../pep508-rs", features = ["serde"] }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
fs-err = { workspace = true }
|
||||
mailparse = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
rfc2047-decoder = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing.workspace = true
|
||||
tracing = { workspace = true }
|
||||
unscanny = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
indoc = { version = "2.0.4" }
|
||||
insta = { version = "1.34.0" }
|
||||
serde_json = { version = "1.0.108" }
|
|
@ -473,7 +473,7 @@ mod test {
|
|||
use tempfile::tempdir;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::requirements_txt::RequirementsTxt;
|
||||
use crate::RequirementsTxt;
|
||||
|
||||
#[test_case(Path::new("basic.txt"))]
|
||||
#[test_case(Path::new("constraints-a.txt"))]
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: crates/puffin-package/src/requirements_txt.rs
|
||||
source: crates/requirements-txt/src/lib.rs
|
||||
expression: actual
|
||||
---
|
||||
RequirementsTxt {
|
Loading…
Add table
Add a link
Reference in a new issue