Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ which = "7.0.2"

# Rattler crates
file_url = "0.2.3"
rattler = { version = "0.33.1", default-features = false }
rattler_cache = { version = "0.3.15", default-features = false }
rattler_conda_types = { version = "0.31.5", default-features = false, features = [
rattler = { version = "0.33.3", default-features = false }
rattler_cache = { version = "0.3.14", default-features = false }
rattler_conda_types = { version = "0.31.4", default-features = false, features = [
"rayon",
] }
rattler_digest = { version = "1.0.8", default-features = false }
rattler_lock = { version = "0.22.48", default-features = false }
rattler_menuinst = { version = "0.2.4", default-features = false }
rattler_menuinst = { version = "0.2.5", default-features = false }
rattler_networking = { version = "0.22.10", default-features = false, features = [
"google-cloud-auth",
] }
rattler_repodata_gateway = { version = "0.22.2", default-features = false }
rattler_repodata_gateway = { version = "0.22.3", default-features = false }
rattler_shell = { version = "0.22.24", default-features = false }
rattler_solve = { version = "1.4.2", default-features = false }
rattler_virtual_packages = { version = "2.0.8", default-features = false }
Expand Down
19 changes: 10 additions & 9 deletions crates/pixi_build_frontend/src/tool/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ use std::{
};

use dashmap::{DashMap, Entry};
use fs_err::tokio as tokio_fs;
use itertools::Itertools;
use miette::{Context, IntoDiagnostic};
use rattler_conda_types::{ChannelConfig, Matches, Platform, PrefixRecord};
use rattler_shell::{
activation::{ActivationVariables, Activator},
shell::ShellEnum,
};

use fs_err::tokio as tokio_fs;
use tokio::sync::broadcast;

use super::{installer::ToolInstaller, IsolatedTool};
Expand All @@ -40,7 +39,8 @@ pub struct ToolCache {
cache: DashMap<IsolatedToolSpec, PendingOrFetched<Arc<IsolatedTool>>>,
}

/// Finds the `PrefixRecord`s from `conda-meta` directory which starts with `Matchspec` names.
/// Finds the `PrefixRecord`s from `conda-meta` directory which starts with
/// `Matchspec` names.
pub(crate) async fn find_spec_records(
conda_meta: &Path,
name_to_match: Vec<String>,
Expand Down Expand Up @@ -312,8 +312,8 @@ mod tests {

const BAT_META_JSON: &str = "bat-0.24.0-h3bba108_1.json";

/// A test helper to create a temporary directory and write conda meta files.
/// This is used to simulate already installed tools.
/// A test helper to create a temporary directory and write conda meta
/// files. This is used to simulate already installed tools.
struct CondaMetaWriter {
pub tmp_dir: PathBuf,
}
Expand All @@ -328,7 +328,8 @@ mod tests {
}

/// Write a meta-json file to the conda-meta directory.
/// If `override_name` is provided, the file will be written with that name.
/// If `override_name` is provided, the file will be written with that
/// name.
async fn write_meta_json(
&self,
meta_json: &str,
Expand Down Expand Up @@ -391,7 +392,7 @@ mod tests {
let tool_context = ToolContext::for_tests()
.with_platform(compatible_target_platform())
.with_client(auth_client.clone())
.with_gateway(config.gateway(auth_client))
.with_gateway(config.gateway().with_client(auth_client).finish())
.build();

let tool_spec = IsolatedToolSpec {
Expand Down Expand Up @@ -491,8 +492,8 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_handle_a_failure() {
// This test verifies that during the installation of a tool, if an error occurs
// the tool is not cached and the next request will try to install the tool again.
// A test installer that will fail on the first request.
// the tool is not cached and the next request will try to install the tool
// again. A test installer that will fail on the first request.
#[derive(Default, Clone)]
struct TestInstaller {
count: Arc<Mutex<HashMap<IsolatedToolSpec, u8>>>,
Expand Down
1 change: 0 additions & 1 deletion crates/pixi_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ rattler = { workspace = true }
rattler_conda_types = { workspace = true }
rattler_networking = { workspace = true, features = ["s3"] }
rattler_repodata_gateway = { workspace = true, features = ["gateway"] }
reqwest-middleware = { workspace = true }
serde = { workspace = true }
serde_ignored = { workspace = true }
serde_json = { workspace = true }
Expand Down
37 changes: 20 additions & 17 deletions crates/pixi_config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
use std::{
collections::{BTreeSet as Set, HashMap},
path::{Path, PathBuf},
process::{Command, Stdio},
str::FromStr,
};

use clap::{ArgAction, Parser};
use itertools::Itertools;
use miette::{miette, Context, IntoDiagnostic};
Expand All @@ -7,15 +14,8 @@ use rattler_conda_types::{
ChannelConfig, NamedChannelOrUrl, Version, VersionBumpType, VersionSpec,
};
use rattler_networking::s3_middleware;
use rattler_repodata_gateway::{Gateway, SourceConfig};
use reqwest_middleware::ClientWithMiddleware;
use rattler_repodata_gateway::{Gateway, GatewayBuilder, SourceConfig};
use serde::{de::IntoDeserializer, Deserialize, Serialize};
use std::{
collections::{BTreeSet as Set, HashMap},
path::{Path, PathBuf},
process::{Command, Stdio},
str::FromStr,
};
use url::Url;

const EXPERIMENTAL: &str = "experimental";
Expand Down Expand Up @@ -182,7 +182,8 @@ impl RepodataConfig {

#[derive(Parser, Debug, Default, Clone)]
pub struct ConfigCliActivation {
/// Do not use the environment activation cache. (default: true except in experimental mode)
/// Do not use the environment activation cache. (default: true except in
/// experimental mode)
#[arg(long, help_heading = consts::CLAP_CONFIG_OPTIONS)]
force_activate: bool,

Expand Down Expand Up @@ -339,7 +340,8 @@ impl Default for DetachedEnvironments {
#[serde(rename_all = "kebab-case")]
pub struct ExperimentalConfig {
/// The option to opt into the environment activation cache feature.
/// This is an experimental feature and may be removed in the future or made default.
/// This is an experimental feature and may be removed in the future or made
/// default.
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_environment_activation_cache: Option<bool>,
Expand All @@ -362,7 +364,8 @@ impl ExperimentalConfig {
}
}

// Making the default values part of pixi_config to allow for printing the default settings in the future.
// Making the default values part of pixi_config to allow for printing the
// default settings in the future.
/// The default maximum number of concurrent solves that can be run at once.
/// Defaulting to the number of CPUs available.
fn default_max_concurrent_solves() -> usize {
Expand All @@ -380,12 +383,14 @@ fn default_max_concurrent_downloads() -> usize {
#[serde(rename_all = "kebab-case")]
pub struct ConcurrencyConfig {
/// The maximum number of concurrent solves that can be run at once.
// Needing to set this default next to the default of the full struct to avoid serde defaulting to 0 of partial struct was omitted.
// Needing to set this default next to the default of the full struct to avoid serde defaulting
// to 0 of partial struct was omitted.
#[serde(default = "default_max_concurrent_solves")]
pub solves: usize,

/// The maximum number of concurrent HTTP requests to make.
// Needing to set this default next to the default of the full struct to avoid serde defaulting to 0 of partial struct was omitted.
// Needing to set this default next to the default of the full struct to avoid serde defaulting
// to 0 of partial struct was omitted.
#[serde(default = "default_max_concurrent_downloads")]
pub downloads: usize,
}
Expand Down Expand Up @@ -1444,8 +1449,8 @@ impl Config {
.wrap_err(format!("failed to write config to '{}'", to.display()))
}

/// Constructs a [`Gateway`] using a [`ClientWithMiddleware`]
pub fn gateway(&self, client: ClientWithMiddleware) -> Gateway {
/// Constructs a [`GatewayBuilder`] with preconfigured settings.
pub fn gateway(&self) -> GatewayBuilder {
// Determine the cache directory and fall back to sane defaults otherwise.
let cache_dir = get_cache_dir().unwrap_or_else(|e| {
tracing::error!("failed to determine repodata cache directory: {e}");
Expand All @@ -1454,11 +1459,9 @@ impl Config {

// Construct the gateway
Gateway::builder()
.with_client(client)
.with_cache_dir(cache_dir.join(consts::CONDA_REPODATA_CACHE_DIR))
.with_channel_config(self.into())
.with_max_concurrent_requests(self.max_concurrent_downloads())
.finish()
}

pub fn compute_s3_config(&self) -> HashMap<String, s3_middleware::S3Config> {
Expand Down
3 changes: 3 additions & 0 deletions crates/pypi_mapping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ version = "0.1.0"

[dependencies]
async-once-cell = { workspace = true }
dashmap = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
http-cache-reqwest = { workspace = true }
Expand All @@ -27,5 +28,7 @@ reqwest-middleware = { workspace = true }
reqwest-retry = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
Loading