From e881131d439a99914d250e93734d19fa2f02ef29 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Wed, 29 Oct 2025 16:07:51 +0100 Subject: [PATCH 1/3] chore: rename `ProjectModel` to `PackageModel` While browsing the source code, Tim and I found that `ProjectModel` is a pretty confusing name, since: - We don't have projects anymore, but workspaces - It's also not the data of the workspace, but rather data specific to one package We propose to rename it to `PackageModel` --- .../pixi_build_backend_passthrough/src/lib.rs | 8 +-- crates/pixi_build_discovery/src/discovery.rs | 6 +-- .../src/backend/json_rpc.rs | 10 ++-- .../src/project_model.rs | 10 ++-- crates/pixi_build_types/src/lib.rs | 6 +-- .../src/procedures/initialize.rs | 4 +- crates/pixi_build_types/src/project_model.rs | 52 +++++++++---------- .../src/build/build_cache.rs | 4 +- .../src/build_backend_metadata/mod.rs | 4 +- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/crates/pixi_build_backend_passthrough/src/lib.rs b/crates/pixi_build_backend_passthrough/src/lib.rs index 651eed79c3..8e907eddbc 100644 --- a/crates/pixi_build_backend_passthrough/src/lib.rs +++ b/crates/pixi_build_backend_passthrough/src/lib.rs @@ -15,8 +15,8 @@ use pixi_build_frontend::{ json_rpc::CommunicationError, }; use pixi_build_types::{ - BackendCapabilities, NamedSpecV1, PackageSpecV1, ProjectModelV1, SourcePackageName, - TargetSelectorV1, TargetV1, TargetsV1, VersionedProjectModel, + BackendCapabilities, NamedSpecV1, PackageModelV1, PackageSpecV1, SourcePackageName, + TargetSelectorV1, TargetV1, TargetsV1, VersionedPackageModel, procedures::{ conda_build_v1::{CondaBuildV1Params, CondaBuildV1Result}, conda_outputs::{ @@ -36,7 +36,7 @@ const BACKEND_NAME: &str = "passthrough"; /// backend is useful for testing and debugging purposes, as it does not perform /// any actual building or processing of the project model. pub struct PassthroughBackend { - project_model: ProjectModelV1, + project_model: PackageModelV1, config: PassthroughBackendConfig, source_dir: PathBuf, index_json: Option, @@ -233,7 +233,7 @@ impl InMemoryBackendInstantiator for PassthroughBackendInstantiator { params: InitializeParams, ) -> Result> { let project_model = match params.project_model { - Some(VersionedProjectModel::V1(project_model)) => project_model, + Some(VersionedPackageModel::V1(project_model)) => project_model, _ => { return Err(Box::new(CommunicationError::BackendError( BackendError::new("Passthrough backend only supports project model v1"), diff --git a/crates/pixi_build_discovery/src/discovery.rs b/crates/pixi_build_discovery/src/discovery.rs index 875a19feab..3e6ac0d52c 100644 --- a/crates/pixi_build_discovery/src/discovery.rs +++ b/crates/pixi_build_discovery/src/discovery.rs @@ -7,7 +7,7 @@ use itertools::Itertools; use miette::Diagnostic; use ordermap::OrderMap; use pixi_build_type_conversions::{to_project_model_v1, to_target_selector_v1}; -use pixi_build_types::{ProjectModelV1, TargetSelectorV1}; +use pixi_build_types::{PackageModelV1, TargetSelectorV1}; use pixi_config::Config; use pixi_manifest::{ DiscoveryStart, ExplicitManifestError, PackageManifest, PrioritizedChannel, WithProvenance, @@ -58,7 +58,7 @@ pub struct BackendInitializationParams { pub manifest_path: PathBuf, /// Optionally, the manifest of the discovered package. - pub project_model: Option, + pub project_model: Option, /// Additional configuration that applies to the backend. pub configuration: Option, @@ -377,7 +377,7 @@ impl DiscoveredBackend { source: None, source_anchor: source_dir, manifest_path: package_xml_absolute_path, - project_model: Some(ProjectModelV1::default()), + project_model: Some(PackageModelV1::default()), configuration: None, target_configuration: None, }, diff --git a/crates/pixi_build_frontend/src/backend/json_rpc.rs b/crates/pixi_build_frontend/src/backend/json_rpc.rs index 78c617acaf..95f76f2f57 100644 --- a/crates/pixi_build_frontend/src/backend/json_rpc.rs +++ b/crates/pixi_build_frontend/src/backend/json_rpc.rs @@ -14,8 +14,8 @@ use jsonrpsee::{ use miette::Diagnostic; use ordermap::OrderMap; use pixi_build_types::{ - BackendCapabilities, FrontendCapabilities, ProjectModelV1, TargetSelectorV1, - VersionedProjectModel, + BackendCapabilities, FrontendCapabilities, PackageModelV1, TargetSelectorV1, + VersionedPackageModel, procedures::{ self, conda_build_v1::{CondaBuildV1Params, CondaBuildV1Result}, @@ -146,7 +146,7 @@ impl JsonRpcBackend { source_dir: PathBuf, manifest_path: PathBuf, workspace_root: PathBuf, - package_manifest: Option, + package_manifest: Option, configuration: Option, target_configuration: Option>, cache_dir: Option, @@ -215,7 +215,7 @@ impl JsonRpcBackend { source_dir: PathBuf, manifest_path: PathBuf, workspace_root: PathBuf, - project_model: Option, + project_model: Option, configuration: Option, target_configuration: Option>, cache_dir: Option, @@ -252,7 +252,7 @@ impl JsonRpcBackend { .request( procedures::initialize::METHOD_NAME, RpcParams::from(InitializeParams { - project_model: project_model.map(VersionedProjectModel::V1), + project_model: project_model.map(VersionedPackageModel::V1), configuration, target_configuration, manifest_path: manifest_path.clone(), diff --git a/crates/pixi_build_type_conversions/src/project_model.rs b/crates/pixi_build_type_conversions/src/project_model.rs index 8d285bd3fd..566a4a57c6 100644 --- a/crates/pixi_build_type_conversions/src/project_model.rs +++ b/crates/pixi_build_type_conversions/src/project_model.rs @@ -163,12 +163,12 @@ fn to_targets_v1( }) } -/// Converts a [`PackageManifest`] to a [`pbt::ProjectModelV1`]. +/// Converts a [`PackageManifest`] to a [`pbt::PackageModelV1`]. pub fn to_project_model_v1( manifest: &PackageManifest, channel_config: &ChannelConfig, -) -> Result { - let project = pbt::ProjectModelV1 { +) -> Result { + let project = pbt::PackageModelV1 { name: manifest.package.name.clone(), version: manifest.package.version.clone(), description: manifest.package.description.clone(), @@ -188,7 +188,7 @@ pub fn to_project_model_v1( mod tests { use std::path::PathBuf; - use pixi_build_types::VersionedProjectModel; + use pixi_build_types::VersionedPackageModel; use rattler_conda_types::ChannelConfig; use rstest::rstest; @@ -221,7 +221,7 @@ mod tests { .unwrap(); // Convert the manifest to the project model - let project_model: VersionedProjectModel = + let project_model: VersionedPackageModel = super::to_project_model_v1(&package_manifest.value, &some_channel_config()) .unwrap() .into(); diff --git a/crates/pixi_build_types/src/lib.rs b/crates/pixi_build_types/src/lib.rs index e71082713d..0487d87d7d 100644 --- a/crates/pixi_build_types/src/lib.rs +++ b/crates/pixi_build_types/src/lib.rs @@ -11,9 +11,9 @@ pub use capabilities::{BackendCapabilities, FrontendCapabilities}; pub use channel_configuration::ChannelConfiguration; pub use conda_package_metadata::CondaPackageMetadata; pub use project_model::{ - BinaryPackageSpecV1, GitReferenceV1, GitSpecV1, NamedSpecV1, PackageSpecV1, PathSpecV1, - ProjectModelV1, SourcePackageName, SourcePackageSpecV1, TargetSelectorV1, TargetV1, TargetsV1, - UrlSpecV1, VersionedProjectModel, + BinaryPackageSpecV1, GitReferenceV1, GitSpecV1, NamedSpecV1, PackageModelV1, PackageSpecV1, + PathSpecV1, SourcePackageName, SourcePackageSpecV1, TargetSelectorV1, TargetV1, TargetsV1, + UrlSpecV1, VersionedPackageModel, }; use rattler_conda_types::{ GenericVirtualPackage, PackageName, Platform, Version, VersionSpec, diff --git a/crates/pixi_build_types/src/procedures/initialize.rs b/crates/pixi_build_types/src/procedures/initialize.rs index acaa8f244b..b472c12a38 100644 --- a/crates/pixi_build_types/src/procedures/initialize.rs +++ b/crates/pixi_build_types/src/procedures/initialize.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use ordermap::OrderMap; use serde::{Deserialize, Serialize}; -use crate::{TargetSelectorV1, VersionedProjectModel}; +use crate::{TargetSelectorV1, VersionedPackageModel}; pub const METHOD_NAME: &str = "initialize"; @@ -48,7 +48,7 @@ pub struct InitializeParams { /// Project model that the backend should use even though it is an option /// it is highly recommended to use this field. Otherwise, it will be very /// easy to break backwards compatibility. - pub project_model: Option, + pub project_model: Option, /// Backend specific configuration passed from the frontend to the backend. pub configuration: Option, diff --git a/crates/pixi_build_types/src/project_model.rs b/crates/pixi_build_types/src/project_model.rs index 5a9c1d19c1..2dc7ff73f2 100644 --- a/crates/pixi_build_types/src/project_model.rs +++ b/crates/pixi_build_types/src/project_model.rs @@ -32,14 +32,14 @@ use url::Url; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "version", content = "data")] #[serde(rename_all = "camelCase")] -pub enum VersionedProjectModel { +pub enum VersionedPackageModel { /// Version 1 of the project model. #[serde(rename = "1")] - V1(ProjectModelV1), + V1(PackageModelV1), // When adding don't forget to update the highest_version function } -impl VersionedProjectModel { +impl VersionedPackageModel { /// Highest version of the project model. pub fn highest_version() -> u32 { // increase this when adding a new version @@ -47,9 +47,9 @@ impl VersionedProjectModel { } /// Move into the v1 type, returns None if the version is not v1. - pub fn into_v1(self) -> Option { + pub fn into_v1(self) -> Option { match self { - VersionedProjectModel::V1(v) => Some(v), + VersionedPackageModel::V1(v) => Some(v), // Add this once we have more versions //_ => None, } @@ -57,9 +57,9 @@ impl VersionedProjectModel { /// Returns a reference to the v1 type, returns None if the version is not /// v1. - pub fn as_v1(&self) -> Option<&ProjectModelV1> { + pub fn as_v1(&self) -> Option<&PackageModelV1> { match self { - VersionedProjectModel::V1(v) => Some(v), + VersionedPackageModel::V1(v) => Some(v), // Add this once we have more versions //_ => None, } @@ -71,7 +71,7 @@ pub type SourcePackageName = String; #[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] -pub struct ProjectModelV1 { +pub struct PackageModelV1 { /// The name of the project pub name: Option, @@ -102,12 +102,12 @@ pub struct ProjectModelV1 { /// URL of the project documentation pub documentation: Option, - /// The target of the project, this may contain + /// The target of the package, this may contain /// platform specific configurations. pub targets: Option, } -impl IsDefault for ProjectModelV1 { +impl IsDefault for PackageModelV1 { type Item = Self; fn is_non_default(&self) -> Option<&Self::Item> { @@ -115,9 +115,9 @@ impl IsDefault for ProjectModelV1 { } } -impl From for VersionedProjectModel { - fn from(value: ProjectModelV1) -> Self { - VersionedProjectModel::V1(value) +impl From for VersionedPackageModel { + fn from(value: PackageModelV1) -> Self { + VersionedPackageModel::V1(value) } } @@ -193,13 +193,13 @@ impl IsDefault for TargetsV1 { #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct TargetV1 { - /// Host dependencies of the project + /// Host dependencies of the package pub host_dependencies: Option>, - /// Build dependencies of the project + /// Build dependencies of the package pub build_dependencies: Option>, - /// Run dependencies of the project + /// Run dependencies of the package pub run_dependencies: Option>, } @@ -415,12 +415,12 @@ impl std::fmt::Debug for BinaryPackageSpecV1 { } // Custom Hash implementations that skip default values for stability -impl Hash for ProjectModelV1 { +impl Hash for PackageModelV1 { /// Custom hash implementation using StableHashBuilder to ensure different /// field configurations produce different hashes while maintaining /// forward/backward compatibility. fn hash(&self, state: &mut H) { - let ProjectModelV1 { + let PackageModelV1 { name, version, description, @@ -644,8 +644,8 @@ mod tests { #[test] fn test_hash_stability_with_default_values() { - // Create a minimal ProjectModelV1 instance - let mut project_model = ProjectModelV1 { + // Create a minimal PackageModelV1 instance + let mut project_model = PackageModelV1 { name: Some("test-project".to_string()), version: None, description: None, @@ -700,8 +700,8 @@ mod tests { #[test] fn test_hash_changes_with_meaningful_values() { - // Create a minimal ProjectModelV1 instance - let mut project_model = ProjectModelV1 { + // Create a minimal PackageModelV1 instance + let mut project_model = PackageModelV1 { name: Some("test-project".to_string()), version: None, description: None, @@ -995,15 +995,15 @@ mod tests { #[test] fn test_hash_collision_bug_project_model() { - // Test the same issue in ProjectModelV1 - let project1 = ProjectModelV1 { + // Test the same issue in PackageModelV1 + let project1 = PackageModelV1 { name: Some("test".to_string()), description: Some("test description".to_string()), license: None, ..Default::default() }; - let project2 = ProjectModelV1 { + let project2 = PackageModelV1 { name: Some("test".to_string()), description: None, license: Some("test description".to_string()), @@ -1015,7 +1015,7 @@ mod tests { assert_ne!( hash1, hash2, - "Same value in different fields should produce different hashes in ProjectModelV1" + "Same value in different fields should produce different hashes in PackageModelV1" ); } } diff --git a/crates/pixi_command_dispatcher/src/build/build_cache.rs b/crates/pixi_command_dispatcher/src/build/build_cache.rs index 6b1c7da725..d71153a46a 100644 --- a/crates/pixi_command_dispatcher/src/build/build_cache.rs +++ b/crates/pixi_command_dispatcher/src/build/build_cache.rs @@ -9,7 +9,7 @@ use async_fd_lock::{LockWrite, RwLockWriteGuard}; use base64::{Engine, engine::general_purpose::URL_SAFE_NO_PAD}; use ordermap::OrderMap; use pixi_build_discovery::{BackendInitializationParams, DiscoveredBackend}; -use pixi_build_types::{ProjectModelV1, TargetSelectorV1}; +use pixi_build_types::{PackageModelV1, TargetSelectorV1}; use pixi_record::PinnedSourceSpec; use pixi_stable_hash::{StableHashBuilder, json::StableJson, map::StableMap}; use rattler_conda_types::{ChannelUrl, GenericVirtualPackage, Platform, RepoDataRecord}; @@ -317,7 +317,7 @@ impl BuildCacheEntry { /// warranted. pub struct PackageBuildInputHashBuilder<'a> { /// The project model itself. Contains dependencies and more. - pub project_model: Option<&'a ProjectModelV1>, + pub project_model: Option<&'a PackageModelV1>, /// The backend specific configuration pub configuration: Option<&'a serde_json::Value>, diff --git a/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs b/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs index e3eeb6873c..21dab18b35 100644 --- a/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs +++ b/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs @@ -11,7 +11,7 @@ use once_cell::sync::Lazy; use pathdiff::diff_paths; use pixi_build_discovery::{CommandSpec, EnabledProtocols}; use pixi_build_frontend::Backend; -use pixi_build_types::{ProjectModelV1, procedures::conda_outputs::CondaOutputsParams}; +use pixi_build_types::{PackageModelV1, procedures::conda_outputs::CondaOutputsParams}; use pixi_glob::GlobHashKey; use pixi_record::{InputHash, PinnedSourceSpec}; use pixi_spec::{SourceAnchor, SourceSpec}; @@ -488,7 +488,7 @@ pub enum BuildBackendMetadataError { /// Computes an additional hash to be used in glob hash pub fn calculate_additional_glob_hash( - project_model: &Option, + project_model: &Option, variants: &Option>>, ) -> Vec { let mut hasher = Xxh3::new(); From d56e8bb59e81e0e4e9d77a2c8f21ed52db0daa92 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Thu, 30 Oct 2025 09:43:13 +0100 Subject: [PATCH 2/3] Rename more stuff --- crates/pixi_build_discovery/src/discovery.rs | 4 ++-- crates/pixi_build_type_conversions/src/lib.rs | 2 +- crates/pixi_build_type_conversions/src/project_model.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/pixi_build_discovery/src/discovery.rs b/crates/pixi_build_discovery/src/discovery.rs index 3e6ac0d52c..06cc32c62a 100644 --- a/crates/pixi_build_discovery/src/discovery.rs +++ b/crates/pixi_build_discovery/src/discovery.rs @@ -6,7 +6,7 @@ use std::{ use itertools::Itertools; use miette::Diagnostic; use ordermap::OrderMap; -use pixi_build_type_conversions::{to_project_model_v1, to_target_selector_v1}; +use pixi_build_type_conversions::{to_package_model_v1, to_target_selector_v1}; use pixi_build_types::{PackageModelV1, TargetSelectorV1}; use pixi_config::Config; use pixi_manifest::{ @@ -233,7 +233,7 @@ impl DiscoveredBackend { .to_path_buf(); // Construct the project model from the manifest - let project_model = to_project_model_v1(package_manifest, channel_config)?; + let project_model = to_package_model_v1(package_manifest, channel_config)?; // Determine the build system requirements. let build_system = package_manifest.build.clone(); diff --git a/crates/pixi_build_type_conversions/src/lib.rs b/crates/pixi_build_type_conversions/src/lib.rs index 4374a66a55..6e2c2d7404 100644 --- a/crates/pixi_build_type_conversions/src/lib.rs +++ b/crates/pixi_build_type_conversions/src/lib.rs @@ -1,3 +1,3 @@ mod project_model; -pub use project_model::{to_project_model_v1, to_target_selector_v1}; +pub use project_model::{to_package_model_v1, to_target_selector_v1}; diff --git a/crates/pixi_build_type_conversions/src/project_model.rs b/crates/pixi_build_type_conversions/src/project_model.rs index 566a4a57c6..3599ef904f 100644 --- a/crates/pixi_build_type_conversions/src/project_model.rs +++ b/crates/pixi_build_type_conversions/src/project_model.rs @@ -164,7 +164,7 @@ fn to_targets_v1( } /// Converts a [`PackageManifest`] to a [`pbt::PackageModelV1`]. -pub fn to_project_model_v1( +pub fn to_package_model_v1( manifest: &PackageManifest, channel_config: &ChannelConfig, ) -> Result { @@ -222,7 +222,7 @@ mod tests { // Convert the manifest to the project model let project_model: VersionedPackageModel = - super::to_project_model_v1(&package_manifest.value, &some_channel_config()) + super::to_package_model_v1(&package_manifest.value, &some_channel_config()) .unwrap() .into(); let mut settings = insta::Settings::clone_current(); From a69e2e07e3a372b510513151c9858f3f10bcf4ba Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Thu, 30 Oct 2025 11:38:38 +0100 Subject: [PATCH 3/3] Remove versioned package model and bump pixi api requirement --- .../pixi_build_backend_passthrough/src/lib.rs | 39 +++--- crates/pixi_build_discovery/src/discovery.rs | 18 +-- .../discovery__direct_package_xml.snap | 2 +- .../snapshots/discovery__direct_recipe.snap | 2 +- .../discovery__discovery@inherit__nested.snap | 2 +- .../discovery__discovery@nested__nested.snap | 2 +- ...iscovery__discovery@nested_recipe_yml.snap | 2 +- .../discovery__discovery@recipe_yaml.snap | 2 +- .../discovery__discovery@recipe_yml.snap | 2 +- .../discovery__discovery@simple.snap | 2 +- .../src/backend/json_rpc.rs | 11 +- ...s__conversions_v1_docs@pixi_build_cpp.snap | 2 +- ...conversions_v1_docs@pixi_build_python.snap | 2 +- ...versions_v1_docs@pixi_build_workspace.snap | 2 +- ...ests__conversions_v1_examples@boltons.snap | 2 +- ...ests__conversions_v1_examples@cpp-sdl.snap | 2 +- crates/pixi_build_type_conversions/src/lib.rs | 2 +- .../src/project_model.rs | 20 ++- ...sts__conversions_v1_docs@advanced_cpp.snap | 39 +++--- ...__conversions_v1_docs@advanced_python.snap | 39 +++--- ...model__tests__conversions_v1_docs@cpp.snap | 119 +++++++++--------- ...__conversions_v1_docs@getting_started.snap | 93 +++++++------- ...el__tests__conversions_v1_docs@python.snap | 93 +++++++------- ..._tests__conversions_v1_docs@workspace.snap | 103 ++++++++------- ...onversions_v1_docs@workspace_variants.snap | 103 ++++++++------- ...nversions_v1_examples@array-api-extra.snap | 39 +++--- ...ests__conversions_v1_examples@cpp-sdl.snap | 69 +++++----- crates/pixi_build_types/src/lib.rs | 12 +- .../src/procedures/initialize.rs | 6 +- crates/pixi_build_types/src/project_model.rs | 103 ++++----------- .../src/build/build_cache.rs | 12 +- .../src/build_backend_metadata/mod.rs | 12 +- .../command_dispatcher/instantiate_backend.rs | 8 +- .../src/source_build_cache_status/mod.rs | 2 +- .../src/lock_file/satisfiability/mod.rs | 2 +- ...patible-api-version-0.1.0-h4616a5c_0.conda | Bin 1125 -> 1127 bytes ...patible-api-version-0.1.0-h4616a5c_0.conda | Bin 1112 -> 1113 bytes .../pixi-build-api-version-1-h4616a5c_0.conda | Bin 1011 -> 0 bytes .../pixi-build-api-version-3-h4616a5c_0.conda | Bin 0 -> 1014 bytes .../backend_channel_1/noarch/repodata.json | 2 +- .../backend-with-compatible-api-version.yaml | 2 +- .../pixi-build-api-version.yaml | 2 +- 42 files changed, 447 insertions(+), 529 deletions(-) delete mode 100644 tests/data/channels/channels/backend_channel_1/noarch/pixi-build-api-version-1-h4616a5c_0.conda create mode 100644 tests/data/channels/channels/backend_channel_1/noarch/pixi-build-api-version-3-h4616a5c_0.conda diff --git a/crates/pixi_build_backend_passthrough/src/lib.rs b/crates/pixi_build_backend_passthrough/src/lib.rs index 8e907eddbc..c76d558f5e 100644 --- a/crates/pixi_build_backend_passthrough/src/lib.rs +++ b/crates/pixi_build_backend_passthrough/src/lib.rs @@ -1,9 +1,9 @@ //! A passthrough build backend for testing purposes. //! -//! This backend simply passes along the information from the project model to +//! This backend simply passes along the information from the package model to //! the `conda/outputs` API without any modifications. It's useful for testing //! and debugging purposes, as it does not perform any actual building or -//! processing of the project model. +//! processing of the package model. use std::{collections::BTreeSet, path::PathBuf}; @@ -15,8 +15,8 @@ use pixi_build_frontend::{ json_rpc::CommunicationError, }; use pixi_build_types::{ - BackendCapabilities, NamedSpecV1, PackageModelV1, PackageSpecV1, SourcePackageName, - TargetSelectorV1, TargetV1, TargetsV1, VersionedPackageModel, + BackendCapabilities, NamedSpecV1, PackageModel, PackageSpecV1, SourcePackageName, + TargetSelectorV1, TargetV1, TargetsV1, procedures::{ conda_build_v1::{CondaBuildV1Params, CondaBuildV1Result}, conda_outputs::{ @@ -32,11 +32,11 @@ use serde::Deserialize; const BACKEND_NAME: &str = "passthrough"; /// An in-memory build backend that simply passes along the information from the -/// project model to the `conda/outputs` API without any modifications. This +/// package model to the `conda/outputs` API without any modifications. This /// backend is useful for testing and debugging purposes, as it does not perform -/// any actual building or processing of the project model. +/// any actual building or processing of the package model. pub struct PassthroughBackend { - project_model: PackageModelV1, + package_model: PackageModel, config: PassthroughBackendConfig, source_dir: PathBuf, index_json: Option, @@ -72,7 +72,7 @@ impl InMemoryBackend for PassthroughBackend { outputs: vec![CondaOutput { metadata: CondaOutputMetadata { name: self - .project_model + .package_model .name .as_ref() .map(|name| PackageName::try_from(name.as_str()).unwrap()) @@ -85,7 +85,7 @@ impl InMemoryBackend for PassthroughBackend { }) }), version: self - .project_model + .package_model .version .as_ref() .or_else(|| self.index_json.as_ref().map(|j| j.version.version())) @@ -108,7 +108,7 @@ impl InMemoryBackend for PassthroughBackend { .and_then(|j| j.subdir.as_deref()) .map(|subdir| subdir.parse().unwrap()) .unwrap_or(Platform::NoArch), - license: self.project_model.license.clone(), + license: self.package_model.license.clone(), license_family: None, noarch: self .index_json @@ -120,17 +120,17 @@ impl InMemoryBackend for PassthroughBackend { variant: Default::default(), }, build_dependencies: Some(extract_dependencies( - &self.project_model.targets, + &self.package_model.targets, |t| t.build_dependencies.as_ref(), params.host_platform, )), host_dependencies: Some(extract_dependencies( - &self.project_model.targets, + &self.package_model.targets, |t| t.host_dependencies.as_ref(), params.host_platform, )), run_dependencies: extract_dependencies( - &self.project_model.targets, + &self.package_model.targets, |t| t.run_dependencies.as_ref(), params.host_platform, ), @@ -232,13 +232,10 @@ impl InMemoryBackendInstantiator for PassthroughBackendInstantiator { &self, params: InitializeParams, ) -> Result> { - let project_model = match params.project_model { - Some(VersionedPackageModel::V1(project_model)) => project_model, - _ => { - return Err(Box::new(CommunicationError::BackendError( - BackendError::new("Passthrough backend only supports project model v1"), - ))); - } + let Some(package_model) = params.package_model else { + return Err(Box::new(CommunicationError::BackendError( + BackendError::new("Passthrough backend requires a package model"), + ))); }; let config = match params.configuration { @@ -269,7 +266,7 @@ impl InMemoryBackendInstantiator for PassthroughBackendInstantiator { }; Ok(PassthroughBackend { - project_model, + package_model, config, source_dir, index_json, diff --git a/crates/pixi_build_discovery/src/discovery.rs b/crates/pixi_build_discovery/src/discovery.rs index 06cc32c62a..c38bf55c48 100644 --- a/crates/pixi_build_discovery/src/discovery.rs +++ b/crates/pixi_build_discovery/src/discovery.rs @@ -6,8 +6,8 @@ use std::{ use itertools::Itertools; use miette::Diagnostic; use ordermap::OrderMap; -use pixi_build_type_conversions::{to_package_model_v1, to_target_selector_v1}; -use pixi_build_types::{PackageModelV1, TargetSelectorV1}; +use pixi_build_type_conversions::{to_package_model, to_target_selector_v1}; +use pixi_build_types::{PackageModel, TargetSelectorV1}; use pixi_config::Config; use pixi_manifest::{ DiscoveryStart, ExplicitManifestError, PackageManifest, PrioritizedChannel, WithProvenance, @@ -57,8 +57,8 @@ pub struct BackendInitializationParams { /// The absolute path of the discovered manifest pub manifest_path: PathBuf, - /// Optionally, the manifest of the discovered package. - pub project_model: Option, + /// Optionally, the package model of the discovered package. + pub package_model: Option, /// Additional configuration that applies to the backend. pub configuration: Option, @@ -205,7 +205,7 @@ impl DiscoveredBackend { source: None, source_anchor: source_dir, manifest_path: recipe_absolute_path, - project_model: None, + package_model: None, configuration: None, target_configuration: None, }, @@ -232,8 +232,8 @@ impl DiscoveredBackend { .expect("workspace manifest should have a parent directory") .to_path_buf(); - // Construct the project model from the manifest - let project_model = to_package_model_v1(package_manifest, channel_config)?; + // Construct the package model from the manifest + let package_model = to_package_model(package_manifest, channel_config)?; // Determine the build system requirements. let build_system = package_manifest.build.clone(); @@ -279,7 +279,7 @@ impl DiscoveredBackend { .parent() .expect("points to a file") .to_path_buf(), - project_model: Some(project_model), + package_model: Some(package_model), configuration: build_system.config.map(|config| { config .deserialize_into() @@ -377,7 +377,7 @@ impl DiscoveredBackend { source: None, source_anchor: source_dir, manifest_path: package_xml_absolute_path, - project_model: Some(PackageModelV1::default()), + package_model: Some(PackageModel::default()), configuration: None, target_configuration: None, }, diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__direct_package_xml.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__direct_package_xml.snap index a1471f9f8b..12218f8ebd 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__direct_package_xml.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__direct_package_xml.snap @@ -17,7 +17,7 @@ init-params: source: ~ source-anchor: "file:///ros-package" manifest-path: "file:///ros-package/package.xml" - project-model: + package-model: name: ~ version: ~ description: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__direct_recipe.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__direct_recipe.snap index 5f80b4fb51..060f2b45d7 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__direct_recipe.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__direct_recipe.snap @@ -17,6 +17,6 @@ init-params: source: ~ source-anchor: "file:///recipe_yaml" manifest-path: "file:///recipe_yaml/recipe.yaml" - project-model: ~ + package-model: ~ configuration: ~ target-configuration: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@inherit__nested.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@inherit__nested.snap index f26b3fc037..30bdb0160e 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@inherit__nested.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@inherit__nested.snap @@ -18,7 +18,7 @@ init-params: source: ~ source-anchor: "file:///inherit/nested" manifest-path: "file:///inherit/nested/pixi.toml" - project-model: + package-model: name: simple version: 0.1.0 description: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested__nested.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested__nested.snap index e72a7a0103..b750bb12ee 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested__nested.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested__nested.snap @@ -18,7 +18,7 @@ init-params: source: ~ source-anchor: "file:///nested/nested" manifest-path: "file:///nested/nested/pixi.toml" - project-model: + package-model: name: simple version: 0.1.0 description: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested_recipe_yml.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested_recipe_yml.snap index ed10f8a182..dc294ad584 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested_recipe_yml.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@nested_recipe_yml.snap @@ -18,6 +18,6 @@ init-params: source: ~ source-anchor: "file:///nested_recipe_yml" manifest-path: "file:///nested_recipe_yml/recipe/recipe.yml" - project-model: ~ + package-model: ~ configuration: ~ target-configuration: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yaml.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yaml.snap index b999c8a58b..9788ecc5e8 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yaml.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yaml.snap @@ -18,6 +18,6 @@ init-params: source: ~ source-anchor: "file:///recipe_yaml" manifest-path: "file:///recipe_yaml/recipe.yaml" - project-model: ~ + package-model: ~ configuration: ~ target-configuration: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yml.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yml.snap index eb73a4c1ef..ea6886c577 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yml.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@recipe_yml.snap @@ -18,6 +18,6 @@ init-params: source: ~ source-anchor: "file:///recipe_yml" manifest-path: "file:///recipe_yml/recipe.yml" - project-model: ~ + package-model: ~ configuration: ~ target-configuration: ~ diff --git a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@simple.snap b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@simple.snap index 1975d68310..3ca92476c4 100644 --- a/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@simple.snap +++ b/crates/pixi_build_discovery/tests/snapshots/discovery__discovery@simple.snap @@ -18,7 +18,7 @@ init-params: source: ~ source-anchor: "file:///simple" manifest-path: "file:///simple/pixi.toml" - project-model: + package-model: name: simple version: 0.1.0 description: ~ diff --git a/crates/pixi_build_frontend/src/backend/json_rpc.rs b/crates/pixi_build_frontend/src/backend/json_rpc.rs index 95f76f2f57..7ce3b7faff 100644 --- a/crates/pixi_build_frontend/src/backend/json_rpc.rs +++ b/crates/pixi_build_frontend/src/backend/json_rpc.rs @@ -14,8 +14,7 @@ use jsonrpsee::{ use miette::Diagnostic; use ordermap::OrderMap; use pixi_build_types::{ - BackendCapabilities, FrontendCapabilities, PackageModelV1, TargetSelectorV1, - VersionedPackageModel, + BackendCapabilities, FrontendCapabilities, PackageModel, TargetSelectorV1, procedures::{ self, conda_build_v1::{CondaBuildV1Params, CondaBuildV1Result}, @@ -146,7 +145,7 @@ impl JsonRpcBackend { source_dir: PathBuf, manifest_path: PathBuf, workspace_root: PathBuf, - package_manifest: Option, + package_model: Option, configuration: Option, target_configuration: Option>, cache_dir: Option, @@ -196,7 +195,7 @@ impl JsonRpcBackend { source_dir, manifest_path, workspace_root, - package_manifest, + package_model, configuration, target_configuration, cache_dir, @@ -215,7 +214,7 @@ impl JsonRpcBackend { source_dir: PathBuf, manifest_path: PathBuf, workspace_root: PathBuf, - project_model: Option, + package_model: Option, configuration: Option, target_configuration: Option>, cache_dir: Option, @@ -252,7 +251,7 @@ impl JsonRpcBackend { .request( procedures::initialize::METHOD_NAME, RpcParams::from(InitializeParams { - project_model: project_model.map(VersionedPackageModel::V1), + package_model, configuration, target_configuration, manifest_path: manifest_path.clone(), diff --git a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_cpp.snap b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_cpp.snap index 90a49d5d05..ec5fb208df 100644 --- a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_cpp.snap +++ b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_cpp.snap @@ -1,6 +1,6 @@ --- source: crates/pixi_build_frontend/src/into_build_types.rs -expression: project_model +expression: package_model --- { "name": "python_bindings", diff --git a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_python.snap b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_python.snap index 2152e500b8..e774ec0c76 100644 --- a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_python.snap +++ b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_python.snap @@ -1,6 +1,6 @@ --- source: crates/pixi_build_frontend/src/into_build_types.rs -expression: project_model +expression: package_model --- { "name": "rich_example", diff --git a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_workspace.snap b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_workspace.snap index 2152e500b8..e774ec0c76 100644 --- a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_workspace.snap +++ b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_docs@pixi_build_workspace.snap @@ -1,6 +1,6 @@ --- source: crates/pixi_build_frontend/src/into_build_types.rs -expression: project_model +expression: package_model --- { "name": "rich_example", diff --git a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@boltons.snap b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@boltons.snap index fb65f4ff13..bdc15bd048 100644 --- a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@boltons.snap +++ b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@boltons.snap @@ -1,6 +1,6 @@ --- source: crates/pixi_build_frontend/src/into_build_types.rs -expression: project_model +expression: package_model --- { "name": "boltons", diff --git a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@cpp-sdl.snap b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@cpp-sdl.snap index 2cad6ea6e0..b3a0237940 100644 --- a/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@cpp-sdl.snap +++ b/crates/pixi_build_frontend/src/snapshots/pixi_build_frontend__into_build_types__tests__conversions_v1_examples@cpp-sdl.snap @@ -1,6 +1,6 @@ --- source: crates/pixi_build_frontend/src/into_build_types.rs -expression: project_model +expression: package_model --- { "name": "sdl_example", diff --git a/crates/pixi_build_type_conversions/src/lib.rs b/crates/pixi_build_type_conversions/src/lib.rs index 6e2c2d7404..c0321af408 100644 --- a/crates/pixi_build_type_conversions/src/lib.rs +++ b/crates/pixi_build_type_conversions/src/lib.rs @@ -1,3 +1,3 @@ mod project_model; -pub use project_model::{to_package_model_v1, to_target_selector_v1}; +pub use project_model::{to_package_model, to_target_selector_v1}; diff --git a/crates/pixi_build_type_conversions/src/project_model.rs b/crates/pixi_build_type_conversions/src/project_model.rs index 3599ef904f..2775465121 100644 --- a/crates/pixi_build_type_conversions/src/project_model.rs +++ b/crates/pixi_build_type_conversions/src/project_model.rs @@ -163,12 +163,12 @@ fn to_targets_v1( }) } -/// Converts a [`PackageManifest`] to a [`pbt::PackageModelV1`]. -pub fn to_package_model_v1( +/// Converts a [`PackageManifest`] to a [`pbt::PackageModel`]. +pub fn to_package_model( manifest: &PackageManifest, channel_config: &ChannelConfig, -) -> Result { - let project = pbt::PackageModelV1 { +) -> Result { + let project = pbt::PackageModel { name: manifest.package.name.clone(), version: manifest.package.version.clone(), description: manifest.package.description.clone(), @@ -188,7 +188,6 @@ pub fn to_package_model_v1( mod tests { use std::path::PathBuf; - use pixi_build_types::VersionedPackageModel; use rattler_conda_types::ChannelConfig; use rstest::rstest; @@ -220,15 +219,14 @@ mod tests { .and_then(OsStr::to_str) .unwrap(); - // Convert the manifest to the project model - let project_model: VersionedPackageModel = - super::to_package_model_v1(&package_manifest.value, &some_channel_config()) - .unwrap() - .into(); + // Convert the manifest to the package model + let package_model = + super::to_package_model(&package_manifest.value, &some_channel_config()) + .unwrap(); let mut settings = insta::Settings::clone_current(); settings.set_snapshot_suffix(name); settings.bind(|| { - insta::assert_json_snapshot!(project_model); + insta::assert_json_snapshot!(package_model); }); } }}; diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_cpp.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_cpp.snap index 42c45fb6b0..cd4fc9cde2 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_cpp.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_cpp.snap @@ -1,27 +1,24 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "cpp_math", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": {}, - "buildDependencies": {}, - "runDependencies": {} - }, - "targets": {} - } + "name": "cpp_math", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": {}, + "buildDependencies": {}, + "runDependencies": {} + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_python.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_python.snap index cab0bb13f8..df10ba9e08 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_python.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@advanced_python.snap @@ -1,27 +1,24 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "rich_example", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": {}, - "buildDependencies": {}, - "runDependencies": {} - }, - "targets": {} - } + "name": "rich_example", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": {}, + "buildDependencies": {}, + "runDependencies": {} + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@cpp.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@cpp.snap index b5e3947b63..de539e08ab 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@cpp.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@cpp.snap @@ -1,70 +1,67 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "cpp_math", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": { - "cmake": { - "binary": { - "version": "3.20.*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } - }, - "nanobind": { - "binary": { - "version": "2.4.*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } - }, - "python": { - "binary": { - "version": "3.12.*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } + "name": "cpp_math", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": { + "cmake": { + "binary": { + "version": "3.20.*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null } }, - "buildDependencies": {}, - "runDependencies": {} + "nanobind": { + "binary": { + "version": "2.4.*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null + } + }, + "python": { + "binary": { + "version": "3.12.*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null + } + } }, - "targets": {} - } + "buildDependencies": {}, + "runDependencies": {} + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@getting_started.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@getting_started.snap index 9379b82def..682f8291d8 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@getting_started.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@getting_started.snap @@ -1,58 +1,55 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model snapshot_kind: text --- { - "version": "1", - "data": { - "name": "python_rich", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": { - "hatchling": { - "binary": { - "version": "*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } - } - }, - "buildDependencies": {}, - "runDependencies": { - "rich": { - "binary": { - "version": "13.9.*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } + "name": "python_rich", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": { + "hatchling": { + "binary": { + "version": "*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null } } }, - "targets": {} - } + "buildDependencies": {}, + "runDependencies": { + "rich": { + "binary": { + "version": "13.9.*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null + } + } + } + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@python.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@python.snap index 31ac10f757..418b6f2770 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@python.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@python.snap @@ -1,57 +1,54 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "python_rich", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": { - "hatchling": { - "binary": { - "version": "==1.26.3", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } - } - }, - "buildDependencies": {}, - "runDependencies": { - "rich": { - "binary": { - "version": "13.9.*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } + "name": "python_rich", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": { + "hatchling": { + "binary": { + "version": "==1.26.3", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null } } }, - "targets": {} - } + "buildDependencies": {}, + "runDependencies": { + "rich": { + "binary": { + "version": "13.9.*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null + } + } + } + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace.snap index 5139394a89..146e2ce62e 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace.snap @@ -1,64 +1,61 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "python_rich", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": { - "hatchling": { - "binary": { - "version": "==1.26.3", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null + "name": "python_rich", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": { + "hatchling": { + "binary": { + "version": "==1.26.3", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null + } + } + }, + "buildDependencies": {}, + "runDependencies": { + "cpp_math": { + "source": { + "Path": { + "path": "packages/cpp_math" } } }, - "buildDependencies": {}, - "runDependencies": { - "cpp_math": { - "source": { - "Path": { - "path": "packages/cpp_math" - } - } - }, - "rich": { - "binary": { - "version": "13.9.*", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } + "rich": { + "binary": { + "version": "13.9.*", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null } } - }, - "targets": {} - } + } + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace_variants.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace_variants.snap index c4268bf53a..ec416a52f4 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace_variants.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_docs@workspace_variants.snap @@ -1,64 +1,61 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "python_rich", - "version": "0.1.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": { - "hatchling": { - "binary": { - "version": "==1.26.3", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null + "name": "python_rich", + "version": "0.1.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": { + "hatchling": { + "binary": { + "version": "==1.26.3", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null + } + } + }, + "buildDependencies": {}, + "runDependencies": { + "cpp_math": { + "source": { + "Path": { + "path": "packages/cpp_math" } } }, - "buildDependencies": {}, - "runDependencies": { - "cpp_math": { - "source": { - "Path": { - "path": "packages/cpp_math" - } - } - }, - "rich": { - "binary": { - "version": ">=13.9.4,<14", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } + "rich": { + "binary": { + "version": ">=13.9.4,<14", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null } } - }, - "targets": {} - } + } + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@array-api-extra.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@array-api-extra.snap index 55e7aa78be..07536ad3d7 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@array-api-extra.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@array-api-extra.snap @@ -1,27 +1,24 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "array-api-extra", - "version": "0.8.0", - "description": null, - "authors": null, - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": {}, - "buildDependencies": {}, - "runDependencies": {} - }, - "targets": {} - } + "name": "array-api-extra", + "version": "0.8.0", + "description": null, + "authors": null, + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": {}, + "buildDependencies": {}, + "runDependencies": {} + }, + "targets": {} } } diff --git a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@cpp-sdl.snap b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@cpp-sdl.snap index 9881fa4641..0149e028a9 100644 --- a/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@cpp-sdl.snap +++ b/crates/pixi_build_type_conversions/src/snapshots/pixi_build_type_conversions__project_model__tests__conversions_v1_examples@cpp-sdl.snap @@ -1,44 +1,41 @@ --- source: crates/pixi_build_type_conversions/src/project_model.rs -expression: project_model +expression: package_model --- { - "version": "1", - "data": { - "name": "sdl_example", - "version": "0.1.0", - "description": "Showcases how to create a simple C++ executable with Pixi", - "authors": [ - "Bas Zalmstra " - ], - "license": null, - "licenseFile": null, - "readme": null, - "homepage": null, - "repository": null, - "documentation": null, - "targets": { - "defaultTarget": { - "hostDependencies": { - "sdl2": { - "binary": { - "version": ">=2.26.5,<3.0", - "build": null, - "buildNumber": null, - "fileName": null, - "channel": null, - "subdir": null, - "md5": null, - "sha256": null, - "url": null, - "license": null - } + "name": "sdl_example", + "version": "0.1.0", + "description": "Showcases how to create a simple C++ executable with Pixi", + "authors": [ + "Bas Zalmstra " + ], + "license": null, + "licenseFile": null, + "readme": null, + "homepage": null, + "repository": null, + "documentation": null, + "targets": { + "defaultTarget": { + "hostDependencies": { + "sdl2": { + "binary": { + "version": ">=2.26.5,<3.0", + "build": null, + "buildNumber": null, + "fileName": null, + "channel": null, + "subdir": null, + "md5": null, + "sha256": null, + "url": null, + "license": null } - }, - "buildDependencies": {}, - "runDependencies": {} + } }, - "targets": {} - } + "buildDependencies": {}, + "runDependencies": {} + }, + "targets": {} } } diff --git a/crates/pixi_build_types/src/lib.rs b/crates/pixi_build_types/src/lib.rs index 0487d87d7d..f425ed2b7e 100644 --- a/crates/pixi_build_types/src/lib.rs +++ b/crates/pixi_build_types/src/lib.rs @@ -11,9 +11,9 @@ pub use capabilities::{BackendCapabilities, FrontendCapabilities}; pub use channel_configuration::ChannelConfiguration; pub use conda_package_metadata::CondaPackageMetadata; pub use project_model::{ - BinaryPackageSpecV1, GitReferenceV1, GitSpecV1, NamedSpecV1, PackageModelV1, PackageSpecV1, + BinaryPackageSpecV1, GitReferenceV1, GitSpecV1, NamedSpecV1, PackageModel, PackageSpecV1, PathSpecV1, SourcePackageName, SourcePackageSpecV1, TargetSelectorV1, TargetV1, TargetsV1, - UrlSpecV1, VersionedPackageModel, + UrlSpecV1, }; use rattler_conda_types::{ GenericVirtualPackage, PackageName, Platform, Version, VersionSpec, @@ -24,14 +24,15 @@ use serde::{Deserialize, Serialize}; // Version 0: Initial version (removed) // Version 1: Added conda/outputs and conda/build_v1 // Version 2: Name in project models can be `None`. +// Version 3: Package model unversioned and negotiated by API version only. /// The constraint for the pixi build api version package /// Adding this constraint when solving a pixi build backend environment ensures /// that a backend is selected that uses the same interface version as Pixi does pub static PIXI_BUILD_API_VERSION_NAME: LazyLock = LazyLock::new(|| PackageName::new_unchecked("pixi-build-api-version")); -pub const PIXI_BUILD_API_VERSION_LOWER: u64 = 1; -pub const PIXI_BUILD_API_VERSION_CURRENT: u64 = 2; +pub const PIXI_BUILD_API_VERSION_LOWER: u64 = 3; +pub const PIXI_BUILD_API_VERSION_CURRENT: u64 = 3; pub const PIXI_BUILD_API_VERSION_UPPER: u64 = PIXI_BUILD_API_VERSION_CURRENT + 1; pub static PIXI_BUILD_API_VERSION_SPEC: LazyLock = LazyLock::new(|| { VersionSpec::Group( @@ -84,6 +85,9 @@ impl PixiBuildApiVersion { 2 => BackendCapabilities { ..Self(1).expected_backend_capabilities() }, + 3 => BackendCapabilities { + ..Self(2).expected_backend_capabilities() + }, _ => BackendCapabilities::default(), } } diff --git a/crates/pixi_build_types/src/procedures/initialize.rs b/crates/pixi_build_types/src/procedures/initialize.rs index b472c12a38..ed0008edcc 100644 --- a/crates/pixi_build_types/src/procedures/initialize.rs +++ b/crates/pixi_build_types/src/procedures/initialize.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use ordermap::OrderMap; use serde::{Deserialize, Serialize}; -use crate::{TargetSelectorV1, VersionedPackageModel}; +use crate::{PackageModel, TargetSelectorV1}; pub const METHOD_NAME: &str = "initialize"; @@ -45,10 +45,10 @@ pub struct InitializeParams { /// Optionally the cache directory to use for any caching activity. pub cache_directory: Option, - /// Project model that the backend should use even though it is an option + /// Package model that the backend should use even though it is an option /// it is highly recommended to use this field. Otherwise, it will be very /// easy to break backwards compatibility. - pub project_model: Option, + pub package_model: Option, /// Backend specific configuration passed from the frontend to the backend. pub configuration: Option, diff --git a/crates/pixi_build_types/src/project_model.rs b/crates/pixi_build_types/src/project_model.rs index 2dc7ff73f2..d59100a03c 100644 --- a/crates/pixi_build_types/src/project_model.rs +++ b/crates/pixi_build_types/src/project_model.rs @@ -9,15 +9,6 @@ //! that we try not to break this in pixi as much as possible. So as long as //! older pixi TOMLs keep loading, we can send them to the backend. //! -//! In regards to forwards compatibility, we want to be able to keep converting -//! to all versions of the `VersionedProjectModel` as much as possible. -//! -//! This is why we append a `V{version}` to the type names, to indicate the -//! version of the protocol. -//! -//! Only the whole ProjectModel is versioned explicitly in an enum. -//! When making a change to one of the types, be sure to add another enum -//! declaration if it is breaking. use std::{convert::Infallible, fmt::Display, hash::Hash, path::PathBuf, str::FromStr}; use ordermap::OrderMap; @@ -28,50 +19,12 @@ use serde::{Deserialize, Serialize}; use serde_with::{DeserializeFromStr, DisplayFromStr, SerializeDisplay, serde_as}; use url::Url; -/// Enum containing all versions of the project model. -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(tag = "version", content = "data")] -#[serde(rename_all = "camelCase")] -pub enum VersionedPackageModel { - /// Version 1 of the project model. - #[serde(rename = "1")] - V1(PackageModelV1), - // When adding don't forget to update the highest_version function -} - -impl VersionedPackageModel { - /// Highest version of the project model. - pub fn highest_version() -> u32 { - // increase this when adding a new version - 1 - } - - /// Move into the v1 type, returns None if the version is not v1. - pub fn into_v1(self) -> Option { - match self { - VersionedPackageModel::V1(v) => Some(v), - // Add this once we have more versions - //_ => None, - } - } - - /// Returns a reference to the v1 type, returns None if the version is not - /// v1. - pub fn as_v1(&self) -> Option<&PackageModelV1> { - match self { - VersionedPackageModel::V1(v) => Some(v), - // Add this once we have more versions - //_ => None, - } - } -} - /// The source package name of a package. Not normalized per se. pub type SourcePackageName = String; #[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] -pub struct PackageModelV1 { +pub struct PackageModel { /// The name of the project pub name: Option, @@ -107,7 +60,7 @@ pub struct PackageModelV1 { pub targets: Option, } -impl IsDefault for PackageModelV1 { +impl IsDefault for PackageModel { type Item = Self; fn is_non_default(&self) -> Option<&Self::Item> { @@ -115,12 +68,6 @@ impl IsDefault for PackageModelV1 { } } -impl From for VersionedPackageModel { - fn from(value: PackageModelV1) -> Self { - VersionedPackageModel::V1(value) - } -} - /// Represents a target selector. Currently, we only support explicit platform /// selection. #[derive(Debug, Clone, DeserializeFromStr, SerializeDisplay, Eq, PartialEq)] @@ -415,12 +362,12 @@ impl std::fmt::Debug for BinaryPackageSpecV1 { } // Custom Hash implementations that skip default values for stability -impl Hash for PackageModelV1 { +impl Hash for PackageModel { /// Custom hash implementation using StableHashBuilder to ensure different /// field configurations produce different hashes while maintaining /// forward/backward compatibility. fn hash(&self, state: &mut H) { - let PackageModelV1 { + let PackageModel { name, version, description, @@ -644,8 +591,8 @@ mod tests { #[test] fn test_hash_stability_with_default_values() { - // Create a minimal PackageModelV1 instance - let mut project_model = PackageModelV1 { + // Create a minimal PackageModel instance + let mut package_model = PackageModel { name: Some("test-project".to_string()), version: None, description: None, @@ -659,16 +606,16 @@ mod tests { targets: None, }; - let hash1 = calculate_hash(&project_model); + let hash1 = calculate_hash(&package_model); // Add empty targets field - with corrected implementation, this should NOT // change hash because we only include discriminants for // non-default/non-empty values - project_model.targets = Some(TargetsV1 { + package_model.targets = Some(TargetsV1 { default_target: None, targets: Some(OrderMap::new()), }); - let hash2 = calculate_hash(&project_model); + let hash2 = calculate_hash(&package_model); // Add a target with empty dependencies - this should also NOT change hash let empty_target = TargetV1 { @@ -676,11 +623,11 @@ mod tests { build_dependencies: Some(OrderMap::new()), run_dependencies: Some(OrderMap::new()), }; - project_model.targets = Some(TargetsV1 { + package_model.targets = Some(TargetsV1 { default_target: Some(empty_target), targets: Some(OrderMap::new()), }); - let hash3 = calculate_hash(&project_model); + let hash3 = calculate_hash(&package_model); // With corrected implementation, hashes should remain stable when adding // empty/default values This preserves forward/backward compatibility @@ -700,8 +647,8 @@ mod tests { #[test] fn test_hash_changes_with_meaningful_values() { - // Create a minimal PackageModelV1 instance - let mut project_model = PackageModelV1 { + // Create a minimal PackageModel instance + let mut package_model = PackageModel { name: Some("test-project".to_string()), version: None, description: None, @@ -715,11 +662,11 @@ mod tests { targets: None, }; - let hash1 = calculate_hash(&project_model); + let hash1 = calculate_hash(&package_model); // Add a meaningful field (should change hash) - project_model.description = Some("A test project".to_string()); - let hash2 = calculate_hash(&project_model); + package_model.description = Some("A test project".to_string()); + let hash2 = calculate_hash(&package_model); // Add a real dependency (should change hash) let mut deps = OrderMap::new(); @@ -730,11 +677,11 @@ mod tests { build_dependencies: Some(OrderMap::new()), run_dependencies: Some(OrderMap::new()), }; - project_model.targets = Some(TargetsV1 { + package_model.targets = Some(TargetsV1 { default_target: Some(target_with_deps), targets: Some(OrderMap::new()), }); - let hash3 = calculate_hash(&project_model); + let hash3 = calculate_hash(&package_model); // Hash should change when adding meaningful values assert_ne!(hash1, hash2, "Hash should change when adding description"); @@ -994,28 +941,28 @@ mod tests { } #[test] - fn test_hash_collision_bug_project_model() { - // Test the same issue in PackageModelV1 - let project1 = PackageModelV1 { + fn test_hash_collision_bug_package_model() { + // Test the same issue in PackageModel + let package1 = PackageModel { name: Some("test".to_string()), description: Some("test description".to_string()), license: None, ..Default::default() }; - let project2 = PackageModelV1 { + let package2 = PackageModel { name: Some("test".to_string()), description: None, license: Some("test description".to_string()), ..Default::default() }; - let hash1 = calculate_hash(&project1); - let hash2 = calculate_hash(&project2); + let hash1 = calculate_hash(&package1); + let hash2 = calculate_hash(&package2); assert_ne!( hash1, hash2, - "Same value in different fields should produce different hashes in PackageModelV1" + "Same value in different fields should produce different hashes in PackageModel" ); } } diff --git a/crates/pixi_command_dispatcher/src/build/build_cache.rs b/crates/pixi_command_dispatcher/src/build/build_cache.rs index d71153a46a..30c18f6ed2 100644 --- a/crates/pixi_command_dispatcher/src/build/build_cache.rs +++ b/crates/pixi_command_dispatcher/src/build/build_cache.rs @@ -9,7 +9,7 @@ use async_fd_lock::{LockWrite, RwLockWriteGuard}; use base64::{Engine, engine::general_purpose::URL_SAFE_NO_PAD}; use ordermap::OrderMap; use pixi_build_discovery::{BackendInitializationParams, DiscoveredBackend}; -use pixi_build_types::{PackageModelV1, TargetSelectorV1}; +use pixi_build_types::{PackageModel, TargetSelectorV1}; use pixi_record::PinnedSourceSpec; use pixi_stable_hash::{StableHashBuilder, json::StableJson, map::StableMap}; use rattler_conda_types::{ChannelUrl, GenericVirtualPackage, Platform, RepoDataRecord}; @@ -316,8 +316,8 @@ impl BuildCacheEntry { /// This is used to compute a singular hash that changes when a rebuild is /// warranted. pub struct PackageBuildInputHashBuilder<'a> { - /// The project model itself. Contains dependencies and more. - pub project_model: Option<&'a PackageModelV1>, + /// The package model itself. Contains dependencies and more. + pub package_model: Option<&'a PackageModel>, /// The backend specific configuration pub configuration: Option<&'a serde_json::Value>, @@ -330,7 +330,7 @@ impl PackageBuildInputHashBuilder<'_> { pub fn finish(self) -> PackageBuildInputHash { let mut hasher = Xxh3::new(); StableHashBuilder::new() - .field("project_model", &self.project_model) + .field("package_model", &self.package_model) .field("configuration", &self.configuration.map(StableJson::new)) .field( "target_configuration", @@ -350,7 +350,7 @@ pub struct PackageBuildInputHash(u64); impl<'a> From<&'a DiscoveredBackend> for PackageBuildInputHash { fn from(value: &'a DiscoveredBackend) -> Self { let BackendInitializationParams { - project_model, + package_model, configuration, target_configuration, @@ -362,7 +362,7 @@ impl<'a> From<&'a DiscoveredBackend> for PackageBuildInputHash { } = &value.init_params; PackageBuildInputHashBuilder { - project_model: project_model.as_ref(), + package_model: package_model.as_ref(), configuration: configuration.as_ref(), target_configuration: target_configuration.as_ref(), } diff --git a/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs b/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs index 21dab18b35..a5d2d32a75 100644 --- a/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs +++ b/crates/pixi_command_dispatcher/src/build_backend_metadata/mod.rs @@ -11,7 +11,7 @@ use once_cell::sync::Lazy; use pathdiff::diff_paths; use pixi_build_discovery::{CommandSpec, EnabledProtocols}; use pixi_build_frontend::Backend; -use pixi_build_types::{PackageModelV1, procedures::conda_outputs::CondaOutputsParams}; +use pixi_build_types::{PackageModel, procedures::conda_outputs::CondaOutputsParams}; use pixi_glob::GlobHashKey; use pixi_record::{InputHash, PinnedSourceSpec}; use pixi_spec::{SourceAnchor, SourceSpec}; @@ -120,9 +120,9 @@ impl BuildBackendMetadataSpec { .await .map_err_with(BuildBackendMetadataError::Discovery)?; - // Calculate the hash of the project model + // Calculate the hash of the package model let additional_glob_hash = calculate_additional_glob_hash( - &discovered_backend.init_params.project_model, + &discovered_backend.init_params.package_model, &self.variants, ); @@ -488,12 +488,12 @@ pub enum BuildBackendMetadataError { /// Computes an additional hash to be used in glob hash pub fn calculate_additional_glob_hash( - project_model: &Option, + package_model: &Option, variants: &Option>>, ) -> Vec { let mut hasher = Xxh3::new(); - if let Some(project_model) = project_model { - project_model.hash(&mut hasher); + if let Some(package_model) = package_model { + package_model.hash(&mut hasher); } if let Some(variants) = variants { if !variants.is_empty() { diff --git a/crates/pixi_command_dispatcher/src/command_dispatcher/instantiate_backend.rs b/crates/pixi_command_dispatcher/src/command_dispatcher/instantiate_backend.rs index cb5a3ffabd..e8a27527e4 100644 --- a/crates/pixi_command_dispatcher/src/command_dispatcher/instantiate_backend.rs +++ b/crates/pixi_command_dispatcher/src/command_dispatcher/instantiate_backend.rs @@ -84,7 +84,7 @@ impl CommandDispatcher { source_dir: Some(source_dir), workspace_root: Some(spec.init_params.workspace_root), cache_directory: Some(self.cache_dirs().root().clone()), - project_model: spec.init_params.project_model.map(Into::into), + package_model: spec.init_params.package_model.map(Into::into), configuration: spec.init_params.configuration, target_configuration: spec.init_params.target_configuration, }) @@ -163,11 +163,11 @@ impl CommandDispatcher { api_version, ); - // Make sure that the project model is compatible with the API version. + // Make sure that the package model is compatible with the API version. if !api_version.supports_name_none() && spec .init_params - .project_model + .package_model .as_ref() .is_some_and(|p| p.name.is_none()) { @@ -180,7 +180,7 @@ impl CommandDispatcher { source_dir, spec.init_params.manifest_path, spec.init_params.workspace_root, - spec.init_params.project_model, + spec.init_params.package_model, spec.init_params.configuration, spec.init_params.target_configuration, Some(self.cache_dirs().root().clone()), diff --git a/crates/pixi_command_dispatcher/src/source_build_cache_status/mod.rs b/crates/pixi_command_dispatcher/src/source_build_cache_status/mod.rs index 544d7f80ff..2966c2bad7 100644 --- a/crates/pixi_command_dispatcher/src/source_build_cache_status/mod.rs +++ b/crates/pixi_command_dispatcher/src/source_build_cache_status/mod.rs @@ -334,7 +334,7 @@ impl SourceBuildCacheStatusSpec { // Compute a hash of the package configuration. let package_build_input_hash = PackageBuildInputHashBuilder { - project_model: backend.init_params.project_model.as_ref(), + package_model: backend.init_params.package_model.as_ref(), configuration: backend.init_params.configuration.as_ref(), target_configuration: backend.init_params.target_configuration.as_ref(), } diff --git a/crates/pixi_core/src/lock_file/satisfiability/mod.rs b/crates/pixi_core/src/lock_file/satisfiability/mod.rs index cfe809d1dd..6595b6a04f 100644 --- a/crates/pixi_core/src/lock_file/satisfiability/mod.rs +++ b/crates/pixi_core/src/lock_file/satisfiability/mod.rs @@ -1522,7 +1522,7 @@ pub(crate) async fn verify_package_platform_satisfiability( .map_err(|err| Box::new(err.into()))?; let additional_glob_hash = calculate_additional_glob_hash( - &discovered_backend.init_params.project_model, + &discovered_backend.init_params.package_model, &Some(variants), ); diff --git a/tests/data/channels/channels/backend_channel_1/noarch/backend-with-compatible-api-version-0.1.0-h4616a5c_0.conda b/tests/data/channels/channels/backend_channel_1/noarch/backend-with-compatible-api-version-0.1.0-h4616a5c_0.conda index da0c89d65358bf824ac632e14fca6dc101c4e756..9329da20a5ebd6d22297e407a5e0e6e0999fd03d 100644 GIT binary patch delta 521 zcmaFL@tlJrQ zJsub9Zx-!}&op1LHk$XRw)E4A9rJI`tvs(gcj6KKo6MS9+P(E2&3vx3FvG`3zqHvZ%Kv`Cg^amB++2;`s-H~p@xGX${FL{VwCd|cf(vYC&1vT| z+a!G@#FW{i@xY$%dp7M`_@F1bOmKliLvQlT``fhr3dLpi94}OR@Zj;9uafTB�H z9=g0|;xXqnOJ?3@vz{EyMt2>sY|;LgpD(gsWupVpc3 zq_7s&E=x#X6>)C|vqk86p67Y~vdOD%N_t*yXi((8u&$tc2|PI*j6FwIvi9F- zI>K%ztNeNaqmK_GPk=WglP)tnlA=#Dr0V^L0$v6Y28PKp%vPXyn;gkp50ALX518ZC ZU@-=x1H4(;Kyk?ogdxCK{mTU60RY5K%eDXj delta 518 zcmaFP@sxu%z?+#xmjMJs-2Eo*EKP-xP#G@!5j#A@9&KdX6w&UyPkLM z+pJ|%8aX^p-aKc$AgK8tv;WJ>i?#X#7%G49%ea4XxF(}qwOlp&h1O%KcPg%)S`{mM zo|_idhdtMvy|ZxFtFYUF`^D0Kn+Qd{e&4gW`!=@(v&X3fvF%biez$Wty;E&PU8^r& zE-3xO8?x_a%2LhQmFBZoK0dL=@cBCP2f6Kx%@x5v-+AxNQ7d1%_Vh#p`&k0BFFe_? zEJsb0@yms%*V(gqIq&^^Ya+DZxy8KryYGIosMZC}s6Q;Z;f;*=#1qF*(+=u*A=2o?gkQW$J1^qm-fDglWF`3~TE;W;caRch-CQ9>Zl_bOAIVGQ4`8)gh3xYwV*nf2Q9YiDozop+X~ zU}(8rHjh!zgD>-h1fx}^QD%?OLDG+ zjGHBj&t=4JQ?7Wv{j^(x*esce{&$n)IX#cGn+86cSg&v~K*d*OO@HjR&(#n289qt* zbMW^wV}%BfWiBo&nJR>&%;PpJ;b+c=6?iwejV*X6;93C#BrVNitzDVK8O5b#H2qqp;-4jaBc% zC-xXJG)jEV-^*Acby;>s@h_Vdk4~@%%zt;FP=zmMjc!uD#4jfQ>ul0buB^VabyL@; z$J)xuo9la)|DEyejn~urlhh^$U0+wL^;cAY&9A3X=aor-h*LwGj*-pb>C_+G)*Tyu}@aTlG9j5ej!+Zq{#YutXP>`|}uWb#azsXaYY45S+` z`*^KPzFFULZ`Zq@9Dc|ZD2QF{FYG}r=l3CzR#3jLNj2RrfiyfBhtcvD7!E%;6he14n z@g_q^etwLK?1R4Ki4HUP`Ko|v#i?%$yY6 z#DYv+s9s$|-3${mL$gHF55nKwONeDbI0nUi0Z*l+iVIW^0XiUN4k z-NUZR`SbL-Z7Xv;ykm+{)b(6?cq%*?v#Hhit+}vZS^!|VqGmdOXs}MhWK&gk}yLZ>^;~ev~Z`@n)m~TM{ zukoDSvZXzt#>SJDGBPUjC#)~NkXX?zL{FRu3oihf)JUoU-mGjOQ<;I# L2$+mlGl6&j9ym`# diff --git a/tests/data/channels/channels/backend_channel_1/noarch/pixi-build-api-version-3-h4616a5c_0.conda b/tests/data/channels/channels/backend_channel_1/noarch/pixi-build-api-version-3-h4616a5c_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..6b5dd3888fa4a00d2635406a681e35987bd1f779 GIT binary patch literal 1014 zcmWIWW@gc40D<<9xaiXise1pRfR{mpAvd)oF(t7iQ7@}FKaY_?fI$wdlmSjxD<$XW zr6k4|WT(fci?%$yY6 z#DYv+s9s%T-3${mL$gHFt8^i|d2xbL@4tjuHYDX}furG~fNcINfRd;ApN*Ry2x7psIufr3L$PE*!) zy$+Div1D=lx^?>#0S>X-ClrrfyLvP2(B4%FF>mAeR^DFqsQt?3TrD2sM*GJyrN=To z_*U9qIXcUN`>frMT_Oh-i3FWmzG@e5RrYRWVVzShJ=ZU-o9^BIWkzSCOuR~=l3>vO zRlByXeRuAAror1gGR6uG9?RTZt}u&FdC&gfrEqBvuR^KBL0+}FNmd6=KU8I1zGq>c zzQSZv^BWAY2beZ7uDG|iaArw^c++L+Ntf2fX+-#>MHuhvPD>EdCePg zR|?q^R?U+