diff --git a/Cargo.lock b/Cargo.lock index 27ebc20069..eef9f6613f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -923,7 +923,7 @@ name = "barrier_cell" version = "0.1.0" dependencies = [ "parking_lot", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", ] @@ -1051,9 +1051,9 @@ dependencies = [ [[package]] name = "bon" -version = "3.7.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a0c21249ad725ebcadcb1b1885f8e3d56e8e6b8924f560268aab000982d637" +checksum = "537c317ddf588aab15c695bf92cf55dec159b93221c074180ca3e0e5a94da415" dependencies = [ "bon-macros", "rustversion", @@ -1061,9 +1061,9 @@ dependencies = [ [[package]] name = "bon-macros" -version = "3.7.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a660ebdea4d4d3ec7788cfc9c035b66efb66028b9b97bf6cde7023ccc8e77e28" +checksum = "ca5abbf2d4a4c6896197c9de13d6d7cb7eff438c63dacde1dde980569cb00248" dependencies = [ "darling 0.21.2", "ident_case", @@ -1257,9 +1257,9 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cfg-if" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "cfg_aliases" @@ -1813,7 +1813,7 @@ dependencies = [ "deno_error", "percent-encoding", "sys_traits", - "thiserror 2.0.15", + "thiserror 2.0.16", "url", ] @@ -1832,7 +1832,7 @@ dependencies = [ "os_pipe", "path-dedot", "sys_traits", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "which", "windows-sys 0.59.0", @@ -2191,7 +2191,7 @@ checksum = "765662dc0b26e038099a5a1529f5d48443111eea45377c312be892997651710e" dependencies = [ "itertools 0.14.0", "percent-encoding", - "thiserror 2.0.15", + "thiserror 2.0.16", "typed-path", "url", ] @@ -2595,7 +2595,7 @@ dependencies = [ "rustls-pemfile 2.2.0", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "time", "tokio", ] @@ -2616,7 +2616,7 @@ dependencies = [ "rand 0.9.2", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", ] @@ -2644,7 +2644,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "thiserror 2.0.15", + "thiserror 2.0.16", "time", "url", ] @@ -4526,7 +4526,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.15", + "thiserror 2.0.16", "ucd-trie", ] @@ -4699,7 +4699,7 @@ dependencies = [ "rattler_conda_types", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "url", ] @@ -4718,7 +4718,7 @@ dependencies = [ "rattler_package_streaming", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "tracing", @@ -4800,6 +4800,7 @@ dependencies = [ "pixi_record", "pixi_reporters", "pixi_spec", + "pixi_task", "pixi_test_utils", "pixi_utils", "pixi_uv_conversions", @@ -4830,7 +4831,7 @@ dependencies = [ "tar", "temp-env", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "toml_edit 0.22.27", @@ -4899,7 +4900,7 @@ dependencies = [ "strsim", "tempfile", "text_trees", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "typed-path", @@ -4928,7 +4929,7 @@ dependencies = [ "serde", "serde_ignored", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml_edit 0.22.27", "tracing", "url", @@ -4949,17 +4950,14 @@ name = "pixi_core" version = "0.1.0" dependencies = [ "ahash", - "anyhow", "assert_matches", "async-once-cell", "async-trait", "barrier_cell", "chrono", "console 0.15.11", - "crossbeam-channel", "csv", "dashmap", - "deno_task_shell", "dialoguer", "dunce", "fake", @@ -5010,17 +5008,15 @@ dependencies = [ "rattler_shell", "rattler_solve", "rattler_virtual_packages", - "rayon", "reqwest", "reqwest-middleware", "rlimit", "rstest", "serde", "serde_json", - "shlex", "tabwriter", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "toml_edit 0.22.27", "tracing", @@ -5083,7 +5079,7 @@ dependencies = [ "reqwest", "reqwest-middleware", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "url", @@ -5103,7 +5099,7 @@ dependencies = [ "rattler_digest", "rstest", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "wax", ] @@ -5156,7 +5152,7 @@ dependencies = [ "serde_json", "serde_with", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "toml-span", "toml_edit 0.22.27", @@ -5205,7 +5201,7 @@ dependencies = [ "strsim", "strum", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml-span", "toml_edit 0.22.27", "tracing", @@ -5244,7 +5240,7 @@ dependencies = [ "rstest", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml-span", "toml_edit 0.22.27", "tracing", @@ -5264,7 +5260,7 @@ dependencies = [ "rattler_lock", "serde", "serde_with", - "thiserror 2.0.15", + "thiserror 2.0.16", "typed-path", "url", ] @@ -5317,7 +5313,7 @@ dependencies = [ "serde-untagged", "serde_json", "serde_with", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml-span", "toml_edit 0.22.27", "tracing", @@ -5336,6 +5332,37 @@ dependencies = [ "serde", ] +[[package]] +name = "pixi_task" +version = "0.1.0" +dependencies = [ + "anyhow", + "assert_matches", + "crossbeam-channel", + "deno_task_shell", + "fancy_display", + "fs-err", + "itertools 0.14.0", + "miette 7.6.0", + "pixi_consts", + "pixi_core", + "pixi_glob", + "pixi_manifest", + "pixi_progress", + "rattler_conda_types", + "rattler_lock", + "rayon", + "serde", + "serde_json", + "shlex", + "tempfile", + "thiserror 2.0.16", + "tokio", + "tracing", + "uv-configuration", + "xxhash-rust", +] + [[package]] name = "pixi_test_utils" version = "0.1.0" @@ -5385,7 +5412,7 @@ dependencies = [ "serde_json", "serde_yaml", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "tracing-subscriber", @@ -5410,7 +5437,7 @@ dependencies = [ "pixi_spec", "rattler_lock", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "url", "uv-configuration", "uv-distribution-filename", @@ -5456,7 +5483,7 @@ checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1" dependencies = [ "base64 0.22.1", "indexmap 2.10.0", - "quick-xml 0.38.1", + "quick-xml 0.38.2", "serde", "time", ] @@ -5666,7 +5693,7 @@ dependencies = [ "log", "priority-queue", "rustc-hash", - "thiserror 2.0.15", + "thiserror 2.0.16", "version-ranges", ] @@ -5681,7 +5708,7 @@ dependencies = [ "phf", "serde", "smartstring", - "thiserror 2.0.15", + "thiserror 2.0.16", "unicase", ] @@ -5707,7 +5734,7 @@ dependencies = [ "reqwest-retry", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "url", @@ -5723,7 +5750,7 @@ dependencies = [ "rattler_conda_types", "rattler_virtual_packages", "regex", - "thiserror 2.0.15", + "thiserror 2.0.16", "uv-distribution-filename", "uv-pep508", "uv-platform-tags", @@ -5739,7 +5766,7 @@ dependencies = [ "pep440_rs", "pep508_rs", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml 0.8.23", ] @@ -5760,9 +5787,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.38.1" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9845d9dccf565065824e69f9f235fafba1587031eda353c1f1561cd6a6be78f4" +checksum = "d200a41a7797e6461bd04e4e95c3347053a731c32c87f066f2f0dda22dbdbba8" dependencies = [ "memchr", ] @@ -5781,7 +5808,7 @@ dependencies = [ "rustc-hash", "rustls 0.23.31", "socket2 0.5.10", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "web-time", @@ -5802,7 +5829,7 @@ dependencies = [ "rustls 0.23.31", "rustls-pki-types", "slab", - "thiserror 2.0.15", + "thiserror 2.0.16", "tinyvec", "tracing", "web-time", @@ -5964,7 +5991,7 @@ dependencies = [ "simple_spawn_blocking", "smallvec", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "url", @@ -5998,7 +6025,7 @@ dependencies = [ "serde_json", "simple_spawn_blocking", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "url", @@ -6039,7 +6066,7 @@ dependencies = [ "smallvec", "strum", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "typed-path", "url", @@ -6084,7 +6111,7 @@ dependencies = [ "serde_repr", "serde_with", "serde_yaml", - "thiserror 2.0.15", + "thiserror 2.0.16", "typed-path", "url", ] @@ -6121,7 +6148,7 @@ dependencies = [ "sha2", "shlex", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "unicode-normalization", "which", @@ -6154,7 +6181,7 @@ dependencies = [ "serde", "serde_json", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "url", ] @@ -6180,7 +6207,7 @@ dependencies = [ "simple_spawn_blocking", "tar", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "tracing", @@ -6261,7 +6288,7 @@ dependencies = [ "strum", "superslice", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "tracing", @@ -6288,7 +6315,7 @@ dependencies = [ "shlex", "sysinfo", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", ] @@ -6306,7 +6333,7 @@ dependencies = [ "resolvo", "serde", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", ] @@ -6324,7 +6351,7 @@ dependencies = [ "rattler_conda_types", "regex", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "winver", ] @@ -6366,7 +6393,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.16", "libredox", - "thiserror 2.0.15", + "thiserror 2.0.16", ] [[package]] @@ -7755,15 +7782,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.20.0" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e" dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", "rustix 1.0.8", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -7804,11 +7831,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.15" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" dependencies = [ - "thiserror-impl 2.0.15", + "thiserror-impl 2.0.16", ] [[package]] @@ -7824,9 +7851,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.15" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", @@ -8480,7 +8507,7 @@ dependencies = [ "sha2", "spdx", "tar", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml 0.9.5", "tracing", "uv-distribution-filename", @@ -8515,7 +8542,7 @@ dependencies = [ "serde", "serde_json", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "toml_edit 0.23.3", "tracing", @@ -8568,7 +8595,7 @@ dependencies = [ "fs-err", "globwalk", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml 0.9.5", "tracing", "walkdir", @@ -8613,7 +8640,7 @@ dependencies = [ "serde", "serde_json", "sys-info", - "thiserror 2.0.15", + "thiserror 2.0.16", "tl", "tokio", "tokio-util", @@ -8654,7 +8681,7 @@ dependencies = [ "serde", "serde-untagged", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "url", "uv-auth", @@ -8699,7 +8726,7 @@ dependencies = [ "futures", "itertools 0.14.0", "rustc-hash", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "uv-build-backend", @@ -8739,7 +8766,7 @@ dependencies = [ "rustc-hash", "serde", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "toml 0.9.5", @@ -8778,7 +8805,7 @@ dependencies = [ "rkyv", "serde", "smallvec", - "thiserror 2.0.15", + "thiserror 2.0.16", "uv-cache-key", "uv-normalize", "uv-pep440", @@ -8804,7 +8831,7 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "url", "uv-auth", @@ -8840,7 +8867,7 @@ dependencies = [ "reqwest", "rustc-hash", "sha2", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "tracing", @@ -8887,7 +8914,7 @@ dependencies = [ "fs-err", "reqwest", "reqwest-middleware", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "url", @@ -8907,7 +8934,7 @@ version = "0.0.1" source = "git+https://github.com/astral-sh/uv?tag=0.8.5#ce37286814dbb802c422f0926487cfab7aefd2b7" dependencies = [ "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "url", "uv-redacted", @@ -8922,7 +8949,7 @@ dependencies = [ "owo-colors", "regex", "regex-automata 0.4.9", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "walkdir", ] @@ -8947,7 +8974,7 @@ dependencies = [ "serde_json", "sha2", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "uv-cache-info", "uv-distribution-filename", @@ -8975,7 +9002,7 @@ dependencies = [ "rustc-hash", "same-file", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tracing", "url", @@ -9021,7 +9048,7 @@ dependencies = [ "async_zip", "fs-err", "futures", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "tracing", @@ -9088,7 +9115,7 @@ dependencies = [ "schemars 1.0.4", "serde", "smallvec", - "thiserror 2.0.15", + "thiserror 2.0.16", "unicode-width 0.2.1", "url", "uv-cache-key", @@ -9109,7 +9136,7 @@ dependencies = [ "procfs", "regex", "target-lexicon", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "uv-fs", "uv-platform-tags", @@ -9125,7 +9152,7 @@ dependencies = [ "rkyv", "rustc-hash", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "uv-small-str", ] @@ -9146,7 +9173,7 @@ dependencies = [ "schemars 1.0.4", "serde", "serde-untagged", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml_edit 0.23.3", "tracing", "url", @@ -9187,7 +9214,7 @@ dependencies = [ "sys-info", "target-lexicon", "tempfile", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-util", "tracing", @@ -9240,7 +9267,7 @@ dependencies = [ "futures", "rustc-hash", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "toml 0.9.5", "tracing", "url", @@ -9273,7 +9300,7 @@ dependencies = [ "memchr", "reqwest", "reqwest-middleware", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "unscanny", "url", @@ -9311,7 +9338,7 @@ dependencies = [ "serde", "smallvec", "textwrap", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "tokio-stream", "toml 0.9.5", @@ -9398,7 +9425,7 @@ dependencies = [ "either", "fs-err", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "url", "uv-distribution-types", @@ -9414,7 +9441,7 @@ version = "0.0.1" source = "git+https://github.com/astral-sh/uv?tag=0.8.5#ce37286814dbb802c422f0926487cfab7aefd2b7" dependencies = [ "fs-err", - "thiserror 2.0.15", + "thiserror 2.0.16", "uv-fs", "zip 2.4.2", ] @@ -9427,7 +9454,7 @@ dependencies = [ "anyhow", "dashmap", "rustc-hash", - "thiserror 2.0.15", + "thiserror 2.0.16", "uv-cache", "uv-configuration", "uv-distribution-filename", @@ -9459,7 +9486,7 @@ dependencies = [ "owo-colors", "pathdiff", "self-replace", - "thiserror 2.0.15", + "thiserror 2.0.16", "tracing", "uv-configuration", "uv-console", @@ -9492,7 +9519,7 @@ dependencies = [ "owo-colors", "rustc-hash", "serde", - "thiserror 2.0.15", + "thiserror 2.0.16", "tokio", "toml 0.9.5", "toml_edit 0.23.3", @@ -9791,11 +9818,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -10536,7 +10563,7 @@ dependencies = [ "indexmap 2.10.0", "lzma-rs", "memchr", - "thiserror 2.0.15", + "thiserror 2.0.16", "time", "xz2", "zopfli", diff --git a/Cargo.toml b/Cargo.toml index 13dbc6bf2c..d04988f39f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -194,6 +194,7 @@ pixi_record = { path = "crates/pixi_record" } pixi_reporters = { path = "crates/pixi_reporters" } pixi_spec = { path = "crates/pixi_spec" } pixi_spec_containers = { path = "crates/pixi_spec_containers" } +pixi_task = { path = "crates/pixi_task" } pixi_test_utils = { path = "crates/pixi_test_utils" } pixi_toml = { path = "crates/pixi_toml" } pixi_utils = { path = "crates/pixi_utils", default-features = false } diff --git a/crates/pixi_cli/Cargo.toml b/crates/pixi_cli/Cargo.toml index f492c2bb5f..16029ca403 100644 --- a/crates/pixi_cli/Cargo.toml +++ b/crates/pixi_cli/Cargo.toml @@ -77,6 +77,7 @@ pixi_pypi_spec = { workspace = true } pixi_record = { workspace = true } pixi_reporters = { workspace = true } pixi_spec = { workspace = true } +pixi_task = { workspace = true } pixi_utils = { workspace = true, default-features = false } pixi_uv_conversions = { workspace = true } pypi_mapping = { workspace = true } diff --git a/crates/pixi_cli/src/info.rs b/crates/pixi_cli/src/info.rs index 0f8224ec00..bf6c5913fd 100644 --- a/crates/pixi_cli/src/info.rs +++ b/crates/pixi_cli/src/info.rs @@ -7,11 +7,12 @@ use itertools::Itertools; use miette::IntoDiagnostic; use pixi_config; use pixi_consts::consts; -use pixi_core::{WorkspaceLocator, task::TaskName}; +use pixi_core::WorkspaceLocator; use pixi_global::{BinDir, EnvRoot}; use pixi_manifest::{EnvironmentName, FeatureName, SystemRequirements}; use pixi_manifest::{FeaturesExt, HasFeaturesIter}; use pixi_progress::await_in_progress; +use pixi_task::TaskName; use rattler_conda_types::{GenericVirtualPackage, Platform}; use rattler_networking::authentication_storage; use rattler_virtual_packages::{VirtualPackage, VirtualPackageOverrides}; diff --git a/crates/pixi_cli/src/run.rs b/crates/pixi_cli/src/run.rs index 0e73a562ad..5877be1b69 100644 --- a/crates/pixi_cli/src/run.rs +++ b/crates/pixi_cli/src/run.rs @@ -12,22 +12,21 @@ use fancy_display::FancyDisplay; use itertools::Itertools; use miette::{Diagnostic, IntoDiagnostic}; use pixi_config::{ConfigCli, ConfigCliActivation}; -use pixi_manifest::{FeaturesExt, TaskName}; -use rattler_conda_types::Platform; -use thiserror::Error; -use tokio_util::sync::CancellationToken; -use tracing::Level; - use pixi_core::{ Workspace, WorkspaceLocator, environment::sanity_check_workspace, lock_file::{ReinstallPackages, UpdateLockFileOptions, UpdateMode}, - task::{ - AmbiguousTask, CanSkip, ExecutableTask, FailedToParseShellScript, InvalidWorkingDirectory, - SearchEnvironments, TaskAndEnvironment, TaskGraph, get_task_env, - }, workspace::{Environment, errors::UnsupportedPlatformError}, }; +use pixi_manifest::{FeaturesExt, TaskName}; +use pixi_task::{ + AmbiguousTask, CanSkip, ExecutableTask, FailedToParseShellScript, InvalidWorkingDirectory, + SearchEnvironments, TaskAndEnvironment, TaskGraph, get_task_env, +}; +use rattler_conda_types::Platform; +use thiserror::Error; +use tokio_util::sync::CancellationToken; +use tracing::Level; use crate::cli_config::{LockAndInstallConfig, WorkspaceConfig}; diff --git a/crates/pixi_core/Cargo.toml b/crates/pixi_core/Cargo.toml index 2ce4fcf5a0..b2220a2a65 100644 --- a/crates/pixi_core/Cargo.toml +++ b/crates/pixi_core/Cargo.toml @@ -13,16 +13,13 @@ slow_integration_tests = [] [dependencies] ahash = { workspace = true } -anyhow = { workspace = true } assert_matches = { workspace = true } async-once-cell = { workspace = true } barrier_cell = { workspace = true } chrono = { workspace = true } console = { workspace = true } -crossbeam-channel = { workspace = true } csv = { workspace = true } dashmap = { workspace = true } -deno_task_shell = { workspace = true } dialoguer = { workspace = true } dunce = { workspace = true } fancy_display = { workspace = true } @@ -68,14 +65,12 @@ rattler_repodata_gateway = { workspace = true } rattler_shell = { workspace = true } rattler_solve = { workspace = true } rattler_virtual_packages = { workspace = true } -rayon = { workspace = true } reqwest = { workspace = true } reqwest-middleware = { workspace = true } rlimit = { workspace = true } rstest = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -shlex = { workspace = true } tabwriter = { workspace = true } tempfile = { workspace = true } thiserror = { workspace = true } diff --git a/crates/pixi_core/src/activation.rs b/crates/pixi_core/src/activation.rs index a7be3e3249..d4587a889a 100644 --- a/crates/pixi_core/src/activation.rs +++ b/crates/pixi_core/src/activation.rs @@ -1,5 +1,5 @@ use crate::{Workspace, workspace::Environment}; -use crate::{task::EnvironmentHash, workspace::HasWorkspaceRef}; +use crate::{environment::EnvironmentHash, workspace::HasWorkspaceRef}; use fs_err::tokio as tokio_fs; use indexmap::IndexMap; use itertools::Itertools; diff --git a/crates/pixi_core/src/environment/mod.rs b/crates/pixi_core/src/environment/mod.rs index f7e7071b6a..cfa6e5394c 100644 --- a/crates/pixi_core/src/environment/mod.rs +++ b/crates/pixi_core/src/environment/mod.rs @@ -17,9 +17,10 @@ use pixi_utils::{prefix::Prefix, rlimit::try_increase_rlimit_to_sensible}; pub use pypi_prefix::{ContinuePyPIPrefixUpdate, on_python_interpreter_change}; pub use python_status::PythonStatus; use rattler_conda_types::Platform; -use rattler_lock::LockedPackageRef; +use rattler_lock::{LockFile, LockedPackageRef}; use serde::{Deserialize, Serialize}; use std::collections::HashSet; +use std::fmt::{Display, Formatter}; use std::{ collections::HashMap, hash::{Hash, Hasher}, @@ -28,6 +29,7 @@ use std::{ }; use xxhash_rust::xxh3::Xxh3; +use crate::workspace; use crate::{ Workspace, lock_file::{LockFileDerivedData, ReinstallPackages, UpdateLockFileOptions, UpdateMode}, @@ -104,6 +106,66 @@ async fn prefix_location_changed( } } +#[derive(Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] +pub struct EnvironmentHash(String); + +impl EnvironmentHash { + pub fn from_environment( + run_environment: &workspace::Environment<'_>, + input_environment_variables: &HashMap>, + lock_file: &LockFile, + ) -> Self { + let mut hasher = Xxh3::new(); + + // Hash the environment variables + let mut sorted_input_environment_variables: Vec<_> = + input_environment_variables.iter().collect(); + sorted_input_environment_variables.sort_by_key(|(key, _)| *key); + for (key, value) in sorted_input_environment_variables { + key.hash(&mut hasher); + value.hash(&mut hasher); + } + + // Hash the activation scripts + let activation_scripts = + run_environment.activation_scripts(Some(run_environment.best_platform())); + for script in activation_scripts { + script.hash(&mut hasher); + } + + // Hash the environment variables + let project_activation_env = + run_environment.activation_env(Some(run_environment.best_platform())); + let mut env_vars: Vec<_> = project_activation_env.iter().collect(); + env_vars.sort_by_key(|(key, _)| *key); + + for (key, value) in env_vars { + key.hash(&mut hasher); + value.hash(&mut hasher); + } + + // Hash the packages + let mut urls = Vec::new(); + if let Some(env) = lock_file.environment(run_environment.name().as_str()) { + if let Some(packages) = env.packages(run_environment.best_platform()) { + for package in packages { + urls.push(package.location().to_string()) + } + } + } + urls.sort(); + urls.hash(&mut hasher); + + EnvironmentHash(format!("{:x}", hasher.finish())) + } +} + +impl Display for EnvironmentHash { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + #[derive(Debug, Hash, Serialize, Deserialize, PartialEq, Eq)] pub struct LockedEnvironmentHash(String); impl LockedEnvironmentHash { diff --git a/crates/pixi_core/src/lib.rs b/crates/pixi_core/src/lib.rs index c9d470cfc6..fae2657107 100644 --- a/crates/pixi_core/src/lib.rs +++ b/crates/pixi_core/src/lib.rs @@ -7,7 +7,6 @@ mod install_pypi; pub mod lock_file; pub mod prompt; pub mod repodata; -pub mod task; pub mod workspace; pub mod signals; diff --git a/crates/pixi_global/Cargo.toml b/crates/pixi_global/Cargo.toml index 105ae528b4..a551a07a84 100644 --- a/crates/pixi_global/Cargo.toml +++ b/crates/pixi_global/Cargo.toml @@ -8,9 +8,6 @@ readme.workspace = true repository.workspace = true version = "0.1.0" -[features] -slow_integration_tests = [] - [dependencies] ahash = { workspace = true } console = { workspace = true } diff --git a/crates/pixi_task/Cargo.toml b/crates/pixi_task/Cargo.toml new file mode 100644 index 0000000000..ef08b77f85 --- /dev/null +++ b/crates/pixi_task/Cargo.toml @@ -0,0 +1,37 @@ +[package] +authors.workspace = true +description = "Task execution with dependency graphs and caching" +edition.workspace = true +homepage.workspace = true +license.workspace = true +name = "pixi_task" +readme.workspace = true +repository.workspace = true +version = "0.1.0" + +[dependencies] +anyhow = { workspace = true } +assert_matches = { workspace = true } +crossbeam-channel = { workspace = true } +deno_task_shell = { workspace = true } +fancy_display = { workspace = true } +fs-err = { workspace = true } +itertools = { workspace = true } +miette = { workspace = true } +pixi_consts = { workspace = true } +pixi_core = { workspace = true } +pixi_glob = { workspace = true } +pixi_manifest = { workspace = true, features = ["rattler_lock"] } +pixi_progress = { workspace = true } +rattler_conda_types = { workspace = true } +rattler_lock = { workspace = true } +rayon = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +shlex = { workspace = true } +tempfile = { workspace = true } +thiserror = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } +uv-configuration = { workspace = true } +xxhash-rust = { workspace = true } diff --git a/crates/pixi_core/src/task/error.rs b/crates/pixi_task/src/error.rs similarity index 100% rename from crates/pixi_core/src/task/error.rs rename to crates/pixi_task/src/error.rs diff --git a/crates/pixi_core/src/task/executable_task.rs b/crates/pixi_task/src/executable_task.rs similarity index 99% rename from crates/pixi_core/src/task/executable_task.rs rename to crates/pixi_task/src/executable_task.rs index c79c269d29..d30280a5a3 100644 --- a/crates/pixi_core/src/task/executable_task.rs +++ b/crates/pixi_task/src/executable_task.rs @@ -13,20 +13,20 @@ use fs_err::tokio as tokio_fs; use itertools::Itertools; use miette::{Context, Diagnostic}; use pixi_consts::consts; +use pixi_core::{ + Workspace, + activation::CurrentEnvVarBehavior, + workspace::get_activated_environment_variables, + workspace::{Environment, HasWorkspaceRef}, +}; use pixi_manifest::{Task, TaskName, task::ArgValues, task::TemplateStringError}; use pixi_progress::await_in_progress; use rattler_lock::LockFile; use thiserror::Error; use tokio::task::JoinHandle; -use super::task_hash::{InputHashesError, NameHash, TaskCache, TaskHash}; -use crate::{ - Workspace, - activation::CurrentEnvVarBehavior, - task::task_graph::{TaskGraph, TaskId}, - workspace::get_activated_environment_variables, - workspace::{Environment, HasWorkspaceRef}, -}; +use crate::task_graph::{TaskGraph, TaskId}; +use crate::task_hash::{InputHashesError, NameHash, TaskCache, TaskHash}; /// Runs task in project. #[derive(Default, Debug)] diff --git a/crates/pixi_core/src/task/file_hashes.rs b/crates/pixi_task/src/file_hashes.rs similarity index 100% rename from crates/pixi_core/src/task/file_hashes.rs rename to crates/pixi_task/src/file_hashes.rs diff --git a/crates/pixi_core/src/task/mod.rs b/crates/pixi_task/src/lib.rs similarity index 87% rename from crates/pixi_core/src/task/mod.rs rename to crates/pixi_task/src/lib.rs index e8bbf93642..ed5f388a9e 100644 --- a/crates/pixi_core/src/task/mod.rs +++ b/crates/pixi_task/src/lib.rs @@ -7,7 +7,7 @@ mod task_hash; pub use file_hashes::{FileHashes, FileHashesError}; pub use pixi_manifest::{Task, TaskName}; -pub use task_hash::{ComputationHash, EnvironmentHash, InputHashes, TaskHash}; +pub use task_hash::{ComputationHash, InputHashes, TaskHash}; pub use executable_task::{ CanSkip, ExecutableTask, FailedToParseShellScript, InvalidWorkingDirectory, RunOutput, diff --git a/crates/pixi_core/src/task/task_environment.rs b/crates/pixi_task/src/task_environment.rs similarity index 99% rename from crates/pixi_core/src/task/task_environment.rs rename to crates/pixi_task/src/task_environment.rs index 39056855cf..6fa5adaf84 100644 --- a/crates/pixi_core/src/task/task_environment.rs +++ b/crates/pixi_task/src/task_environment.rs @@ -1,13 +1,13 @@ use miette::Diagnostic; +use pixi_core::{ + Workspace, + workspace::{Environment, virtual_packages::verify_current_platform_can_run_environment}, +}; use pixi_manifest::{Task, TaskName}; use rattler_conda_types::Platform; use thiserror::Error; -use crate::{ - Workspace, - task::error::{AmbiguousTaskError, MissingTaskError}, - workspace::{Environment, virtual_packages::verify_current_platform_can_run_environment}, -}; +use crate::error::{AmbiguousTaskError, MissingTaskError}; /// Defines where the task was defined when looking for a task. #[derive(Debug, Clone)] diff --git a/crates/pixi_core/src/task/task_graph.rs b/crates/pixi_task/src/task_graph.rs similarity index 98% rename from crates/pixi_core/src/task/task_graph.rs rename to crates/pixi_task/src/task_graph.rs index 49ecbe6d69..158a152dc6 100644 --- a/crates/pixi_core/src/task/task_graph.rs +++ b/crates/pixi_task/src/task_graph.rs @@ -8,6 +8,7 @@ use std::{ use itertools::Itertools; use miette::Diagnostic; +use pixi_core::{Workspace, workspace::Environment}; use pixi_manifest::{ EnvironmentName, Task, TaskName, task::{ @@ -18,13 +19,9 @@ use pixi_manifest::{ use thiserror::Error; use crate::{ - Workspace, - task::{ - TaskDisambiguation, - error::{AmbiguousTaskError, MissingTaskError}, - task_environment::{FindTaskError, FindTaskSource, SearchEnvironments}, - }, - workspace::Environment, + TaskDisambiguation, + error::{AmbiguousTaskError, MissingTaskError}, + task_environment::{FindTaskError, FindTaskSource, SearchEnvironments}, }; /// A task ID is a unique identifier for a [`TaskNode`] in a [`TaskGraph`]. @@ -570,13 +567,11 @@ pub enum TaskGraphError { mod test { use std::path::Path; + use pixi_core::Workspace; use pixi_manifest::EnvironmentName; use rattler_conda_types::Platform; - use crate::{ - Workspace, - task::{task_environment::SearchEnvironments, task_graph::TaskGraph}, - }; + use crate::{task_environment::SearchEnvironments, task_graph::TaskGraph}; fn commands_in_order( project_str: &str, diff --git a/crates/pixi_core/src/task/task_hash.rs b/crates/pixi_task/src/task_hash.rs similarity index 78% rename from crates/pixi_core/src/task/task_hash.rs rename to crates/pixi_task/src/task_hash.rs index 3501b5bca9..198c28d2eb 100644 --- a/crates/pixi_core/src/task/task_hash.rs +++ b/crates/pixi_task/src/task_hash.rs @@ -1,6 +1,5 @@ -use crate::task::{ExecutableTask, FileHashes, FileHashesError, InvalidWorkingDirectory}; -use crate::workspace; use miette::Diagnostic; +use pixi_core::environment::EnvironmentHash; use pixi_manifest::task::TemplateStringError; use rattler_lock::LockFile; use serde::{Deserialize, Serialize}; @@ -10,6 +9,8 @@ use std::hash::{Hash, Hasher}; use thiserror::Error; use xxhash_rust::xxh3::Xxh3; +use crate::{ExecutableTask, FileHashes, FileHashesError, InvalidWorkingDirectory}; + /// The computation hash is a combined hash of all the inputs and outputs of a task. /// /// Use a [`TaskHash`] to construct a computation hash. @@ -60,66 +61,6 @@ pub struct TaskCache { pub hash: ComputationHash, } -#[derive(Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] -pub struct EnvironmentHash(String); - -impl EnvironmentHash { - pub(crate) fn from_environment( - run_environment: &workspace::Environment<'_>, - input_environment_variables: &HashMap>, - lock_file: &LockFile, - ) -> Self { - let mut hasher = Xxh3::new(); - - // Hash the environment variables - let mut sorted_input_environment_variables: Vec<_> = - input_environment_variables.iter().collect(); - sorted_input_environment_variables.sort_by_key(|(key, _)| *key); - for (key, value) in sorted_input_environment_variables { - key.hash(&mut hasher); - value.hash(&mut hasher); - } - - // Hash the activation scripts - let activation_scripts = - run_environment.activation_scripts(Some(run_environment.best_platform())); - for script in activation_scripts { - script.hash(&mut hasher); - } - - // Hash the environment variables - let project_activation_env = - run_environment.activation_env(Some(run_environment.best_platform())); - let mut env_vars: Vec<_> = project_activation_env.iter().collect(); - env_vars.sort_by_key(|(key, _)| *key); - - for (key, value) in env_vars { - key.hash(&mut hasher); - value.hash(&mut hasher); - } - - // Hash the packages - let mut urls = Vec::new(); - if let Some(env) = lock_file.environment(run_environment.name().as_str()) { - if let Some(packages) = env.packages(run_environment.best_platform()) { - for package in packages { - urls.push(package.location().to_string()) - } - } - } - urls.sort(); - urls.hash(&mut hasher); - - EnvironmentHash(format!("{:x}", hasher.finish())) - } -} - -impl Display for EnvironmentHash { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) - } -} - /// The [`TaskHash`] group all the hashes of a task. It can be converted to a [`ComputationHash`] /// with the [`TaskHash::computation_hash`] method. #[derive(Debug)] diff --git a/tests/integration_rust/common/mod.rs b/tests/integration_rust/common/mod.rs index 41432c5ac7..113c9c77c0 100644 --- a/tests/integration_rust/common/mod.rs +++ b/tests/integration_rust/common/mod.rs @@ -31,13 +31,13 @@ use pixi_consts::consts; use pixi_core::{ UpdateLockFileOptions, Workspace, lock_file::{ReinstallPackages, UpdateMode}, - task::{ - ExecutableTask, RunOutput, SearchEnvironments, TaskExecutionError, TaskGraph, - TaskGraphError, TaskName, get_task_env, - }, }; use pixi_manifest::{EnvironmentName, FeatureName}; use pixi_progress::global_multi_progress; +use pixi_task::{ + ExecutableTask, RunOutput, SearchEnvironments, TaskExecutionError, TaskGraph, TaskGraphError, + TaskName, get_task_env, +}; use rattler_conda_types::{MatchSpec, ParseStrictness::Lenient, Platform}; use rattler_lock::{LockFile, LockedPackageRef, UrlOrPath}; use tempfile::TempDir; diff --git a/tests/integration_rust/task_tests.rs b/tests/integration_rust/task_tests.rs index 185fb0670e..07ab032f57 100644 --- a/tests/integration_rust/task_tests.rs +++ b/tests/integration_rust/task_tests.rs @@ -2,11 +2,11 @@ use std::path::PathBuf; use pixi_cli::cli_config::WorkspaceConfig; use pixi_cli::run::Args; -use pixi_core::task::TaskName; use pixi_manifest::{ FeatureName, Task, task::{CmdArgs, TemplateString}, }; +use pixi_task::TaskName; use rattler_conda_types::Platform; use crate::common::PixiControl;