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
71 changes: 60 additions & 11 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ pixi_core = { path = "crates/pixi_core" }
pixi_default_versions = { path = "crates/pixi_default_versions" }
pixi_git = { path = "crates/pixi_git" }
pixi_glob = { path = "crates/pixi_glob" }
pixi_global = { path = "crates/pixi_global" }
pixi_manifest = { path = "crates/pixi_manifest" }
pixi_progress = { path = "crates/pixi_progress" }
pixi_pypi_spec = { path = "crates/pixi_pypi_spec" }
Expand Down
1 change: 1 addition & 0 deletions crates/pixi_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pixi_config = { workspace = true }
pixi_consts = { workspace = true }
pixi_core = { workspace = true }
pixi_git = { workspace = true }
pixi_global = { workspace = true }
pixi_manifest = { workspace = true, features = ["rattler_lock"] }
pixi_progress = { workspace = true }
pixi_pypi_spec = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_cli/src/global/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::global::revert_environment_after_error;

use clap::Parser;
use pixi_config::{Config, ConfigCli};
use pixi_core::global::project::GlobalSpec;
use pixi_core::global::{EnvironmentName, Mapping, Project, StateChange, StateChanges};
use pixi_global::project::GlobalSpec;
use pixi_global::{EnvironmentName, Mapping, Project, StateChange, StateChanges};

/// Adds dependencies to an environment
///
Expand Down
2 changes: 1 addition & 1 deletion crates/pixi_cli/src/global/edit.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;
use fs_err as fs;
use miette::IntoDiagnostic;
use pixi_core::global::Project;
use pixi_global::Project;

/// Edit the global manifest file
///
Expand Down
10 changes: 5 additions & 5 deletions crates/pixi_cli/src/global/expose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use clap::Parser;
use itertools::Itertools;
use miette::Context;
use pixi_config::{Config, ConfigCli};
use pixi_global::{self, EnvironmentName, ExposedName, Mapping, StateChanges};

use crate::global::revert_environment_after_error;
use pixi_core::global::{self, EnvironmentName, ExposedName, Mapping, StateChanges};

