mirror of https://github.com/astral-sh/uv
require serde and rkyv everywhere; remove optional serde and rkyv features (#3345)
In *some* places in our crates, `serde` (and `rkyv`) are optional
dependencies. I believe this was done out of reasons of "good sense,"
that is, it follows a Rust ecosystem pattern where serde integration
tends to be an opt-in crate feature. (And similarly for `rkyv`.)
However, ultimately, `uv` itself requires `serde` and `rkyv` to
function. Since our crates are strictly internal, there are limited
consumers for our crates without `serde` (and `rkyv`) enabled. I think
one possibility is that optional `serde` (and `rkyv`) integration means
that someone can do this:
cargo test -p pep440_rs
And this will run tests _without_ `serde` or `rkyv` enabled. That in
turn could lead to faster iteration time by reducing compile times. But,
I'm not sure this is worth supporting. The iterative compilation times
of
individual crates are probably fast enough in debug mode, even with
`serde` and `rkyv` enabled. Namely, `serde` and `rkyv` themselves
shouldn't need to be re-compiled in most cases. On `main`:
```
from-scratch: `cargo test -p pep440_rs --lib` 0.685
incremental: `cargo test -p pep440_rs --lib` 0.278s
from-scratch: `cargo test -p pep440_rs --features serde,rkyv --lib` 3.948s
incremental: `cargo test -p pep440_rs --features serde,rkyv --lib` 0.321s
```
So while a from-scratch build does take significantly longer, an
incremental build is about the same.
The benefit of doing this change is two-fold:
1. It brings out crates into alignment with "reality." In particular,
some crates were _implicitly_ relying on `serde` being enabled
without explicitly declaring it. This technically means that our
`Cargo.toml`s were wrong in some cases, but it is hard to observe it
because of feature unification in a Cargo workspace.
2. We no longer need to deal with the cognitive burden of writing
`#[cfg_attr(feature = "serde", ...)]` everywhere.
This commit is contained in:
parent
714adebbd7
commit
1089abda3f
|
|
@ -12,16 +12,13 @@ license = { workspace = true }
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[features]
|
|
||||||
rkyv = ["dep:rkyv", "pep440_rs/rkyv", "uv-normalize/rkyv"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pep440_rs = { workspace = true }
|
pep440_rs = { workspace = true }
|
||||||
platform-tags = { workspace = true }
|
platform-tags = { workspace = true }
|
||||||
uv-normalize = { workspace = true }
|
uv-normalize = { workspace = true }
|
||||||
|
|
||||||
rkyv = { workspace = true, optional = true }
|
rkyv = { workspace = true }
|
||||||
serde = { workspace = true, optional = true }
|
serde = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,25 @@
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use pep440_rs::{Version, VersionParseError};
|
use pep440_rs::{Version, VersionParseError};
|
||||||
use uv_normalize::{InvalidNameError, PackageName};
|
use uv_normalize::{InvalidNameError, PackageName};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
Clone,
|
||||||
#[cfg_attr(
|
Debug,
|
||||||
feature = "rkyv",
|
PartialEq,
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
Eq,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
rkyv::Archive,
|
||||||
|
rkyv::Deserialize,
|
||||||
|
rkyv::Serialize,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
#[archive(check_bytes)]
|
||||||
#[cfg_attr(feature = "rkyv", archive_attr(derive(Debug)))]
|
#[archive_attr(derive(Debug))]
|
||||||
pub enum SourceDistExtension {
|
pub enum SourceDistExtension {
|
||||||
Zip,
|
Zip,
|
||||||
TarGz,
|
TarGz,
|
||||||
|
|
@ -62,14 +66,19 @@ impl SourceDistExtension {
|
||||||
|
|
||||||
/// Note that this is a normalized and not an exact representation, keep the original string if you
|
/// Note that this is a normalized and not an exact representation, keep the original string if you
|
||||||
/// need the latter.
|
/// need the latter.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
Clone,
|
||||||
#[cfg_attr(
|
Debug,
|
||||||
feature = "rkyv",
|
PartialEq,
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
Eq,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
rkyv::Archive,
|
||||||
|
rkyv::Deserialize,
|
||||||
|
rkyv::Serialize,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
#[archive(check_bytes)]
|
||||||
#[cfg_attr(feature = "rkyv", archive_attr(derive(Debug)))]
|
#[archive_attr(derive(Debug))]
|
||||||
pub struct SourceDistFilename {
|
pub struct SourceDistFilename {
|
||||||
pub name: PackageName,
|
pub name: PackageName,
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
@ -10,13 +9,9 @@ use pep440_rs::{Version, VersionParseError};
|
||||||
use platform_tags::{TagCompatibility, Tags};
|
use platform_tags::{TagCompatibility, Tags};
|
||||||
use uv_normalize::{InvalidNameError, PackageName};
|
use uv_normalize::{InvalidNameError, PackageName};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive_attr(derive(Debug)))]
|
|
||||||
pub struct WheelFilename {
|
pub struct WheelFilename {
|
||||||
pub name: PackageName,
|
pub name: PackageName,
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
|
@ -196,7 +191,6 @@ impl TryFrom<&Url> for WheelFilename {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for WheelFilename {
|
impl<'de> Deserialize<'de> for WheelFilename {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -207,7 +201,6 @@ impl<'de> Deserialize<'de> for WheelFilename {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for WheelFilename {
|
impl Serialize for WheelFilename {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cache-key = { workspace = true }
|
cache-key = { workspace = true }
|
||||||
distribution-filename = { workspace = true, features = ["serde"] }
|
distribution-filename = { workspace = true }
|
||||||
pep440_rs = { workspace = true }
|
pep440_rs = { workspace = true }
|
||||||
pep508_rs = { workspace = true }
|
pep508_rs = { workspace = true }
|
||||||
platform-tags = { workspace = true }
|
platform-tags = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ crate-type = ["rlib", "cdylib"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
once_cell = { workspace = true }
|
once_cell = { workspace = true }
|
||||||
pyo3 = { workspace = true, optional = true, features = ["extension-module", "abi3-py37"] }
|
pyo3 = { workspace = true, optional = true, features = ["extension-module", "abi3-py37"] }
|
||||||
serde = { workspace = true, features = ["derive"], optional = true }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
rkyv = { workspace = true, optional = true }
|
rkyv = { workspace = true }
|
||||||
tracing = { workspace = true, optional = true }
|
tracing = { workspace = true, optional = true }
|
||||||
unicode-width = { workspace = true }
|
unicode-width = { workspace = true }
|
||||||
unscanny = { workspace = true }
|
unscanny = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,14 @@ use pyo3::{
|
||||||
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny,
|
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny,
|
||||||
PyObject, PyResult, Python,
|
PyObject, PyResult, Python,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
/// One of `~=` `==` `!=` `<=` `>=` `<` `>` `===`
|
/// One of `~=` `==` `!=` `<=` `>=` `<` `>` `===`
|
||||||
#[derive(Eq, PartialEq, Debug, Hash, Clone, Copy)]
|
#[derive(
|
||||||
#[cfg_attr(
|
Eq, PartialEq, Debug, Hash, Clone, Copy, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize,
|
||||||
feature = "rkyv",
|
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
)]
|
||||||
|
#[archive(check_bytes)]
|
||||||
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
#[cfg_attr(feature = "pyo3", pyclass)]
|
#[cfg_attr(feature = "pyo3", pyclass)]
|
||||||
pub enum Operator {
|
pub enum Operator {
|
||||||
/// `== 1.2.3`
|
/// `== 1.2.3`
|
||||||
|
|
@ -248,30 +242,16 @@ impl std::fmt::Display for OperatorParseError {
|
||||||
///
|
///
|
||||||
/// let version = Version::from_str("1.19").unwrap();
|
/// let version = Version::from_str("1.19").unwrap();
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone)]
|
#[derive(Clone, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
pub struct Version {
|
pub struct Version {
|
||||||
inner: Arc<VersionInner>,
|
inner: Arc<VersionInner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
enum VersionInner {
|
enum VersionInner {
|
||||||
Small { small: VersionSmall },
|
Small { small: VersionSmall },
|
||||||
Full { full: VersionFull },
|
Full { full: VersionFull },
|
||||||
|
|
@ -636,7 +616,6 @@ impl Version {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for Version {
|
impl<'de> Deserialize<'de> for Version {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -648,7 +627,6 @@ impl<'de> Deserialize<'de> for Version {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for Version {
|
impl Serialize for Version {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -839,16 +817,9 @@ impl FromStr for Version {
|
||||||
///
|
///
|
||||||
/// Thankfully, such versions are incredibly rare. Virtually all versions have
|
/// Thankfully, such versions are incredibly rare. Virtually all versions have
|
||||||
/// zero or one pre, dev or post release components.
|
/// zero or one pre, dev or post release components.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
struct VersionSmall {
|
struct VersionSmall {
|
||||||
/// The representation discussed above.
|
/// The representation discussed above.
|
||||||
repr: u64,
|
repr: u64,
|
||||||
|
|
@ -1185,16 +1156,9 @@ impl VersionSmall {
|
||||||
///
|
///
|
||||||
/// In general, the "full" representation is rarely used in practice since most
|
/// In general, the "full" representation is rarely used in practice since most
|
||||||
/// versions will fit into the "small" representation.
|
/// versions will fit into the "small" representation.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
struct VersionFull {
|
struct VersionFull {
|
||||||
/// The [versioning
|
/// The [versioning
|
||||||
/// epoch](https://peps.python.org/pep-0440/#version-epochs). Normally
|
/// epoch](https://peps.python.org/pep-0440/#version-epochs). Normally
|
||||||
|
|
@ -1314,17 +1278,22 @@ impl FromStr for VersionPattern {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An optional pre-release modifier and number applied to a version.
|
/// An optional pre-release modifier and number applied to a version.
|
||||||
#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Ord, PartialOrd)]
|
#[derive(
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Debug,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Ord,
|
||||||
|
PartialOrd,
|
||||||
|
rkyv::Archive,
|
||||||
|
rkyv::Deserialize,
|
||||||
|
rkyv::Serialize,
|
||||||
|
)]
|
||||||
|
#[archive(check_bytes)]
|
||||||
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
#[cfg_attr(feature = "pyo3", pyclass)]
|
#[cfg_attr(feature = "pyo3", pyclass)]
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
pub struct PreRelease {
|
pub struct PreRelease {
|
||||||
/// The kind of pre-release.
|
/// The kind of pre-release.
|
||||||
pub kind: PreReleaseKind,
|
pub kind: PreReleaseKind,
|
||||||
|
|
@ -1335,17 +1304,22 @@ pub struct PreRelease {
|
||||||
/// Optional prerelease modifier (alpha, beta or release candidate) appended to version
|
/// Optional prerelease modifier (alpha, beta or release candidate) appended to version
|
||||||
///
|
///
|
||||||
/// <https://peps.python.org/pep-0440/#pre-releases>
|
/// <https://peps.python.org/pep-0440/#pre-releases>
|
||||||
#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Ord, PartialOrd)]
|
#[derive(
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Debug,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Ord,
|
||||||
|
PartialOrd,
|
||||||
|
rkyv::Archive,
|
||||||
|
rkyv::Deserialize,
|
||||||
|
rkyv::Serialize,
|
||||||
|
)]
|
||||||
|
#[archive(check_bytes)]
|
||||||
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
#[cfg_attr(feature = "pyo3", pyclass)]
|
#[cfg_attr(feature = "pyo3", pyclass)]
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
pub enum PreReleaseKind {
|
pub enum PreReleaseKind {
|
||||||
/// alpha prerelease
|
/// alpha prerelease
|
||||||
Alpha,
|
Alpha,
|
||||||
|
|
@ -1380,16 +1354,9 @@ impl std::fmt::Display for PreReleaseKind {
|
||||||
/// > exactly.
|
/// > exactly.
|
||||||
///
|
///
|
||||||
/// Luckily the default `Ord` implementation for `Vec<LocalSegment>` matches the PEP 440 rules.
|
/// Luckily the default `Ord` implementation for `Vec<LocalSegment>` matches the PEP 440 rules.
|
||||||
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
|
#[derive(Eq, PartialEq, Debug, Clone, Hash, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "rkyv",
|
|
||||||
archive_attr(derive(Debug, Eq, PartialEq, PartialOrd, Ord))
|
|
||||||
)]
|
|
||||||
pub enum LocalSegment {
|
pub enum LocalSegment {
|
||||||
/// Not-parseable as integer segment of local version
|
/// Not-parseable as integer segment of local version
|
||||||
String(String),
|
String(String),
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ use pyo3::{
|
||||||
pyclass::CompareOp,
|
pyclass::CompareOp,
|
||||||
pymethods, Py, PyRef, PyRefMut, PyResult,
|
pymethods, Py, PyRef, PyRefMut, PyResult,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
#[cfg(feature = "pyo3")]
|
#[cfg(feature = "pyo3")]
|
||||||
|
|
@ -35,13 +34,9 @@ use crate::{
|
||||||
/// // VersionSpecifiers derefs into a list of specifiers
|
/// // VersionSpecifiers derefs into a list of specifiers
|
||||||
/// assert_eq!(version_specifiers.iter().position(|specifier| *specifier.operator() == Operator::LessThan), Some(1));
|
/// assert_eq!(version_specifiers.iter().position(|specifier| *specifier.operator() == Operator::LessThan), Some(1));
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
|
#[derive(Eq, PartialEq, Debug, Clone, Hash, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive_attr(derive(Debug)))]
|
|
||||||
#[cfg_attr(feature = "pyo3", pyclass(sequence))]
|
#[cfg_attr(feature = "pyo3", pyclass(sequence))]
|
||||||
pub struct VersionSpecifiers(Vec<VersionSpecifier>);
|
pub struct VersionSpecifiers(Vec<VersionSpecifier>);
|
||||||
|
|
||||||
|
|
@ -163,7 +158,6 @@ impl VersionSpecifiers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for VersionSpecifiers {
|
impl<'de> Deserialize<'de> for VersionSpecifiers {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -174,7 +168,6 @@ impl<'de> Deserialize<'de> for VersionSpecifiers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for VersionSpecifiers {
|
impl Serialize for VersionSpecifiers {
|
||||||
#[allow(unstable_name_collisions)]
|
#[allow(unstable_name_collisions)]
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
|
@ -252,13 +245,9 @@ impl std::error::Error for VersionSpecifiersParseError {}
|
||||||
/// let version_specifier = VersionSpecifier::from_str("== 1.*").unwrap();
|
/// let version_specifier = VersionSpecifier::from_str("== 1.*").unwrap();
|
||||||
/// assert!(version_specifier.contains(&version));
|
/// assert!(version_specifier.contains(&version));
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
|
#[derive(Eq, PartialEq, Debug, Clone, Hash, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
|
||||||
#[cfg_attr(
|
#[archive(check_bytes)]
|
||||||
feature = "rkyv",
|
#[archive_attr(derive(Debug))]
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
|
||||||
#[cfg_attr(feature = "rkyv", archive_attr(derive(Debug)))]
|
|
||||||
#[cfg_attr(feature = "pyo3", pyclass(get_all))]
|
#[cfg_attr(feature = "pyo3", pyclass(get_all))]
|
||||||
pub struct VersionSpecifier {
|
pub struct VersionSpecifier {
|
||||||
/// ~=|==|!=|<=|>=|<|>|===, plus whether the version ended with a star
|
/// ~=|==|!=|<=|>=|<|>|===, plus whether the version ended with a star
|
||||||
|
|
@ -317,7 +306,6 @@ impl VersionSpecifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for VersionSpecifier {
|
impl<'de> Deserialize<'de> for VersionSpecifier {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -329,7 +317,6 @@ impl<'de> Deserialize<'de> for VersionSpecifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for VersionSpecifier {
|
impl Serialize for VersionSpecifier {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,12 @@ once_cell = { workspace = true }
|
||||||
pyo3 = { workspace = true, optional = true, features = ["abi3", "extension-module"] }
|
pyo3 = { workspace = true, optional = true, features = ["abi3", "extension-module"] }
|
||||||
pyo3-log = { workspace = true, optional = true }
|
pyo3-log = { workspace = true, optional = true }
|
||||||
regex = { workspace = true }
|
regex = { workspace = true }
|
||||||
serde = { workspace = true, features = ["derive"], optional = true }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { workspace = true, optional = true }
|
serde_json = { workspace = true, optional = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
tracing = { workspace = true, optional = true }
|
tracing = { workspace = true, optional = true }
|
||||||
unicode-width = { workspace = true }
|
unicode-width = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true, features = ["serde"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = { version = "1.36.1" }
|
insta = { version = "1.36.1" }
|
||||||
|
|
@ -41,8 +41,6 @@ testing_logger = { version = "0.1.1" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
pyo3 = ["dep:pyo3", "pep440_rs/pyo3", "pyo3-log", "tracing", "tracing/log"]
|
pyo3 = ["dep:pyo3", "pep440_rs/pyo3", "pyo3-log", "tracing", "tracing/log"]
|
||||||
rkyv = ["pep440_rs/rkyv", "uv-normalize/rkyv"]
|
|
||||||
serde = ["dep:serde", "pep440_rs/serde", "uv-normalize/serde", "url/serde"]
|
|
||||||
tracing = ["dep:tracing", "pep440_rs/tracing"]
|
tracing = ["dep:tracing", "pep440_rs/tracing"]
|
||||||
# PEP 508 allows only URLs such as `foo @ https://example.org/foo` or `foo @ file:///home/ferris/foo`, and
|
# PEP 508 allows only URLs such as `foo @ https://example.org/foo` or `foo @ file:///home/ferris/foo`, and
|
||||||
# arguably does not allow relative paths in file URLs (`foo @ file://./foo`,
|
# arguably does not allow relative paths in file URLs (`foo @ file://./foo`,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ use pyo3::{
|
||||||
create_exception, exceptions::PyNotImplementedError, pyclass, pyclass::CompareOp, pymethods,
|
create_exception, exceptions::PyNotImplementedError, pyclass, pyclass::CompareOp, pymethods,
|
||||||
pymodule, types::PyModule, IntoPy, PyObject, PyResult, Python,
|
pymodule, types::PyModule, IntoPy, PyObject, PyResult, Python,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use unicode_width::UnicodeWidthChar;
|
use unicode_width::UnicodeWidthChar;
|
||||||
|
|
@ -181,7 +180,6 @@ impl Display for Requirement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/908#issuecomment-298027413>
|
/// <https://github.com/serde-rs/serde/issues/908#issuecomment-298027413>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for Requirement {
|
impl<'de> Deserialize<'de> for Requirement {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -193,7 +191,6 @@ impl<'de> Deserialize<'de> for Requirement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for Requirement {
|
impl Serialize for Requirement {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ use pyo3::{
|
||||||
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, types::PyAnyMethods, PyResult,
|
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, types::PyAnyMethods, PyResult,
|
||||||
Python,
|
Python,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
|
|
@ -324,7 +323,6 @@ impl Display for StringVersion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for StringVersion {
|
impl Serialize for StringVersion {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -334,7 +332,6 @@ impl Serialize for StringVersion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for StringVersion {
|
impl<'de> Deserialize<'de> for StringVersion {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -359,9 +356,8 @@ impl Deref for StringVersion {
|
||||||
///
|
///
|
||||||
/// Some are `(String, Version)` because we have to support version comparison
|
/// Some are `(String, Version)` because we have to support version comparison
|
||||||
#[allow(missing_docs, clippy::unsafe_derive_deserialize)]
|
#[allow(missing_docs, clippy::unsafe_derive_deserialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
#[cfg_attr(feature = "pyo3", pyclass(get_all, module = "pep508"))]
|
#[cfg_attr(feature = "pyo3", pyclass(get_all, module = "pep508"))]
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||||
pub struct MarkerEnvironment {
|
pub struct MarkerEnvironment {
|
||||||
pub implementation_name: String,
|
pub implementation_name: String,
|
||||||
pub implementation_version: StringVersion,
|
pub implementation_version: StringVersion,
|
||||||
|
|
@ -1683,7 +1679,6 @@ mod test {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_marker_environment_from_json() {
|
fn test_marker_environment_from_json() {
|
||||||
let _env: MarkerEnvironment = serde_json::from_str(
|
let _env: MarkerEnvironment = serde_json::from_str(
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ impl Display for UnnamedRequirement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/908#issuecomment-298027413>
|
/// <https://github.com/serde-rs/serde/issues/908#issuecomment-298027413>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for UnnamedRequirement {
|
impl<'de> Deserialize<'de> for UnnamedRequirement {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -74,7 +73,6 @@ impl<'de> Deserialize<'de> for UnnamedRequirement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
/// <https://github.com/serde-rs/serde/issues/1316#issue-332908452>
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl Serialize for UnnamedRequirement {
|
impl Serialize for UnnamedRequirement {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -10,17 +10,13 @@ use url::{ParseError, Url};
|
||||||
use uv_fs::normalize_path;
|
use uv_fs::normalize_path;
|
||||||
|
|
||||||
/// A wrapper around [`Url`] that preserves the original string.
|
/// A wrapper around [`Url`] that preserves the original string.
|
||||||
#[derive(Debug, Clone, Eq, derivative::Derivative)]
|
#[derive(Debug, Clone, Eq, derivative::Derivative, serde::Deserialize, serde::Serialize)]
|
||||||
#[derivative(PartialEq, Hash)]
|
#[derivative(PartialEq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
|
||||||
pub struct VerbatimUrl {
|
pub struct VerbatimUrl {
|
||||||
/// The parsed URL.
|
/// The parsed URL.
|
||||||
#[cfg_attr(
|
#[serde(
|
||||||
feature = "serde",
|
serialize_with = "Url::serialize_internal",
|
||||||
serde(
|
deserialize_with = "Url::deserialize_internal"
|
||||||
serialize_with = "Url::serialize_internal",
|
|
||||||
deserialize_with = "Url::deserialize_internal"
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
url: Url,
|
url: Url,
|
||||||
/// The URL as it was provided by the user.
|
/// The URL as it was provided by the user.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustc-hash = { workspace = true }
|
rustc-hash = { workspace = true }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ license = { workspace = true }
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pep440_rs = { workspace = true, features = ["rkyv", "serde"] }
|
pep440_rs = { workspace = true }
|
||||||
pep508_rs = { workspace = true, features = ["rkyv", "serde"] }
|
pep508_rs = { workspace = true }
|
||||||
uv-normalize = { workspace = true }
|
uv-normalize = { workspace = true }
|
||||||
|
|
||||||
chrono = { workspace = true, features = ["serde"] }
|
chrono = { workspace = true, features = ["serde"] }
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ license = { workspace = true }
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pep508_rs = { workspace = true, features = ["rkyv", "serde", "non-pep508-extensions"] }
|
pep508_rs = { workspace = true, features = ["non-pep508-extensions"] }
|
||||||
uv-client = { workspace = true }
|
uv-client = { workspace = true }
|
||||||
uv-fs = { workspace = true }
|
uv-fs = { workspace = true }
|
||||||
uv-normalize = { workspace = true }
|
uv-normalize = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ pep508_rs = { workspace = true }
|
||||||
uv-fs = { workspace = true }
|
uv-fs = { workspace = true }
|
||||||
uv-interpreter = { workspace = true }
|
uv-interpreter = { workspace = true }
|
||||||
uv-types = { workspace = true }
|
uv-types = { workspace = true }
|
||||||
uv-configuration = { workspace = true, features = ["serde"] }
|
uv-configuration = { workspace = true }
|
||||||
uv-virtualenv = { workspace = true }
|
uv-virtualenv = { workspace = true }
|
||||||
|
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cache-key = { workspace = true }
|
cache-key = { workspace = true }
|
||||||
distribution-filename = { workspace = true, features = ["rkyv", "serde"] }
|
distribution-filename = { workspace = true }
|
||||||
distribution-types = { workspace = true }
|
distribution-types = { workspace = true }
|
||||||
install-wheel-rs = { workspace = true }
|
install-wheel-rs = { workspace = true }
|
||||||
pep440_rs = { workspace = true }
|
pep440_rs = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,8 @@ clap = { workspace = true, features = ["derive"], optional = true }
|
||||||
itertools = { workspace = true }
|
itertools = { workspace = true }
|
||||||
rustc-hash = { workspace = true }
|
rustc-hash = { workspace = true }
|
||||||
schemars = { workspace = true, optional = true }
|
schemars = { workspace = true, optional = true }
|
||||||
serde = { workspace = true, optional = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true, optional = true }
|
serde_json = { workspace = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
serde = ["dep:serde", "dep:serde_json"]
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
use uv_auth::{self, KeyringProvider};
|
use uv_auth::{self, KeyringProvider};
|
||||||
|
|
||||||
/// Keyring provider type to use for credential lookup.
|
/// Keyring provider type to use for credential lookup.
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "serde",
|
|
||||||
serde(deny_unknown_fields, rename_all = "kebab-case")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum KeyringProviderType {
|
pub enum KeyringProviderType {
|
||||||
/// Do not use keyring for credential lookup.
|
/// Do not use keyring for credential lookup.
|
||||||
|
|
|
||||||
|
|
@ -196,13 +196,9 @@ impl NoBuild {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Hash, Eq, PartialEq)]
|
#[derive(Debug, Default, Clone, Copy, Hash, Eq, PartialEq, serde::Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "serde",
|
|
||||||
serde(deny_unknown_fields, rename_all = "kebab-case")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum IndexStrategy {
|
pub enum IndexStrategy {
|
||||||
/// Only use results from the first index that returns a match for a given package name.
|
/// Only use results from the first index that returns a match for a given package name.
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ enum ConfigSettingValue {
|
||||||
List(Vec<String>),
|
List(Vec<String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl serde::Serialize for ConfigSettingValue {
|
impl serde::Serialize for ConfigSettingValue {
|
||||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||||
match self {
|
match self {
|
||||||
|
|
@ -46,7 +45,6 @@ impl serde::Serialize for ConfigSettingValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> serde::Deserialize<'de> for ConfigSettingValue {
|
impl<'de> serde::Deserialize<'de> for ConfigSettingValue {
|
||||||
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
|
|
@ -84,7 +82,6 @@ impl<'de> serde::Deserialize<'de> for ConfigSettingValue {
|
||||||
/// See: <https://peps.python.org/pep-0517/#config-settings>
|
/// See: <https://peps.python.org/pep-0517/#config-settings>
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
#[cfg_attr(not(feature = "serde"), allow(dead_code))]
|
|
||||||
pub struct ConfigSettings(BTreeMap<String, ConfigSettingValue>);
|
pub struct ConfigSettings(BTreeMap<String, ConfigSettingValue>);
|
||||||
|
|
||||||
impl FromIterator<ConfigSettingEntry> for ConfigSettings {
|
impl FromIterator<ConfigSettingEntry> for ConfigSettings {
|
||||||
|
|
@ -110,7 +107,6 @@ impl FromIterator<ConfigSettingEntry> for ConfigSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl ConfigSettings {
|
impl ConfigSettings {
|
||||||
/// Convert the settings to a string that can be passed directly to a PEP 517 build backend.
|
/// Convert the settings to a string that can be passed directly to a PEP 517 build backend.
|
||||||
pub fn escape_for_python(&self) -> String {
|
pub fn escape_for_python(&self) -> String {
|
||||||
|
|
@ -118,7 +114,6 @@ impl ConfigSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl serde::Serialize for ConfigSettings {
|
impl serde::Serialize for ConfigSettings {
|
||||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||||
use serde::ser::SerializeMap;
|
use serde::ser::SerializeMap;
|
||||||
|
|
@ -131,7 +126,6 @@ impl serde::Serialize for ConfigSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> serde::Deserialize<'de> for ConfigSettings {
|
impl<'de> serde::Deserialize<'de> for ConfigSettings {
|
||||||
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
|
|
@ -202,7 +196,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
fn escape_for_python() {
|
fn escape_for_python() {
|
||||||
let mut settings = ConfigSettings::default();
|
let mut settings = ConfigSettings::default();
|
||||||
settings.0.insert(
|
settings.0.insert(
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ impl FromStr for PackageNameSpecifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> serde::Deserialize<'de> for PackageNameSpecifier {
|
impl<'de> serde::Deserialize<'de> for PackageNameSpecifier {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,9 @@ use platform_tags::{Arch, Os, Platform};
|
||||||
/// system.
|
/// system.
|
||||||
///
|
///
|
||||||
/// See: <https://doc.rust-lang.org/nightly/rustc/platform-support.html>
|
/// See: <https://doc.rust-lang.org/nightly/rustc/platform-support.html>
|
||||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
#[derive(Debug, Clone, Copy, Eq, PartialEq, serde::Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "serde",
|
|
||||||
serde(deny_unknown_fields, rename_all = "kebab-case")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum TargetTriple {
|
pub enum TargetTriple {
|
||||||
/// An alias for `x86_64-pc-windows-msvc`, the default target for Windows.
|
/// An alias for `x86_64-pc-windows-msvc`, the default target for Windows.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cache-key = { workspace = true }
|
cache-key = { workspace = true }
|
||||||
distribution-filename = { workspace = true, features = ["serde"] }
|
distribution-filename = { workspace = true }
|
||||||
distribution-types = { workspace = true }
|
distribution-types = { workspace = true }
|
||||||
install-wheel-rs = { workspace = true }
|
install-wheel-rs = { workspace = true }
|
||||||
pep440_rs = { workspace = true }
|
pep440_rs = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ workspace = true
|
||||||
cache-key = { workspace = true }
|
cache-key = { workspace = true }
|
||||||
install-wheel-rs = { workspace = true }
|
install-wheel-rs = { workspace = true }
|
||||||
pep440_rs = { workspace = true }
|
pep440_rs = { workspace = true }
|
||||||
pep508_rs = { workspace = true, features = ["serde", "non-pep508-extensions"] }
|
pep508_rs = { workspace = true, features = ["non-pep508-extensions"] }
|
||||||
platform-tags = { workspace = true }
|
platform-tags = { workspace = true }
|
||||||
pypi-types = { workspace = true }
|
pypi-types = { workspace = true }
|
||||||
uv-cache = { workspace = true }
|
uv-cache = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ edition = "2021"
|
||||||
description = "Normalization for distribution, package and extra anmes"
|
description = "Normalization for distribution, package and extra anmes"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rkyv = { workspace = true, optional = true }
|
rkyv = { workspace = true }
|
||||||
schemars = { workspace = true, optional = true }
|
schemars = { workspace = true, optional = true }
|
||||||
serde = { workspace = true, features = ["derive"], optional = true }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{Deserialize, Deserializer, Serialize};
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Deserializer, Serialize};
|
||||||
|
|
||||||
use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNameError};
|
use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNameError};
|
||||||
|
|
||||||
/// The normalized name of an extra dependency group.
|
/// The normalized name of an extra dependency group.
|
||||||
|
|
@ -14,8 +14,7 @@ use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNam
|
||||||
/// See:
|
/// See:
|
||||||
/// - <https://peps.python.org/pep-0685/#specification/>
|
/// - <https://peps.python.org/pep-0685/#specification/>
|
||||||
/// - <https://packaging.python.org/en/latest/specifications/name-normalization/>
|
/// - <https://packaging.python.org/en/latest/specifications/name-normalization/>
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize))]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub struct ExtraName(String);
|
pub struct ExtraName(String);
|
||||||
|
|
||||||
|
|
@ -34,7 +33,6 @@ impl FromStr for ExtraName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for ExtraName {
|
impl<'de> Deserialize<'de> for ExtraName {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{Deserialize, Deserializer, Serialize};
|
use serde::{Deserialize, Deserializer, Serialize};
|
||||||
|
|
||||||
use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNameError};
|
use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNameError};
|
||||||
|
|
@ -12,15 +11,22 @@ use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNam
|
||||||
/// down to a single `-`, e.g., `---`, `.`, and `__` all get converted to just `-`.
|
/// down to a single `-`, e.g., `---`, `.`, and `__` all get converted to just `-`.
|
||||||
///
|
///
|
||||||
/// See: <https://packaging.python.org/en/latest/specifications/name-normalization/>
|
/// See: <https://packaging.python.org/en/latest/specifications/name-normalization/>
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize))]
|
Debug,
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
Clone,
|
||||||
#[cfg_attr(
|
PartialEq,
|
||||||
feature = "rkyv",
|
Eq,
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
|
Hash,
|
||||||
archive(check_bytes),
|
PartialOrd,
|
||||||
archive_attr(derive(Debug))
|
Ord,
|
||||||
|
Serialize,
|
||||||
|
rkyv::Archive,
|
||||||
|
rkyv::Deserialize,
|
||||||
|
rkyv::Serialize,
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
|
#[archive(check_bytes)]
|
||||||
|
#[archive_attr(derive(Debug))]
|
||||||
pub struct PackageName(String);
|
pub struct PackageName(String);
|
||||||
|
|
||||||
impl PackageName {
|
impl PackageName {
|
||||||
|
|
@ -70,7 +76,6 @@ impl FromStr for PackageName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> Deserialize<'de> for PackageName {
|
impl<'de> Deserialize<'de> for PackageName {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cache-key = { workspace = true }
|
cache-key = { workspace = true }
|
||||||
distribution-filename = { workspace = true, features = ["serde"] }
|
distribution-filename = { workspace = true }
|
||||||
distribution-types = { workspace = true }
|
distribution-types = { workspace = true }
|
||||||
install-wheel-rs = { workspace = true }
|
install-wheel-rs = { workspace = true }
|
||||||
once-map = { workspace = true }
|
once-map = { workspace = true }
|
||||||
|
|
@ -49,7 +49,7 @@ pubgrub = { workspace = true }
|
||||||
rkyv = { workspace = true }
|
rkyv = { workspace = true }
|
||||||
rustc-hash = { workspace = true }
|
rustc-hash = { workspace = true }
|
||||||
schemars = { workspace = true, optional = true }
|
schemars = { workspace = true, optional = true }
|
||||||
serde = { workspace = true, optional = true }
|
serde = { workspace = true }
|
||||||
textwrap = { workspace = true }
|
textwrap = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@ use std::str::FromStr;
|
||||||
use chrono::{DateTime, Days, NaiveDate, NaiveTime, Utc};
|
use chrono::{DateTime, Days, NaiveDate, NaiveTime, Utc};
|
||||||
|
|
||||||
/// A timestamp that excludes files newer than it.
|
/// A timestamp that excludes files newer than it.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
pub struct ExcludeNewer(DateTime<Utc>);
|
pub struct ExcludeNewer(DateTime<Utc>);
|
||||||
|
|
||||||
impl ExcludeNewer {
|
impl ExcludeNewer {
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@ use rustc_hash::FxHashMap;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use uv_normalize::PackageName;
|
use uv_normalize::PackageName;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[serde(into = "LockWire", try_from = "LockWire")]
|
||||||
#[cfg_attr(feature = "serde", serde(into = "LockWire", try_from = "LockWire"))]
|
|
||||||
pub struct Lock {
|
pub struct Lock {
|
||||||
version: u32,
|
version: u32,
|
||||||
distributions: Vec<Distribution>,
|
distributions: Vec<Distribution>,
|
||||||
|
|
@ -104,11 +103,10 @@ impl Lock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
struct LockWire {
|
struct LockWire {
|
||||||
version: u32,
|
version: u32,
|
||||||
#[cfg_attr(feature = "serde", serde(rename = "distribution"))]
|
#[serde(rename = "distribution")]
|
||||||
distributions: Vec<Distribution>,
|
distributions: Vec<Distribution>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,24 +169,17 @@ impl TryFrom<LockWire> for Lock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
pub(crate) struct Distribution {
|
pub(crate) struct Distribution {
|
||||||
#[cfg_attr(feature = "serde", serde(flatten))]
|
#[serde(flatten)]
|
||||||
pub(crate) id: DistributionId,
|
pub(crate) id: DistributionId,
|
||||||
#[cfg_attr(feature = "serde", serde(default))]
|
#[serde(default)]
|
||||||
pub(crate) marker: Option<String>,
|
pub(crate) marker: Option<String>,
|
||||||
#[cfg_attr(feature = "serde", serde(default))]
|
#[serde(default)]
|
||||||
pub(crate) sourcedist: Option<SourceDist>,
|
pub(crate) sourcedist: Option<SourceDist>,
|
||||||
#[cfg_attr(
|
#[serde(default, rename = "wheel", skip_serializing_if = "Vec::is_empty")]
|
||||||
feature = "serde",
|
|
||||||
serde(default, rename = "wheel", skip_serializing_if = "Vec::is_empty")
|
|
||||||
)]
|
|
||||||
pub(crate) wheels: Vec<Wheel>,
|
pub(crate) wheels: Vec<Wheel>,
|
||||||
#[cfg_attr(
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
feature = "serde",
|
|
||||||
serde(default, skip_serializing_if = "Vec::is_empty")
|
|
||||||
)]
|
|
||||||
pub(crate) dependencies: Vec<Dependency>,
|
pub(crate) dependencies: Vec<Dependency>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -275,8 +266,9 @@ impl Distribution {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
|
||||||
|
)]
|
||||||
pub(crate) struct DistributionId {
|
pub(crate) struct DistributionId {
|
||||||
pub(crate) name: PackageName,
|
pub(crate) name: PackageName,
|
||||||
pub(crate) version: Version,
|
pub(crate) version: Version,
|
||||||
|
|
@ -456,7 +448,6 @@ impl std::fmt::Display for Source {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl serde::Serialize for Source {
|
impl serde::Serialize for Source {
|
||||||
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -466,7 +457,6 @@ impl serde::Serialize for Source {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> serde::Deserialize<'de> for Source {
|
impl<'de> serde::Deserialize<'de> for Source {
|
||||||
fn deserialize<D>(d: D) -> Result<Source, D::Error>
|
fn deserialize<D>(d: D) -> Result<Source, D::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -481,9 +471,10 @@ impl<'de> serde::Deserialize<'de> for Source {
|
||||||
/// variants should be added without changing the relative ordering of other
|
/// variants should be added without changing the relative ordering of other
|
||||||
/// variants. Otherwise, this could cause the lock file to have a different
|
/// variants. Otherwise, this could cause the lock file to have a different
|
||||||
/// canonical ordering of distributions.
|
/// canonical ordering of distributions.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
|
||||||
#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
|
)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub(crate) enum SourceKind {
|
pub(crate) enum SourceKind {
|
||||||
Registry,
|
Registry,
|
||||||
Git(GitSource),
|
Git(GitSource),
|
||||||
|
|
@ -506,8 +497,9 @@ impl SourceKind {
|
||||||
/// variants should be added without changing the relative ordering of other
|
/// variants should be added without changing the relative ordering of other
|
||||||
/// variants. Otherwise, this could cause the lock file to have a different
|
/// variants. Otherwise, this could cause the lock file to have a different
|
||||||
/// canonical ordering of distributions.
|
/// canonical ordering of distributions.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
|
||||||
|
)]
|
||||||
pub(crate) struct GitSource {
|
pub(crate) struct GitSource {
|
||||||
precise: Option<String>,
|
precise: Option<String>,
|
||||||
kind: GitSourceKind,
|
kind: GitSourceKind,
|
||||||
|
|
@ -536,8 +528,9 @@ impl GitSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
#[derive(
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
|
||||||
|
)]
|
||||||
enum GitSourceKind {
|
enum GitSourceKind {
|
||||||
Tag(String),
|
Tag(String),
|
||||||
Branch(String),
|
Branch(String),
|
||||||
|
|
@ -546,8 +539,7 @@ enum GitSourceKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inspired by: <https://discuss.python.org/t/lock-files-again-but-this-time-w-sdists/46593>
|
/// Inspired by: <https://discuss.python.org/t/lock-files-again-but-this-time-w-sdists/46593>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
pub(crate) struct SourceDist {
|
pub(crate) struct SourceDist {
|
||||||
/// A URL or file path (via `file://`) where the source dist that was
|
/// A URL or file path (via `file://`) where the source dist that was
|
||||||
/// locked against was found. The location does not need to exist in the
|
/// locked against was found. The location does not need to exist in the
|
||||||
|
|
@ -632,9 +624,8 @@ impl SourceDist {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inspired by: <https://discuss.python.org/t/lock-files-again-but-this-time-w-sdists/46593>
|
/// Inspired by: <https://discuss.python.org/t/lock-files-again-but-this-time-w-sdists/46593>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[serde(into = "WheelWire", try_from = "WheelWire")]
|
||||||
#[cfg_attr(feature = "serde", serde(into = "WheelWire", try_from = "WheelWire"))]
|
|
||||||
pub(crate) struct Wheel {
|
pub(crate) struct Wheel {
|
||||||
/// A URL or file path (via `file://`) where the wheel that was locked
|
/// A URL or file path (via `file://`) where the wheel that was locked
|
||||||
/// against was found. The location does not need to exist in the future,
|
/// against was found. The location does not need to exist in the future,
|
||||||
|
|
@ -713,8 +704,7 @@ impl Wheel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
struct WheelWire {
|
struct WheelWire {
|
||||||
/// A URL or file path (via `file://`) where the wheel that was locked
|
/// A URL or file path (via `file://`) where the wheel that was locked
|
||||||
/// against was found. The location does not need to exist in the future,
|
/// against was found. The location does not need to exist in the future,
|
||||||
|
|
@ -756,10 +746,9 @@ impl TryFrom<WheelWire> for Wheel {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single dependency of a distribution in a lock file.
|
/// A single dependency of a distribution in a lock file.
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, serde::Deserialize, serde::Serialize)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
pub(crate) struct Dependency {
|
pub(crate) struct Dependency {
|
||||||
#[cfg_attr(feature = "serde", serde(flatten))]
|
#[serde(flatten)]
|
||||||
id: DistributionId,
|
id: DistributionId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -806,7 +795,6 @@ impl std::fmt::Display for Hash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl serde::Serialize for Hash {
|
impl serde::Serialize for Hash {
|
||||||
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
@ -816,7 +804,6 @@ impl serde::Serialize for Hash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
impl<'de> serde::Deserialize<'de> for Hash {
|
impl<'de> serde::Deserialize<'de> for Hash {
|
||||||
fn deserialize<D>(d: D) -> Result<Hash, D::Error>
|
fn deserialize<D>(d: D) -> Result<Hash, D::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,9 @@ use uv_normalize::PackageName;
|
||||||
|
|
||||||
use crate::{DependencyMode, Manifest};
|
use crate::{DependencyMode, Manifest};
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "serde",
|
|
||||||
serde(deny_unknown_fields, rename_all = "kebab-case")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum PreReleaseMode {
|
pub enum PreReleaseMode {
|
||||||
/// Disallow all pre-release versions.
|
/// Disallow all pre-release versions.
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,9 @@ use crate::{Manifest, ResolveError};
|
||||||
|
|
||||||
/// Indicate the style of annotation comments, used to indicate the dependencies that requested each
|
/// Indicate the style of annotation comments, used to indicate the dependencies that requested each
|
||||||
/// package.
|
/// package.
|
||||||
#[derive(Debug, Default, Copy, Clone, PartialEq)]
|
#[derive(Debug, Default, Copy, Clone, PartialEq, serde::Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "serde",
|
|
||||||
serde(deny_unknown_fields, rename_all = "kebab-case")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum AnnotationStyle {
|
pub enum AnnotationStyle {
|
||||||
/// Render the annotations on a single, comma-separated line.
|
/// Render the annotations on a single, comma-separated line.
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,9 @@ use uv_normalize::PackageName;
|
||||||
|
|
||||||
use crate::{DependencyMode, Manifest};
|
use crate::{DependencyMode, Manifest};
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "serde",
|
|
||||||
serde(deny_unknown_fields, rename_all = "kebab-case")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum ResolutionMode {
|
pub enum ResolutionMode {
|
||||||
/// Resolve the highest compatible version of each package.
|
/// Resolve the highest compatible version of each package.
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
distribution-types = { workspace = true, features = ["schemars"] }
|
distribution-types = { workspace = true, features = ["schemars"] }
|
||||||
install-wheel-rs = { workspace = true, features = ["schemars"] }
|
install-wheel-rs = { workspace = true, features = ["schemars"] }
|
||||||
uv-configuration = { workspace = true, features = ["schemars", "serde"] }
|
uv-configuration = { workspace = true, features = ["schemars"] }
|
||||||
uv-fs = { workspace = true }
|
uv-fs = { workspace = true }
|
||||||
uv-normalize = { workspace = true, features = ["schemars"] }
|
uv-normalize = { workspace = true, features = ["schemars"] }
|
||||||
uv-resolver = { workspace = true, features = ["schemars", "serde"] }
|
uv-resolver = { workspace = true, features = ["schemars"] }
|
||||||
uv-interpreter = { workspace = true, features = ["schemars"] }
|
uv-interpreter = { workspace = true, features = ["schemars"] }
|
||||||
uv-warnings = { workspace = true }
|
uv-warnings = { workspace = true }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue