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
46 changes: 22 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[workspace]
default-members = [
"crates/pixi",
]
default-members = ["crates/pixi"]
exclude = [
# Only pulled in when enabling certain features. We do not want to include
# these crates when running workspace wide commands.
Expand Down Expand Up @@ -83,6 +81,7 @@ libc = { version = "0.2.170", default-features = false }
memchr = "2.7.4"
miette = { version = "7.6.0" }
minijinja = "2.15.1"
nanoid = "0.4.0"
nix = { version = "0.29.0", default-features = false }
once_cell = "1.20.3"
ordermap = "1.0.0"
Expand Down Expand Up @@ -134,7 +133,6 @@ pixi_variant = { path = "crates/pixi_variant" }
pypi_mapping = { path = "crates/pypi_mapping" }
pypi_modifiers = { path = "crates/pypi_modifiers" }
pyproject-toml = "0.13.7"
nanoid = "0.4.0"

rayon = "1.10.0"
regex = "1.11.1"
Expand Down Expand Up @@ -265,26 +263,26 @@ reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware",
reqwest-retry = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "7650ed76215a962a96d94a79be71c27bffde7ab2" }
version-ranges = { git = "https://github.com/astral-sh/pubgrub", rev = "d8efd77673c9a90792da9da31b6c0da7ea8a324b" }

coalesced_map = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
file_url = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_cache = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_conda_types = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_config = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_digest = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_index = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_lock = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_menuinst = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_networking = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_package_streaming = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_repodata_gateway = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_shell = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_solve = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_upload = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_redaction = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_virtual_packages = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
rattler_s3 = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
simple_spawn_blocking = { git = "https://github.com/conda/rattler", branch="feature/lockfile-v7" }
coalesced_map = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
file_url = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_cache = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_conda_types = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_config = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_digest = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_index = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_lock = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_menuinst = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_networking = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_package_streaming = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_redaction = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_repodata_gateway = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_s3 = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_shell = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_solve = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_upload = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
rattler_virtual_packages = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }
simple_spawn_blocking = { git = "https://github.com/conda/rattler", branch = "feature/lockfile-v7" }

[patch."https://github.com/prefix-dev/rattler-build"]
#rattler-build = { path = "/var/home/tobias/src/rattler-build" }
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi/tests/integration_rust/install_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,8 +1421,8 @@ async fn test_multiple_prefix_update() {
);

let pixi_records = Vec::from([
PixiRecord::Binary(wheel_repo_data_record),
PixiRecord::Binary(python_repo_data_record),
PixiRecord::from(wheel_repo_data_record),
PixiRecord::from(python_repo_data_record),
]);

let mut sets = JoinSet::new();
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ tempfile = { workspace = true }
tokio = { workspace = true, features = ["fs"] }
tracing = { workspace = true }
url = { workspace = true }
uv-pep508 = { workspace = true }
uv-distribution = { workspace = true }
uv-distribution-types = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-distribution-types = { workspace = true }
uv-normalize = { workspace = true }
uv-pep508 = { workspace = true }
uv-types = { workspace = true }
6 changes: 3 additions & 3 deletions crates/pixi_command_dispatcher/src/build/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ impl Dependencies {
// Determine the records that have missing run exports.
let records_missing_run_exports = relevant_records
.iter_mut()
.flat_map(|r| match *r {
PixiRecord::Binary(repo_data_record) => Some(repo_data_record),
PixiRecord::Source(_source_record) => None,
.flat_map(|r| match r {
PixiRecord::Binary(repo_data_record) => Some(Arc::make_mut(repo_data_record)),
PixiRecord::Source(_) => None,
})
.filter(|r| r.package_record.run_exports.is_none());
gateway
Expand Down
2 changes: 1 addition & 1 deletion crates/pixi_command_dispatcher/src/build/pin_compatible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ mod tests {
python_site_packages_path: None,
};

PixiRecord::Binary(RepoDataRecord {
PixiRecord::from(RepoDataRecord {
package_record,
identifier: DistArchiveIdentifier::try_from_filename(&format!(
"{}-{}-{}.conda",
Expand Down
11 changes: 8 additions & 3 deletions crates/pixi_command_dispatcher/src/install_pixi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
collections::{BTreeMap, HashMap, HashSet},
ffi::OsStr,
path::PathBuf,
sync::Arc,
};

use futures::StreamExt;
Expand Down Expand Up @@ -104,7 +105,7 @@ pub struct InstallPixiEnvironmentResult {
/// If source records where specified as part of the input they will be
/// built. This map contains the resulting repodata record for a build
/// source record.
pub resolved_source_records: HashMap<PackageName, RepoDataRecord>,
pub resolved_source_records: HashMap<PackageName, Arc<RepoDataRecord>>,
}

impl InstallPixiEnvironmentSpec {
Expand Down Expand Up @@ -166,6 +167,7 @@ impl InstallPixiEnvironmentSpec {
build_futures.push(async move {
let name = source_record.name().clone();
let manifest_source = source_record.manifest_source().clone();
let source_record = Arc::unwrap_or_clone(source_record);
this.build_unresolved_source(command_dispatcher, source_record)
.await
.map_err_with(move |build_err| {
Expand All @@ -180,7 +182,7 @@ impl InstallPixiEnvironmentSpec {

let mut resolved_source_records = HashMap::new();
while let Some(build_result) = build_futures.next().await {
let build_result = build_result?;
let build_result = Arc::new(build_result?);
resolved_source_records.insert(
build_result.package_record.name.clone(),
build_result.clone(),
Expand All @@ -207,7 +209,10 @@ impl InstallPixiEnvironmentSpec {
}

let result = installer
.install(self.prefix.path(), binary_records)
.install(
self.prefix.path(),
binary_records.into_iter().map(Arc::unwrap_or_clone),
)
.await
.map_err(|err| match err {
InstallerError::FailedToDetectInstalledPackages(err) => {
Expand Down
7 changes: 4 additions & 3 deletions crates/pixi_command_dispatcher/src/solve_conda/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ impl SolveCondaEnvironmentSpec {
.filter_map(|record| record.into_binary())
// Filter any record we want as a source record
.filter(|record| !package_names_from_source.contains(&record.package_record.name))
.map(Arc::unwrap_or_clone)
.collect();

// Create direct dependencies on the source packages to feed to the solver.
Expand Down Expand Up @@ -203,7 +204,7 @@ impl SolveCondaEnvironmentSpec {
},
channel: None,
};
let mut record = record.clone();
let mut record = SourceRecord::clone(record);
record.build_source = source_metadata.source.build_source().cloned();
url_to_source_package.insert(url, (record, repodata_record));
}
Expand Down Expand Up @@ -317,13 +318,13 @@ impl SolveCondaEnvironmentSpec {
if let Some(source_record) = url_to_source_package.remove(&record.url) {
// This is a source package, we want to return the source record
// instead of the binary record.
return Some(PixiRecord::Source(source_record.0.clone()));
return Some(PixiRecord::Source(Arc::new(source_record.0)));
} else if let Some(_dev_source) = url_to_dev_source.remove(&record.url) {
// This is a dev source, we don't want to return it.
return None;
}

Some(PixiRecord::Binary(record))
Some(PixiRecord::Binary(Arc::new(record)))
})
.collect_vec(),
)
Expand Down
4 changes: 3 additions & 1 deletion crates/pixi_command_dispatcher/src/source_build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,17 @@ impl SourceBuildSpec {
.into_iter()
.map(|record| match record {
PixiRecord::Binary(repodata_record) => BuildHostPackage {
repodata_record,
repodata_record: Arc::unwrap_or_clone(repodata_record),
source: None,
},
PixiRecord::Source(source) => {
let repodata_record = prefix
.resolved_source_records
.get(&source.data.package_record.name)
.cloned()
.map(Arc::unwrap_or_clone)
.expect("the source record should be present in the result sources");
let source = Arc::unwrap_or_clone(source);
BuildHostPackage {
repodata_record,
source: Some(PinnedSourceCodeLocation::new(
Expand Down
4 changes: 3 additions & 1 deletion crates/pixi_command_dispatcher/src/source_metadata/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub(crate) mod cycle;

use std::sync::Arc;

use crate::{
BuildBackendMetadataError, BuildBackendMetadataSpec, CommandDispatcher, CommandDispatcherError,
CommandDispatcherErrorResultExt, PackageNotProvidedError,
Expand Down Expand Up @@ -34,7 +36,7 @@ pub struct SourceMetadata {
pub source: PinnedSourceCodeLocation,

/// The metadata that was acquired from the build backend.
pub records: Vec<SourceRecord>,
pub records: Vec<Arc<SourceRecord>>,
}

impl SourceMetadataSpec {
Expand Down
13 changes: 9 additions & 4 deletions crates/pixi_command_dispatcher/src/source_record/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub struct ResolvedSourceRecord {
pub source: PinnedSourceCodeLocation,

/// The resolved source record.
pub record: SourceRecord,
pub record: Arc<SourceRecord>,
}

enum CacheFreshness {
Expand Down Expand Up @@ -172,10 +172,10 @@ impl SourceRecordSpec {
tracing::debug!("Using cached source record");
return Ok(ResolvedSourceRecord {
source: build_backend_metadata.source.clone(),
record: Self::amend_cached_source_record(
record: Arc::new(Self::amend_cached_source_record(
&build_backend_metadata.source,
entry.record,
),
)),
});
}
CacheFreshness::MismatchedBackendMetadata(entry) => {
Expand Down Expand Up @@ -317,7 +317,10 @@ impl SourceRecordSpec {
}

Ok(ResolvedSourceRecord {
record: Self::amend_cached_source_record(&build_backend_metadata.source, record),
record: Arc::new(Self::amend_cached_source_record(
&build_backend_metadata.source,
record,
)),
source: build_backend_metadata.source.clone(),
})
}
Expand All @@ -342,6 +345,8 @@ impl SourceRecordSpec {
manifest_source: source.manifest_source().clone(),
build_source: source.build_source().cloned(),
identifier_hash: None,
build_packages: Vec::new(),
host_packages: Vec::new(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/pixi_compute_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ version = "0.1.0"
cmp_any = { workspace = true }
futures = { workspace = true }
parking_lot = { workspace = true }
serde = { workspace = true, optional = true, features = ["derive"] }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt", "sync"] }
serde = { workspace = true, optional = true, features = ["derive"] }

[dev-dependencies]
derive_more = { workspace = true, features = ["display"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_core/src/environment/conda_prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct CondaPrefixInstallResult {

/// For each source package that was built, the resulting binary record.
/// Binary packages from the input are *not* included here.
pub resolved_source_records: HashMap<PackageName, RepoDataRecord>,
pub resolved_source_records: HashMap<PackageName, Arc<RepoDataRecord>>,
}

/// A struct that contains the result of updating a conda prefix.
Expand All @@ -49,7 +49,7 @@ pub struct CondaPrefixUpdated {
/// Any change to the python interpreter.
pub python_status: Box<PythonStatus>,
/// Fully-resolved records for source packages that were built.
pub resolved_source_records: HashMap<PackageName, RepoDataRecord>,
pub resolved_source_records: HashMap<PackageName, Arc<RepoDataRecord>>,
}

impl CondaPrefixUpdated {
Expand Down
4 changes: 3 additions & 1 deletion crates/pixi_core/src/lock_file/records_by_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ impl PixiRecordsByName {
/// no such record exists.
pub(crate) fn python_interpreter_record(&self) -> Option<&RepoDataRecord> {
self.records.iter().find_map(|record| match record {
PixiRecord::Binary(record) if is_python_record(record) => Some(record),
PixiRecord::Binary(record) if is_python_record(record.as_ref()) => {
Some(record.as_ref())
}
_ => None,
})
}
Expand Down
35 changes: 19 additions & 16 deletions crates/pixi_core/src/lock_file/satisfiability/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,10 @@ pub async fn verify_platform_satisfiability(
let record = match UnresolvedPixiRecord::from_conda_package_data(
conda.clone(),
ctx.project_root,
// TODO: resolve build/host packages once the lock-file
// exposes the package table publicly.
Vec::new(),
Vec::new(),
) {
Ok(record) => record,
Err(e) => {
Expand All @@ -1159,28 +1163,23 @@ pub async fn verify_platform_satisfiability(
resolved_records.push(PixiRecord::Binary(record))
}
UnresolvedPixiRecord::Source(record) => {
if record.has_mutable_source() {
// If the record is mutable, we always resolve it.
if record.has_mutable_source() || record.data.is_partial() {
// Mutable sources always need re-resolution; partial records
// have no full metadata yet.
pending_resolved_record.push(resolve_unresolved_source_record(
ctx,
&platform_setup,
record,
Arc::unwrap_or_clone(record),
))
} else {
// Otherwise we only resolve it if it is not already resolved.
match record.try_map_data(|data| match data {
SourceRecordData::Partial(data) => Err(data),
SourceRecordData::Full(data) => Ok(data),
}) {
Ok(full_record) => resolved_records.push(PixiRecord::Source(full_record)),
Err(partial_record) => {
pending_resolved_record.push(resolve_unresolved_source_record(
ctx,
&platform_setup,
partial_record.map_data(SourceRecordData::Partial),
))
// Immutable and already full: downcast in place.
let full_record = Arc::unwrap_or_clone(record).map_data(|data| match data {
SourceRecordData::Full(data) => data,
SourceRecordData::Partial(_) => {
unreachable!("guarded by is_partial() check above")
}
}
});
resolved_records.push(PixiRecord::Source(Arc::new(full_record)))
}
}
}
Expand Down Expand Up @@ -1277,6 +1276,10 @@ pub async fn verify_platform_satisfiability(
let record = UnresolvedPixiRecord::from_conda_package_data(
conda.clone(),
ctx.project_root,
// TODO: resolve build/host packages once the lock-file
// exposes the package table publicly.
Vec::new(),
Vec::new(),
)
.map_err(|e| {
CommandDispatcherError::Failed(Box::new(PlatformUnsat::CorruptedEntry(
Expand Down
Loading