Skip to content

Commit af4ed30

Browse files
committed
Move crate
1 parent 34b03e0 commit af4ed30

File tree

45 files changed

+227
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+227
-142
lines changed

Cargo.lock

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ requirements-txt = { path = "crates/requirements-txt" }
3030
uv-auth = { path = "crates/uv-auth" }
3131
uv-build = { path = "crates/uv-build" }
3232
uv-cache = { path = "crates/uv-cache" }
33+
uv-cache-info = { path = "crates/uv-cache-info" }
3334
uv-cli = { path = "crates/uv-cli" }
3435
uv-client = { path = "crates/uv-client" }
3536
uv-configuration = { path = "crates/uv-configuration" }

crates/distribution-types/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pep440_rs = { workspace = true }
1919
pep508_rs = { workspace = true, features = ["serde"] }
2020
platform-tags = { workspace = true }
2121
pypi-types = { workspace = true }
22+
uv-cache-info = { workspace = true }
2223
uv-fs = { workspace = true }
2324
uv-git = { workspace = true }
2425
uv-normalize = { workspace = true }
@@ -32,7 +33,6 @@ schemars = { workspace = true, optional = true }
3233
serde = { workspace = true, features = ["derive"] }
3334
serde_json = { workspace = true }
3435
thiserror = { workspace = true }
35-
toml = { workspace = true }
3636
tracing = { workspace = true }
3737
url = { workspace = true }
38-
urlencoding = { workspace = true }
38+
urlencoding = { workspace = true }

crates/distribution-types/src/cached.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ use anyhow::{anyhow, Result};
55
use distribution_filename::WheelFilename;
66
use pep508_rs::VerbatimUrl;
77
use pypi_types::{HashDigest, ParsedDirectoryUrl};
8+
use uv_cache_info::CacheInfo;
89
use uv_normalize::PackageName;
910

1011
use crate::{
11-
BuiltDist, CacheInfo, Dist, DistributionMetadata, Hashed, InstalledMetadata, InstalledVersion,
12-
Name, ParsedUrl, SourceDist, VersionOrUrlRef,
12+
BuiltDist, Dist, DistributionMetadata, Hashed, InstalledMetadata, InstalledVersion, Name,
13+
ParsedUrl, SourceDist, VersionOrUrlRef,
1314
};
1415

1516
/// A built distribution (wheel) that exists in the local cache.

crates/distribution-types/src/installed.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use url::Url;
1010
use distribution_filename::EggInfoFilename;
1111
use pep440_rs::Version;
1212
use pypi_types::DirectUrl;
13+
use uv_cache_info::CacheInfo;
1314
use uv_fs::Simplified;
1415
use uv_normalize::PackageName;
1516

16-
use crate::cache_info::CacheInfo;
1717
use crate::{DistributionMetadata, InstalledMetadata, InstalledVersion, Name, VersionOrUrlRef};
1818

1919
/// A built distribution (wheel) that is installed in a virtual environment.
@@ -36,7 +36,7 @@ pub struct InstalledRegistryDist {
3636
pub name: PackageName,
3737
pub version: Version,
3838
pub path: PathBuf,
39-
pub cache: Option<CacheInfo>,
39+
pub cache_info: Option<CacheInfo>,
4040
}
4141

4242
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -47,7 +47,7 @@ pub struct InstalledDirectUrlDist {
4747
pub url: Url,
4848
pub editable: bool,
4949
pub path: PathBuf,
50-
pub cache: Option<CacheInfo>,
50+
pub cache_info: Option<CacheInfo>,
5151
}
5252

5353
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -93,7 +93,7 @@ impl InstalledDist {
9393

9494
let name = PackageName::from_str(name)?;
9595
let version = Version::from_str(version).map_err(|err| anyhow!(err))?;
96-
let cache = Self::cache_info(path)?;
96+
let cache_info = Self::cache_info(path)?;
9797

9898
return if let Some(direct_url) = Self::direct_url(path)? {
9999
match Url::try_from(&direct_url) {
@@ -104,15 +104,15 @@ impl InstalledDist {
104104
direct_url: Box::new(direct_url),
105105
url,
106106
path: path.to_path_buf(),
107-
cache,
107+
cache_info,
108108
}))),
109109
Err(err) => {
110110
warn!("Failed to parse direct URL: {err}");
111111
Ok(Some(Self::Registry(InstalledRegistryDist {
112112
name,
113113
version,
114114
path: path.to_path_buf(),
115-
cache,
115+
cache_info,
116116
})))
117117
}
118118
}
@@ -121,7 +121,7 @@ impl InstalledDist {
121121
name,
122122
version,
123123
path: path.to_path_buf(),
124-
cache,
124+
cache_info,
125125
})))
126126
};
127127
}

