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
12 changes: 9 additions & 3 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 crates/pixi/tests/integration_rust/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ impl PixiControl {
},
args.templated,
)
.await
.map_err(RunError::TaskGraphError)?;

// Iterate over all tasks in the graph and execute them.
Expand Down
13 changes: 12 additions & 1 deletion crates/pixi_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ license.workspace = true

[dependencies]
console = { workspace = true }
deno_task_shell = { workspace = true }
dunce = { workspace = true }
fancy_display = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
indexmap = { workspace = true }
itertools = { workspace = true }
Expand All @@ -24,21 +26,25 @@ pixi_consts = { workspace = true }
pixi_core = { workspace = true }
pixi_install_pypi = { workspace = true }
pixi_manifest = { workspace = true }
pixi_progress = { workspace = true }
pixi_pypi_spec = { workspace = true }
pixi_reporters = { workspace = true }
pixi_spec = { workspace = true }
pixi_task = { workspace = true }
pixi_utils = { workspace = true }
pixi_uv_conversions = { workspace = true }
pypi_modifiers = { workspace = true }
rattler_conda_types = { workspace = true }
rattler_lock = { workspace = true }
rattler_repodata_gateway = { workspace = true }
rattler_shell = { workspace = true, features = ["sysinfo"] }
regex = { workspace = true }
same-file = { workspace = true }
serde = { workspace = true, features = ["derive"] }
tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["fs"] }
tokio = { workspace = true, features = ["fs", "rt", "signal"] }
tokio-util = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
uv-distribution = { workspace = true }
Expand All @@ -48,9 +54,14 @@ uv-normalize = { workspace = true }
uv-pep508 = { workspace = true }
uv-redacted = { workspace = true }
uv-types = { workspace = true }
which = { workspace = true }

[dev-dependencies]
insta = { workspace = true }
pixi_test_utils = { workspace = true }
rstest = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }

[target."cfg(unix)".dependencies]
libc = { workspace = true, default-features = false }
pixi_pty = { path = "../pixi_pty" }
15 changes: 15 additions & 0 deletions crates/pixi_api/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::interface::Interface;
use crate::workspace::add::GitOptions;
use crate::workspace::{
ChannelOptions, DependencyOptions, InitOptions, Package, ReinstallOptions, RemoveError,
RunOptions, ShellOptions,
};

pub struct DefaultContext<I: Interface> {
Expand Down Expand Up @@ -549,6 +550,20 @@ impl<I: Interface> WorkspaceContext<I> {
.await
}

pub async fn run(&self, options: RunOptions) -> miette::Result<i32> {
crate::workspace::run::run(
&self.interface,
&self.workspace,
options,
self.progress.as_ref(),
)
.await
}

pub async fn shell(&self, options: ShellOptions) -> miette::Result<i32> {
crate::workspace::shell::shell(&self.workspace, options, self.progress.as_ref()).await
}

pub async fn list_tasks(
&self,
environment: Option<EnvironmentName>,
Expand Down
5 changes: 5 additions & 0 deletions crates/pixi_api/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ use std::future::Future;
pub trait Interface {
fn is_cli(&self) -> impl Future<Output = bool> + Send;
fn confirm(&self, msg: &str) -> impl Future<Output = Result<bool>> + Send;
fn select(
&self,
msg: &str,
options: &[String],
) -> impl Future<Output = Result<Option<usize>>> + Send;
fn info(&self, msg: &str) -> impl Future<Output = ()> + Send;
fn success(&self, msg: &str) -> impl Future<Output = ()> + Send;
fn warning(&self, msg: &str) -> impl Future<Output = ()> + Send;
Expand Down
1 change: 1 addition & 0 deletions crates/pixi_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub use pep508_rs as pep508;
pub use pixi_core as core;
pub use pixi_manifest as manifest;
pub use pixi_pypi_spec as pypi_spec;
pub use pixi_reporters as reporters;
pub use pixi_spec as spec;
pub use rattler_conda_types;

Expand Down
3 changes: 3 additions & 0 deletions crates/pixi_api/src/workspace/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,9 @@ mod tests {
async fn confirm(&self, _msg: &str) -> miette::Result<bool> {
Ok(self.confirm_response)
}
async fn select(&self, _msg: &str, _options: &[String]) -> miette::Result<Option<usize>> {
Ok(None)
}
async fn error(&self, _msg: &str) {}
async fn info(&self, _msg: &str) {}
async fn success(&self, _msg: &str) {}
Expand Down
6 changes: 6 additions & 0 deletions crates/pixi_api/src/workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ pub use list::{Package, PackageKind};
pub(crate) mod reinstall;
pub use reinstall::ReinstallOptions;

pub(crate) mod run;
pub use run::{RunOptions, run_future_forwarding_signals};

pub(crate) mod search;

pub(crate) mod shell;
pub use shell::ShellOptions;

pub(crate) mod task;

#[allow(clippy::module_inception)]
Expand Down
Loading
Loading