Skip to content

Commit

Permalink
Merge uv-toolchain and uv-interpreter
Browse files Browse the repository at this point in the history
# Conflicts:
#	crates/uv-interpreter/Cargo.toml
#	crates/uv-interpreter/src/environment/python_environment.rs
#	crates/uv-interpreter/src/interpreter.rs
#	crates/uv-interpreter/src/lib.rs
#	crates/uv/src/commands/pip_install.rs
#	crates/uv/src/commands/pip_sync.rs
#	crates/uv/src/settings.rs
  • Loading branch information
zanieb committed Apr 30, 2024
1 parent d57af51 commit eb65979
Show file tree
Hide file tree
Showing 34 changed files with 273 additions and 283 deletions.
37 changes: 9 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ uv-interpreter = { path = "crates/uv-interpreter" }
uv-normalize = { path = "crates/uv-normalize" }
uv-requirements = { path = "crates/uv-requirements" }
uv-resolver = { path = "crates/uv-resolver" }
uv-toolchain = { path = "crates/uv-toolchain" }
uv-types = { path = "crates/uv-types" }
uv-version = { path = "crates/uv-version" }
uv-virtualenv = { path = "crates/uv-virtualenv" }
Expand Down
1 change: 0 additions & 1 deletion crates/uv-dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ uv-installer = { workspace = true }
uv-interpreter = { workspace = true }
uv-normalize = { workspace = true }
uv-resolver = { workspace = true }
uv-toolchain = { workspace = true }
uv-types = { workspace = true }
uv-workspace = { workspace = true, features = ["schemars"] }

Expand Down
2 changes: 1 addition & 1 deletion crates/uv-dev/src/fetch_python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tokio::time::Instant;
use tracing::{info, info_span, Instrument};

use uv_fs::Simplified;
use uv_toolchain::{
use uv_interpreter::managed::{
DownloadResult, Error, PythonDownload, PythonDownloadRequest, TOOLCHAIN_DIRECTORY,
};

Expand Down
12 changes: 10 additions & 2 deletions crates/uv-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,34 @@ workspace = true
cache-key = { workspace = true }
install-wheel-rs = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true, features = ["serde"] }
pep508_rs = { workspace = true, features = ["serde", "non-pep508-extensions"] }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-cache = { workspace = true }
uv-client = { workspace = true }
uv-extract = { workspace = true }
uv-fs = { workspace = true }
uv-toolchain = { workspace = true }
uv-warnings = { workspace = true }

anyhow = { workspace = true }
configparser = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
itertools = { workspace = true }
futures = { workspace = true }
once_cell = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }
rmp-serde = { workspace = true }
same-file = { workspace = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tempfile = { workspace = true }
thiserror = { workspace = true }
tokio-util = { workspace = true, features = ["compat"] }
tracing = { workspace = true }
url = { workspace = true }
which = { workspace = true }

[target.'cfg(target_os = "windows")'.dependencies]
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions crates/uv-interpreter/src/environment/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub(crate) mod cfg;
pub(crate) mod python_environment;
pub(crate) mod virtualenv;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use tracing::{debug, info};
use uv_cache::Cache;
use uv_fs::{LockedFile, Simplified};

use crate::cfg::PyVenvConfiguration;
use crate::environment::cfg::PyVenvConfiguration;
use crate::{find_default_python, find_requested_python, Error, Interpreter, Target};

/// A Python environment, consisting of a Python [`Interpreter`] and its associated paths.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/uv-interpreter/src/find_python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::path::PathBuf;
use tracing::{debug, instrument};

use uv_cache::Cache;
use uv_toolchain::PythonVersion;
use uv_warnings::warn_user_once;

use crate::environment::python_environment::{detect_python_executable, detect_virtual_env};
use crate::interpreter::InterpreterInfoError;
use crate::python_environment::{detect_python_executable, detect_virtual_env};
use crate::PythonVersion;
use crate::{Error, Interpreter};

/// Find a Python of a specific version, a binary with a name or a path to a binary.
Expand Down
4 changes: 1 addition & 3 deletions crates/uv-interpreter/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ use platform_tags::{Tags, TagsError};
use pypi_types::Scheme;
use uv_cache::{Cache, CacheBucket, CachedByTimestamp, Freshness, Timestamp};
use uv_fs::{write_atomic_sync, PythonExt, Simplified};
use uv_toolchain::PythonVersion;

use crate::Virtualenv;
use crate::{Error, Target};
use crate::{Error, PythonVersion, Target, Virtualenv};

/// A Python executable and its associated platform markers.
#[derive(Debug, Clone)]
Expand Down
16 changes: 9 additions & 7 deletions crates/uv-interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ use std::process::ExitStatus;

use thiserror::Error;

pub use crate::cfg::PyVenvConfiguration;
pub use crate::environment::cfg::PyVenvConfiguration;
pub use crate::environment::python_environment::PythonEnvironment;
pub use crate::environment::virtualenv::Virtualenv;
pub use crate::find_python::{find_best_python, find_default_python, find_requested_python};
pub use crate::interpreter::Interpreter;
use crate::interpreter::InterpreterInfoError;
pub use crate::python_environment::PythonEnvironment;
pub use crate::python_version::PythonVersion;
pub use crate::target::Target;
pub use crate::virtualenv::Virtualenv;

mod cfg;
mod environment;
mod find_python;
mod interpreter;
mod python_environment;
pub mod managed;
mod python_version;
pub mod selectors;
mod target;
mod virtualenv;

#[derive(Debug, Error)]
pub enum Error {
Expand Down Expand Up @@ -73,7 +75,7 @@ pub enum Error {
#[error("Failed to write to cache")]
Encode(#[from] rmp_serde::encode::Error),
#[error("Broken virtualenv: Failed to parse pyvenv.cfg")]
Cfg(#[from] cfg::Error),
Cfg(#[from] environment::cfg::Error),
#[error("Error finding `{}` in PATH", _0.to_string_lossy())]
WhichError(OsString, #[source] which::Error),
#[error("Can't use Python at `{interpreter}`")]
Expand Down
Loading

0 comments on commit eb65979

Please sign in to comment.