crates/distribution-types/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use uv_normalize::PackageName;
5050
pub use crate::annotation::*;
5151
pub use crate::any::*;
5252
pub use crate::buildable::*;
53-
pub use crate::cache_info::*;
5453
pub use crate::cached::*;
5554
pub use crate::diagnostic::*;
5655
pub use crate::error::*;
@@ -63,15 +62,12 @@ pub use crate::prioritized_distribution::*;
6362
pub use crate::resolution::*;
6463
pub use crate::resolved::*;
6564
pub use crate::specified_requirement::*;
66-
pub use crate::timestamp::*;
6765
pub use crate::traits::*;
6866

6967
mod annotation;
7068
mod any;
7169
mod buildable;
72-
mod cache_info;
7370
mod cached;
74-
mod commit_info;
7571
mod diagnostic;
7672
mod error;
7773
mod file;
@@ -83,7 +79,6 @@ mod prioritized_distribution;
8379
mod resolution;
8480
mod resolved;
8581
mod specified_requirement;
86-
mod timestamp;
8782
mod traits;
8883

8984
#[derive(Debug, Clone)]

crates/install-wheel-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ name = "install_wheel_rs"
2121

2222
[dependencies]
2323
distribution-filename = { workspace = true }
24-
distribution-types = { workspace = true }
2524
pep440_rs = { workspace = true }
2625
platform-tags = { workspace = true }
2726
pypi-types = { workspace = true }
27+
uv-cache-info = { workspace = true }
2828
uv-fs = { workspace = true }
2929
uv-normalize = { workspace = true }
3030
uv-warnings = { workspace = true }

crates/install-wheel-rs/Readme.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
Reimplementation of wheel installing in rust. Supports both classical venvs and monotrail.
1+
# install-wheel-rs
22

3-
There are simple python bindings:
4-
5-
```python
6-
from install_wheel_rs import LockedVenv
7-
8-
locked_venv = LockedVenv("path/to/.venv")
9-
locked_venv.install_wheel("path/to/some_tagged_wheel.whl")
10-
```
11-
12-
and there's only one function: `install_wheels_venv(wheels: List[str], venv: str)`, where `wheels`
13-
is a list of paths to wheel files and `venv` is the location of the venv to install the packages in.
14-
15-
See monotrail for benchmarks.
3+
Reimplementation of wheel installing in Rust.

crates/install-wheel-rs/src/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::wheel::{
1212
};
1313
use crate::{Error, Layout};
1414
use distribution_filename::WheelFilename;
15-
use distribution_types::CacheInfo;
1615
use fs_err as fs;
1716
use fs_err::{DirEntry, File};
1817
use pypi_types::{DirectUrl, Metadata12};
@@ -21,6 +20,7 @@ use rustc_hash::FxHashMap;
2120
use serde::{Deserialize, Serialize};
2221
use tempfile::tempdir_in;
2322
use tracing::{debug, instrument};
23+
use uv_cache_info::CacheInfo;
2424
use uv_warnings::warn_user_once;
2525
use walkdir::WalkDir;
2626

crates/install-wheel-rs/src/wheel.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@ use std::io::{BufReader, Cursor, Read, Seek, Write};
33
use std::path::{Path, PathBuf};
44
use std::{env, io};
55

6+
use crate::record::RecordEntry;
7+
use crate::script::Script;
8+
use crate::{Error, Layout};
69
use data_encoding::BASE64URL_NOPAD;
7-
use distribution_types::CacheInfo;
810
use fs_err as fs;
911
use fs_err::{DirEntry, File};
1012
use mailparse::parse_headers;
1113
use pypi_types::DirectUrl;
1214
use rustc_hash::FxHashMap;
1315
use sha2::{Digest, Sha256};
1416
use tracing::{instrument, warn};
17+
use uv_cache_info::CacheInfo;
1518
use uv_fs::{relative_to, Simplified};
1619
use uv_normalize::PackageName;
1720
use walkdir::WalkDir;
1821
use zip::write::FileOptions;
1922
use zip::ZipWriter;
2023

21-
use crate::record::RecordEntry;
22-
use crate::script::Script;
23-
use crate::{Error, Layout};
24-
2524
const LAUNCHER_MAGIC_NUMBER: [u8; 4] = [b'U', b'V', b'U', b'V'];
2625

2726
#[cfg(all(windows, target_arch = "x86"))]

0 commit comments

Comments
 (0)