Skip to content
Open
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
1,020 changes: 610 additions & 410 deletions Cargo.lock

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ scroll = "0.13.0"
pathdiff = "0.2.3"
comfy-table = "7.1.4"
futures = "0.3.31"
indicatif = "0.17.11"
console = { version = "0.15.11", features = ["windows-console-colors"] }
indicatif = "0.18.0"
console = { version = "0.16.0", features = ["windows-console-colors"] }
thiserror = "2.0.12"
tempfile = "3.20.0"
chrono = "0.4.41"
Expand Down Expand Up @@ -142,16 +142,17 @@ opendal = { version = "0.53.3", default-features = false, features = [
] }

# Rattler crates
rattler_config = { version = "0.2.0" }
rattler = { version = "0.34.2", default-features = false, features = [
rattler_config = { version = "0.2.4" }
rattler = { version = "0.34.8", default-features = false, features = [
"cli-tools",
"indicatif",
] }
rattler_cache = { version = "0.3.21", default-features = false }
rattler_conda_types = { version = "0.35.1", default-features = false, features = [
rattler_cache = { version = "0.3.27", default-features = false }
rattler_conda_types = { version = "0.37.0", default-features = false, features = [
"rayon",
"experimental_extras",
] }
rattler_digest = { version = "1.1.3", default-features = false, features = [
rattler_digest = { version = "1.1.5", default-features = false, features = [
"serde",
] }
rattler_index = { version = "0.24.1", default-features = false }
Expand All @@ -172,6 +173,7 @@ rattler_shell = { version = "0.24.1", default-features = false, features = [
rattler_solve = { version = "2.1.1", default-features = false, features = [
"resolvo",
"serde",
"experimental_extras",
] }
rattler_virtual_packages = { version = "2.0.14", default-features = false }
rattler_package_streaming = { version = "0.22.40", default-features = false }
Expand Down Expand Up @@ -212,17 +214,18 @@ name = "parse_file"
harness = false

[patch.crates-io]
# rattler = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_sandbox = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_cache = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_conda_types = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_digest = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_index = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_networking = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_repodata_gateway = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_shell = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_solve = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_redaction = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_virtual_packages = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_package_streaming = { git = "https://github.com/conda/rattler", branch = "main" }
# rattler_menuinst = { git = "https://github.com/conda/rattler", branch = "main" }
rattler = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_sandbox = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_cache = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_config = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_conda_types = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_digest = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_index = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_networking = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_repodata_gateway = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_shell = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_solve = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_redaction = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_virtual_packages = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_package_streaming = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
rattler_menuinst = { git = "https://github.com/wolfv/rattler", branch = "resolvo-condition" }
43 changes: 43 additions & 0 deletions examples/conditional/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package:
name: conditional
version: 0.1.0

# build:
# flags:
# - cuda
# - openmp:mpi


requirements:
run:
- rattler-build
- bzip2 *; if rattler-build >=0.44
- zstd *; if rattler-build <0.44

extras:
science:
- numpy
- matplotlib
web:
- flask
cli:
- click

tests:
- script:
- echo "Hello, world!"
requirements:
run:
- rattler-build >=0.44

- script:
- echo "This is a test for Rattler < 0.44"
requirements:
run:
- rattler-build <0.44

- script:
- echo "This is a test for Rattler < 0.44"
requirements:
run:
- conditional [extras=[science, web]]
5 changes: 4 additions & 1 deletion src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,14 @@ impl Output {
}

if !finalized_dependencies.run.depends.is_empty() {
let extras = &self.recipe.requirements.extras;
writeln!(f, "Run dependencies:")?;
writeln!(
f,
"{}\n",
finalized_dependencies.run.to_table(template(), long)
finalized_dependencies
.run
.to_table(extras, template(), long)
)?;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/packaging/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl Output {
self.name().as_normalized()
);
}

println!("Adding extras: {:?}", self.recipe.requirements.extras);
Ok(IndexJson {
name: self
.name()
Expand Down Expand Up @@ -351,6 +351,7 @@ impl Output {
.map(|dep| dep.spec().to_string())
.dedup()
.collect(),
experimental_extra_depends: self.recipe.requirements.extras.clone(),
noarch,
track_features,
features: None,
Expand Down
10 changes: 9 additions & 1 deletion src/recipe/parser/requirements.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Parsing for the requirements section of the recipe.
use std::collections::BTreeMap;

use crate::recipe::parser::FlattenErrors;
use indexmap::IndexSet;
use rattler_conda_types::{MatchSpec, PackageName, ParseStrictness};
Expand Down Expand Up @@ -42,6 +44,11 @@ pub struct Requirements {
/// at runtime.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub run: Vec<Dependency>,

/// Extra requirement groups that can be enabled / disabled by the user.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub extras: BTreeMap<String, Vec<String>>,

/// Constrains are optional runtime requirements that are used to constrain the
/// environment that is resolved. They are not installed by default, but when
/// installed they will have to conform to the constrains specified here.
Expand Down Expand Up @@ -182,7 +189,8 @@ impl TryConvertNode<Requirements> for RenderedMappingNode {
run,
run_constraints,
run_exports,
ignore_run_exports
ignore_run_exports,
extras
);

Ok(requirements)
Expand Down
41 changes: 38 additions & 3 deletions src/render/resolved_dependencies.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
borrow::Cow,
collections::HashMap,
collections::{BTreeMap, HashMap},
fmt::{Display, Formatter},
sync::Arc,
};
Expand Down Expand Up @@ -355,7 +355,12 @@ impl ResolvedDependencies {
}

impl FinalizedRunDependencies {
pub fn to_table(&self, table: comfy_table::Table, long: bool) -> comfy_table::Table {
pub fn to_table(
&self,
extras: &BTreeMap<String, Vec<String>>,
table: comfy_table::Table,
long: bool,
) -> comfy_table::Table {
let mut table = table;
table
.set_content_arrangement(comfy_table::ContentArrangement::Dynamic)
Expand Down Expand Up @@ -418,6 +423,36 @@ impl FinalizedRunDependencies {
}
}

// Add extras section if available
if !extras.is_empty() {
if has_previous_section {
table.add_row(vec!["", ""]);
}

let mut row = comfy_table::Row::new();
row.add_cell(
comfy_table::Cell::new("Extras").add_attribute(comfy_table::Attribute::Bold),
);
table.add_row(row);

extras.iter().for_each(|(extra_name, items)| {
if !items.is_empty() {
// Add a subheader for each extra
let mut extra_row = comfy_table::Row::new();
extra_row.add_cell(
comfy_table::Cell::new(&format!(" {}", extra_name))
.add_attribute(comfy_table::Attribute::Italic),
);
table.add_row(extra_row);

// Add each item under the extra
items.iter().for_each(|item| {
table.add_row(vec![" ", item]);
});
}
});
}

table
}
}
Expand All @@ -428,7 +463,7 @@ impl Display for FinalizedRunDependencies {
table
.load_preset(comfy_table::presets::UTF8_FULL_CONDENSED)
.apply_modifier(comfy_table::modifiers::UTF8_ROUND_CORNERS);
write!(f, "{}", self.to_table(table, false))
write!(f, "{}", self.to_table(&BTreeMap::new(), table, false))
}
}

Expand Down
12 changes: 11 additions & 1 deletion src/render/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl GatewayReporter {
}
}

impl rattler_repodata_gateway::Reporter for GatewayReporter {
impl rattler_repodata_gateway::DownloadReporter for GatewayReporter {
fn on_download_start(&self, _url: &Url) -> usize {
let progress_bar = self
.multi_progress
Expand Down Expand Up @@ -218,6 +218,16 @@ impl rattler_repodata_gateway::Reporter for GatewayReporter {
}
}

impl rattler_repodata_gateway::Reporter for GatewayReporter {
fn jlap_reporter(&self) -> Option<&dyn rattler_repodata_gateway::JLAPReporter> {
None
}

fn download_reporter(&self) -> Option<&dyn rattler_repodata_gateway::DownloadReporter> {
Some(self)
}
}

impl GatewayReporterBuilder {
#[must_use]
pub fn with_multi_progress(
Expand Down