/// Add exposed binaries from an environment to your global environment
///
Expand Down Expand Up @@ -71,13 +71,13 @@ pub async fn execute(args: SubCommand) -> miette::Result<()> {

pub async fn add(args: AddArgs) -> miette::Result<()> {
let config = Config::with_cli_config(&args.config);
let project_original = global::Project::discover_or_create()
let project_original = pixi_global::Project::discover_or_create()
.await?
.with_cli_config(config.clone());

async fn apply_changes(
args: &AddArgs,
project: &mut global::Project,
project: &mut pixi_global::Project,
) -> Result<StateChanges, miette::Error> {
let env_name = &args.environment;
let mut state_changes = StateChanges::new_with_env(env_name.clone());
Expand Down Expand Up @@ -110,14 +110,14 @@ pub async fn add(args: AddArgs) -> miette::Result<()> {

pub async fn remove(args: RemoveArgs) -> miette::Result<()> {
let config = Config::with_cli_config(&args.config);
let project_original = global::Project::discover_or_create()
let project_original = pixi_global::Project::discover_or_create()
.await?
.with_cli_config(config.clone());

async fn apply_changes(
exposed_name: &ExposedName,
env_name: &EnvironmentName,
project: &mut global::Project,
project: &mut pixi_global::Project,
) -> Result<StateChanges, miette::Error> {
let mut state_changes = StateChanges::new_with_env(env_name.clone());
project
Expand Down
31 changes: 12 additions & 19 deletions crates/pixi_cli/src/global/global_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use std::path::Path;

use clap::Parser;
use miette::Diagnostic;
use url::Url;

use pixi_consts::consts;
use pixi_core::global::project::FromMatchSpecError;
use pixi_global::project::FromMatchSpecError;
use pixi_spec::PixiSpec;
use rattler_conda_types::{ChannelConfig, MatchSpec, ParseMatchSpecError, ParseStrictness};
use typed_path::Utf8NativePathBuf;
use url::Url;

use crate::has_specs::HasSpecs;

Expand Down Expand Up @@ -57,7 +58,7 @@ pub enum GlobalSpecsConversionError {
AbsolutizePath(String),
#[error("failed to infer package name")]
#[diagnostic(transparent)]
PackageNameInference(#[from] pixi_core::global::project::InferPackageNameError),
PackageNameInference(#[from] pixi_global::project::InferPackageNameError),
}

impl GlobalSpecs {
Expand All @@ -66,8 +67,8 @@ impl GlobalSpecs {
&self,
channel_config: &ChannelConfig,
manifest_root: &Path,
project: &pixi_core::global::Project,
) -> Result<Vec<pixi_core::global::project::GlobalSpec>, GlobalSpecsConversionError> {
project: &pixi_global::Project,
) -> Result<Vec<pixi_global::project::GlobalSpec>, GlobalSpecsConversionError> {
let git_or_path_spec = if let Some(git_url) = &self.git {
let git_spec = pixi_spec::GitSpec {
git: git_url.clone(),
Expand Down Expand Up @@ -97,7 +98,7 @@ impl GlobalSpecs {
if self.specs.is_empty() {
// Infer the package name from the path/git spec
let inferred_name = project.infer_package_name_from_spec(&pixi_spec).await?;
return Ok(vec![pixi_core::global::project::GlobalSpec::new(
return Ok(vec![pixi_global::project::GlobalSpec::new(
inferred_name,
pixi_spec,
)]);
Expand All @@ -109,16 +110,14 @@ impl GlobalSpecs {
MatchSpec::from_str(spec_str, ParseStrictness::Lenient)?
.name
.ok_or(GlobalSpecsConversionError::NameRequired)
.map(|name| {
pixi_core::global::project::GlobalSpec::new(name, pixi_spec.clone())
})
.map(|name| pixi_global::project::GlobalSpec::new(name, pixi_spec.clone()))
})
.collect()
} else {
self.specs
.iter()
.map(|spec_str| {
pixi_core::global::project::GlobalSpec::try_from_str(spec_str, channel_config)
pixi_global::project::GlobalSpec::try_from_str(spec_str, channel_config)
.map_err(Box::new)
.map_err(GlobalSpecsConversionError::FromMatchSpec)
})
Expand Down Expand Up @@ -150,9 +149,7 @@ mod tests {

// Create a dummy project - this test doesn't use path/git specs so project
// won't be called
let project = pixi_core::global::Project::discover_or_create()
.await
.unwrap();
let project = pixi_global::Project::discover_or_create().await.unwrap();

let global_specs = specs
.to_global_specs(&channel_config, &manifest_root, &project)
Expand All @@ -177,9 +174,7 @@ mod tests {

// Create a dummy project - this test specifies a package name so inference
// won't be needed
let project = pixi_core::global::Project::discover_or_create()
.await
.unwrap();
let project = pixi_global::Project::discover_or_create().await.unwrap();

let global_specs = specs
.to_global_specs(&channel_config, &manifest_root, &project)
Expand Down Expand Up @@ -207,9 +202,7 @@ mod tests {
let manifest_root = PathBuf::from(".");

// Create a dummy project
let project = pixi_core::global::Project::discover_or_create()
.await
.unwrap();
let project = pixi_global::Project::discover_or_create().await.unwrap();

let global_specs = specs
.to_global_specs(&channel_config, &manifest_root, &project)
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_cli/src/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rattler_conda_types::{MatchSpec, NamedChannelOrUrl, Platform};

use crate::global::{global_specs::GlobalSpecs, revert_environment_after_error};
use pixi_config::{self, Config, ConfigCli};
use pixi_core::global::{
use pixi_global::{
self, EnvChanges, EnvState, EnvironmentName, Mapping, Project, StateChange, StateChanges,
common::{NotChangedReason, contains_menuinst_document},
list::list_all_global_environments,
Expand Down Expand Up @@ -78,7 +78,7 @@ pub struct Args {

pub async fn execute(args: Args) -> miette::Result<()> {
let config = Config::with_cli_config(&args.config);
let project_original = global::Project::discover_or_create()
let project_original = pixi_global::Project::discover_or_create()
.await?
.with_cli_config(config.clone());

Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_cli/src/global/list.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use clap::Parser;
use fancy_display::FancyDisplay;
use pixi_config::{Config, ConfigCli};
use pixi_core::global::list::{list_all_global_environments, list_specific_global_environment};
use pixi_core::global::{EnvironmentName, Project};
use pixi_global::list::{list_all_global_environments, list_specific_global_environment};
use pixi_global::{EnvironmentName, Project};
use std::str::FromStr;

/// Lists global environments with their dependencies and exposed commands. Can also display all packages within a specific global environment when using the --environment flag.
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_cli/src/global/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::Parser;

use pixi_core::global::{self, EnvironmentName};
use pixi_global::EnvironmentName;

mod add;
mod edit;
Expand Down Expand Up @@ -74,7 +74,7 @@ pub async fn execute(cmd: Args) -> miette::Result<()> {
/// Reverts the changes made to the project for a specific environment after an error occurred.
async fn revert_environment_after_error(
env_name: &EnvironmentName,
project_to_revert_to: &global::Project,
project_to_revert_to: &pixi_global::Project,
) -> miette::Result<()> {
if project_to_revert_to.environment(env_name).is_some() {
// We don't want to report on changes done by the reversion
Expand Down
2 changes: 1 addition & 1 deletion crates/pixi_cli/src/global/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Parser;
use itertools::Itertools;
use miette::Context;
use pixi_config::{Config, ConfigCli};
use pixi_core::global::{EnvironmentName, ExposedName, Project, StateChanges};
use pixi_global::{EnvironmentName, ExposedName, Project, StateChanges};
use rattler_conda_types::MatchSpec;
use std::str::FromStr;

Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_cli/src/global/shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use clap::Parser;
use fancy_display::FancyDisplay;
use miette::Context;
use pixi_config::{Config, ConfigCli};
use pixi_core::global::Project;
use pixi_core::global::{EnvironmentName, StateChanges};
use pixi_global::Project;
use pixi_global::{EnvironmentName, StateChanges};
use rattler_conda_types::PackageName;
use std::collections::HashMap;

Expand Down
Loading
Loading