Skip to content

Commit 816329d

Browse files
committed
Make some more types serializable
1 parent 62454c5 commit 816329d

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

crates/pixi_api/src/context.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ use std::collections::HashMap;
22

33
use indexmap::{IndexMap, IndexSet};
44
use miette::IntoDiagnostic;
5-
use pixi_core::workspace::{UpdateDeps, WorkspaceMut};
5+
use pixi_core::workspace::{PypiDeps, UpdateDeps, WorkspaceMut};
66
use pixi_core::{Workspace, environment::LockFileUsage};
77
use pixi_manifest::{
8-
EnvironmentName, Feature, FeatureName, PrioritizedChannel, TargetSelector, Task, TaskName,
8+
EnvironmentName, Feature, FeatureName, PrioritizedChannel, SpecType, TargetSelector, Task,
9+
TaskName,
910
};
1011
use pixi_pypi_spec::{PixiPypiSpec, PypiPackageName};
1112
use pixi_spec::PixiSpec;
@@ -143,8 +144,8 @@ impl<I: Interface> WorkspaceContext<I> {
143144

144145
pub async fn add_conda_deps(
145146
&self,
146-
specs: IndexMap<PackageName, rattler_conda_types::MatchSpec>,
147-
spec_type: pixi_manifest::SpecType,
147+
specs: IndexMap<PackageName, MatchSpec>,
148+
spec_type: SpecType,
148149
dep_options: DependencyOptions,
149150
git_options: GitOptions,
150151
) -> miette::Result<Option<UpdateDeps>> {
@@ -161,7 +162,7 @@ impl<I: Interface> WorkspaceContext<I> {
161162

162163
pub async fn add_pypi_deps(
163164
&self,
164-
pypi_deps: pixi_core::workspace::PypiDeps,
165+
pypi_deps: PypiDeps,
165166
editable: bool,
166167
options: DependencyOptions,
167168
) -> miette::Result<Option<UpdateDeps>> {
@@ -177,8 +178,8 @@ impl<I: Interface> WorkspaceContext<I> {
177178

178179
pub async fn remove_conda_deps(
179180
&self,
180-
specs: IndexMap<PackageName, rattler_conda_types::MatchSpec>,
181-
spec_type: pixi_manifest::SpecType,
181+
specs: IndexMap<PackageName, MatchSpec>,
182+
spec_type: SpecType,
182183
dep_options: DependencyOptions,
183184
) -> miette::Result<()> {
184185
crate::workspace::remove::remove_conda_deps(
@@ -193,7 +194,7 @@ impl<I: Interface> WorkspaceContext<I> {
193194

194195
pub async fn remove_pypi_deps(
195196
&self,
196-
pypi_deps: pixi_core::workspace::PypiDeps,
197+
pypi_deps: PypiDeps,
197198
options: DependencyOptions,
198199
) -> miette::Result<()> {
199200
crate::workspace::remove::remove_pypi_deps(

crates/pixi_api/src/workspace/add/options.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use pixi_core::environment::LockFileUsage;
22
use pixi_manifest::FeatureName;
33
use pixi_spec::GitReference;
44
use rattler_conda_types::Platform;
5+
use serde::{Deserialize, Serialize};
56
use url::Url;
67

7-
#[derive(Clone, Debug)]
8+
#[derive(Deserialize, Serialize, Clone, Debug)]
89
pub struct DependencyOptions {
910
/// The feature for which the dependency should be modified.
1011
pub feature: FeatureName,
@@ -15,7 +16,7 @@ pub struct DependencyOptions {
1516
pub lock_file_usage: LockFileUsage,
1617
}
1718

18-
#[derive(Clone, Debug)]
19+
#[derive(Deserialize, Serialize, Clone, Debug)]
1920
pub struct GitOptions {
2021
pub git: Option<Url>,
2122
pub reference: GitReference,

crates/pixi_manifest/src/spec_type.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1+
use serde::{Deserialize, Serialize};
2+
3+
#[derive(Deserialize, Serialize, Debug, Copy, Clone, Hash, PartialEq, Eq)]
24
/// What kind of dependency spec do we have
35
pub enum SpecType {
46
/// Host dependencies are used that are needed by the host environment when

0 commit comments

Comments
 (0)