diff --git a/Cargo.lock b/Cargo.lock index 829318455..64b1cc5cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,19 +153,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-compression" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" -dependencies = [ - "flate2", - "futures-core", - "futures-io", - "memchr", - "pin-project-lite", -] - [[package]] name = "async-compression" version = "0.4.6" @@ -175,6 +162,7 @@ dependencies = [ "bzip2", "flate2", "futures-core", + "futures-io", "memchr", "pin-project-lite", "tokio", @@ -369,14 +357,13 @@ dependencies = [ [[package]] name = "async_zip" -version = "0.0.15" +version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795310de3218cde15219fc98c1cf7d8fe9db4865aab27fcf1d535d6cb61c6b54" +checksum = "527207465fb6dcafbf661b0d4a51d0d2306c9d0c2975423079a6caa807930daf" dependencies = [ - "async-compression 0.3.15", + "async-compression", "crc32fast", - "futures-util", - "log", + "futures-lite 2.2.0", "pin-project", "thiserror", "tokio", @@ -562,7 +549,7 @@ dependencies = [ "hex", "libc", "memmap2 0.5.10", - "miette", + "miette 5.10.0", "reflink-copy", "serde", "serde_derive", @@ -689,7 +676,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "terminal_size 0.3.0", + "terminal_size", ] [[package]] @@ -1234,14 +1221,20 @@ dependencies = [ [[package]] name = "fs4" -version = "0.6.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" +checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" dependencies = [ "rustix 0.38.31", "windows-sys 0.48.0", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "fslock" version = "0.2.1" @@ -1791,17 +1784,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is-terminal" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe8f25ce1159c7740ff0b9b2f5cdf4a8428742ba7c112b9f20f22cd5219c7dab" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "is_ci" version = "1.2.0" @@ -2066,17 +2048,27 @@ name = "miette" version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +dependencies = [ + "miette-derive 5.10.0", + "once_cell", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98a72adfa0c7ae88ba0abcbd00047a476616c66b831d628b8ac7f1e9de0cfd67" dependencies = [ "backtrace", "backtrace-ext", - "is-terminal", - "miette-derive", - "once_cell", + "miette-derive 7.0.0", "owo-colors", "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size 0.1.17", + "terminal_size", "textwrap", "thiserror", "unicode-width", @@ -2093,6 +2085,17 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "miette-derive" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279def6bf114a34b3cf887489eb440d4dfcf709ab3ce9955e4a6f957ce5cce77" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "mime" version = "0.3.17" @@ -2447,9 +2450,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "owo-colors" -version = "3.5.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" [[package]] name = "parking" @@ -2547,11 +2550,11 @@ checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922" [[package]] name = "pep440_rs" -version = "0.3.12" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887f66cc62717ea72caac4f1eb4e6f392224da3ffff3f40ec13ab427802746d6" +checksum = "e0c29f9c43de378b4e4e0cd7dbcce0e5cfb80443de8c05620368b2948bc936a1" dependencies = [ - "lazy_static", + "once_cell", "regex", "serde", "unicode-width", @@ -2559,9 +2562,9 @@ dependencies = [ [[package]] name = "pep508_rs" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4516b53d9ea6112ebb38b4af08d5707d30b994fb7f98ff133c5dcf7ed8fa854" +checksum = "910c513bea0f4f833122321c0f20e8c704e01de98692f6989c2ec21f43d88b1e" dependencies = [ "anyhow", "once_cell", @@ -2705,7 +2708,7 @@ dependencies = [ "itertools 0.12.1", "lazy_static", "libc", - "miette", + "miette 7.0.0", "minijinja", "nix 0.27.1", "once_cell", @@ -2713,7 +2716,7 @@ dependencies = [ "pep508_rs", "rattler", "rattler_conda_types", - "rattler_digest 0.17.0", + "rattler_digest", "rattler_installs_packages", "rattler_lock", "rattler_networking", @@ -2867,9 +2870,9 @@ dependencies = [ [[package]] name = "pyproject-toml" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46d4a5e69187f23a29f8aa0ea57491d104ba541bc55f76552c2a74962aa20e04" +checksum = "95c3dd745f99aa3c554b7bb00859f7d18c2f1d6afd749ccc86d60b61e702abd9" dependencies = [ "indexmap 2.2.2", "pep440_rs", @@ -2935,11 +2938,10 @@ dependencies = [ [[package]] name = "rattler" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64882db05a84394da66ca78e0a738b7f883a411ae66ff0be2e3af375fecb9666" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "anyhow", - "async-compression 0.4.6", + "async-compression", "bytes", "chrono", "digest", @@ -2956,7 +2958,7 @@ dependencies = [ "once_cell", "pin-project-lite", "rattler_conda_types", - "rattler_digest 0.17.0", + "rattler_digest", "rattler_networking", "rattler_package_streaming", "reflink-copy", @@ -2980,8 +2982,7 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf438bb2467bc91cef3dcf254e1146e8ea23afd6cbe76799e53a50d0d1d71079" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "chrono", "fxhash", @@ -2992,7 +2993,7 @@ dependencies = [ "lazy-regex", "nom", "purl", - "rattler_digest 0.17.0", + "rattler_digest", "rattler_macros", "regex", "serde", @@ -3007,26 +3008,10 @@ dependencies = [ "url", ] -[[package]] -name = "rattler_digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881d6040b07c00070386bc7d98f21b71474a0b7847fa5b32a7c5a0a01d028f8f" -dependencies = [ - "blake2", - "digest", - "hex", - "md-5", - "serde", - "serde_with", - "sha2", -] - [[package]] name = "rattler_digest" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26606e577c9c5b214023c8a31a12753cffd2b09a6768d1d556b99ae9d730bc23" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "blake2", "digest", @@ -3040,9 +3025,9 @@ dependencies = [ [[package]] name = "rattler_installs_packages" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3916e697ffc9689112b0fd28d70e753d68b88660ad1418bb11fb2d75600d9592" +checksum = "a79b4b50124f1f9c266583862c974019e66e953139f954e776a1e52268b2d262" dependencies = [ "async-once-cell", "async-recursion", @@ -3060,6 +3045,7 @@ dependencies = [ "flate2", "fs-err", "fs4", + "fs_extra", "futures", "html-escape", "http", @@ -3067,7 +3053,7 @@ dependencies = [ "include_dir", "indexmap 2.2.2", "itertools 0.12.1", - "miette", + "miette 7.0.0", "mime", "once_cell", "parking_lot", @@ -3077,11 +3063,11 @@ dependencies = [ "pep508_rs", "pin-project-lite", "pyproject-toml", - "rattler_digest 0.9.0", + "rattler_digest", "regex", "reqwest", "reqwest-middleware", - "resolvo", + "resolvo 0.4.0", "serde", "serde_json", "serde_with", @@ -3100,8 +3086,7 @@ dependencies = [ [[package]] name = "rattler_lock" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35afe71e12907bebf4c9c69f92cb991aac06c1c505ab7a5b39e451ff6dad0747" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "chrono", "fxhash", @@ -3111,7 +3096,7 @@ dependencies = [ "pep508_rs", "purl", "rattler_conda_types", - "rattler_digest 0.17.0", + "rattler_digest", "serde", "serde-json-python-formatter", "serde_json", @@ -3124,8 +3109,7 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206cc71800e9ba58c50215e7e53d0000e6a04829b2ef51e1f76a6ee4c26bd93f" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "quote", "syn 2.0.48", @@ -3134,8 +3118,7 @@ dependencies = [ [[package]] name = "rattler_networking" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8970cb99764a9231d45cb8c520468e5aadf1731996cdeb27ba87eb629227c73" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "anyhow", "async-trait", @@ -3163,8 +3146,7 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1ba1b857bd0dcd41edf1fd3af81a8d15641b9d0a273b58d6faa640d71d2dbf" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "bzip2", "chrono", @@ -3172,7 +3154,7 @@ dependencies = [ "itertools 0.12.1", "num_cpus", "rattler_conda_types", - "rattler_digest 0.17.0", + "rattler_digest", "rattler_networking", "reqwest", "reqwest-middleware", @@ -3190,11 +3172,10 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da052dabd1d359a74b81eb0480ff6ee3149ac45877fabb7a1b4be6d61336aa8" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "anyhow", - "async-compression 0.4.6", + "async-compression", "blake2", "cache_control", "chrono", @@ -3210,7 +3191,7 @@ dependencies = [ "ouroboros", "pin-project-lite", "rattler_conda_types", - "rattler_digest 0.17.0", + "rattler_digest", "rattler_networking", "reqwest", "reqwest-middleware", @@ -3230,8 +3211,7 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4437834a7cec85a246dbf64241125c8d16acc9e3d990884acfbb5e359e6f4318" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "enum_dispatch", "indexmap 2.2.2", @@ -3248,16 +3228,15 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76b7cb1b5c5559546f5337145eff7aedfcd4b96d412cf00ee3a852b0230c19d0" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "anyhow", "chrono", "hex", "itertools 0.12.1", "rattler_conda_types", - "rattler_digest 0.17.0", - "resolvo", + "rattler_digest", + "resolvo 0.3.0", "serde", "tempfile", "thiserror", @@ -3268,8 +3247,7 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863fe4a198900906da025f8f8e27c8b1c7256a01984447f94ef9e7284a1cb5c8" +source = "git+https://github.com/mamba-org/rattler?branch=main#aaf2648579d245dcbaab20a2b0f061d7bcaf016e" dependencies = [ "cfg-if", "libloading", @@ -3390,7 +3368,7 @@ version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "async-compression 0.4.6", + "async-compression", "base64", "bytes", "encoding_rs", @@ -3461,6 +3439,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "resolvo" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2016584c3fd9df0fd859a7dcbc7fafdc7fdd2d87b53a576e8e63e62fad140e33" +dependencies = [ + "bitvec", + "elsa", + "event-listener 5.0.0", + "futures", + "itertools 0.12.1", + "petgraph", + "tokio", + "tracing", +] + [[package]] name = "retry-policies" version = "0.2.1" @@ -4026,7 +4020,7 @@ dependencies = [ "base64", "digest", "hex", - "miette", + "miette 5.10.0", "serde", "sha-1", "sha2", @@ -4088,31 +4082,24 @@ checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" [[package]] name = "supports-color" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" +checksum = "9829b314621dfc575df4e409e79f9d6a66a3bd707ab73f23cb4aa3a854ac854f" dependencies = [ - "is-terminal", "is_ci", ] [[package]] name = "supports-hyperlinks" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84231692eb0d4d41e4cdd0cabfdd2e6cd9e255e65f80c9aa7c98dd502b4233d" -dependencies = [ - "is-terminal", -] +checksum = "2c0a1e5168041f5f3ff68ff7d95dcb9c8749df29f6e7e89ada40dd4c9de404ee" [[package]] name = "supports-unicode" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f850c19edd184a205e883199a261ed44471c81e39bd95b1357f5febbef00e77a" -dependencies = [ - "is-terminal", -] +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" @@ -4225,16 +4212,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "terminal_size" version = "0.3.0" @@ -4247,9 +4224,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" dependencies = [ "smawk", "unicode-linebreak", diff --git a/Cargo.toml b/Cargo.toml index 343ff3144..76975952b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,11 +38,11 @@ insta = { version = "1.34.0", features = ["yaml"] } is_executable = "1.0.1" itertools = "0.12.1" lazy_static = "1.4.0" -miette = { version = "5.10.0", features = ["fancy", "supports-color", "supports-hyperlinks", "supports-unicode", "terminal_size", "textwrap"] } +miette = { version = "7.0.0", features = ["fancy", "supports-color", "supports-hyperlinks", "supports-unicode", "terminal_size", "textwrap"] } minijinja = { version = "1.0.12", features = ["builtins"] } once_cell = "1.19.0" -pep440_rs = "0.3.12" -pep508_rs = { version = "0.2.3", features = ["modern"] } +pep440_rs = "0.4.0" +pep508_rs = { version = "0.3.0", features = ["modern"] } rattler = { version = "0.17.0", default-features = false } rattler_conda_types = { version = "0.17.0", default-features = false } rattler_digest = { version = "0.17.0", default-features = false } @@ -55,7 +55,7 @@ rattler_virtual_packages = { version = "0.17.0", default-features = false } regex = "1.10.3" reqwest = { version = "0.11.24", default-features = false } reqwest-middleware = "0.2.4" -rip = { package = "rattler_installs_packages", version = "0.5.0", default-features = false } +rip = { package = "rattler_installs_packages", version = "0.7.0", default-features = false } self-replace = "1.3.7" serde = "1.0.196" serde-untagged = "0.1.5" @@ -91,15 +91,15 @@ tokio = { version = "1.36.0", features = ["rt"] } toml = "0.8.10" [patch.crates-io] -#rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_lock = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } -#rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_lock = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } #rip = { package = "rattler_installs_packages", git = "https://github.com/prefix-dev/rattler_installs_packages", branch = "main" } #resolvo = { git = "https://github.com/mamba-org/resolvo.git", branch = "main" } #deno_task_shell = { path = "../deno_task_shell" } diff --git a/src/environment.rs b/src/environment.rs index e3ffd3e94..7d0e7fa68 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -1,4 +1,5 @@ use miette::{Context, IntoDiagnostic}; +use rip::resolve::solve_options::SDistResolution; use crate::lock_file::{resolve_pypi, LockedCondaPackages, LockedPypiPackages}; use crate::project::virtual_packages::get_minimal_virtual_packages; @@ -34,7 +35,7 @@ use rattler_conda_types::{ use rattler_lock::{LockFile, Package, PypiPackageData, PypiPackageEnvironmentData}; use rattler_repodata_gateway::sparse::SparseRepoData; use reqwest_middleware::ClientWithMiddleware; -use rip::{index::PackageDb, resolve::SDistResolution}; +use rip::index::PackageDb; use std::{ borrow::Cow, collections::{HashMap, HashSet}, @@ -1563,7 +1564,7 @@ async fn spawn_solve_pypi_task( pb.start(); let result = resolve_pypi( - &package_db, + package_db, dependencies, system_requirements, &repodata_records, diff --git a/src/install_pypi.rs b/src/install_pypi.rs index 79f108b85..ea206f046 100644 --- a/src/install_pypi.rs +++ b/src/install_pypi.rs @@ -7,6 +7,7 @@ use indexmap::IndexSet; use indicatif::ProgressBar; use itertools::Itertools; use miette::{IntoDiagnostic, WrapErr}; +use rip::resolve::solve_options::{ResolveOptions, SDistResolution}; use crate::consts::PROJECT_MANIFEST; use crate::project::manifest::SystemRequirements; @@ -22,12 +23,12 @@ use rip::python_env::{ find_distributions_in_venv, uninstall_distribution, Distribution, PythonLocation, WheelTag, WheelTags, }; -use rip::resolve::{ResolveOptions, SDistResolution}; use rip::types::{ - Artifact, ArtifactHashes, ArtifactInfo, ArtifactName, Extra, NormalizedPackageName, + ArtifactHashes, ArtifactInfo, ArtifactName, Extra, HasArtifactName, NormalizedPackageName, }; use rip::wheel_builder::WheelBuilder; use std::collections::{HashMap, HashSet}; +use std::ops::Deref; use std::path::Path; use std::str::FromStr; use std::sync::Arc; @@ -302,6 +303,7 @@ fn stream_python_artifacts( requires_python: pkg_data.requires_python.clone(), dist_info_metadata: Default::default(), yanked: Default::default(), + is_direct_url: false, }; let wheel = tokio::spawn({ @@ -311,10 +313,10 @@ fn stream_python_artifacts( let package_db = package_db.clone(); async move { let wheel_builder = WheelBuilder::new( - &package_db, - &marker_environment, - Some(&compatible_tags), - &resolve_options, + package_db.clone(), + marker_environment, + Some(compatible_tags), + resolve_options.deref().clone(), HashMap::default(), ) .into_diagnostic() diff --git a/src/lock_file/mod.rs b/src/lock_file/mod.rs index d244744da..6faf0ef9a 100644 --- a/src/lock_file/mod.rs +++ b/src/lock_file/mod.rs @@ -12,8 +12,8 @@ use miette::IntoDiagnostic; use rattler_conda_types::{GenericVirtualPackage, MatchSpec, Platform, RepoDataRecord}; use rattler_lock::{LockFile, PackageHashes, PypiPackageData, PypiPackageEnvironmentData}; use rattler_solve::{resolvo, SolverImpl}; -use rip::{index::PackageDb, resolve::SDistResolution}; -use std::path::Path; +use rip::{index::PackageDb, resolve::solve_options::SDistResolution}; +use std::{path::Path, sync::Arc}; use crate::project::manifest::{PyPiRequirement, SystemRequirements}; pub use satisfiability::{ @@ -41,7 +41,7 @@ pub async fn load_lock_file(project: &Project) -> miette::Result { #[allow(clippy::too_many_arguments)] pub async fn resolve_pypi( - package_db: &PackageDb, + package_db: Arc, dependencies: IndexMap>, system_requirements: SystemRequirements, locked_conda_records: &[RepoDataRecord], @@ -54,7 +54,7 @@ pub async fn resolve_pypi( // Solve python packages pb.set_message("resolving pypi dependencies"); let python_artifacts = pypi::resolve_dependencies( - package_db, + package_db.clone(), dependencies, system_requirements, platform, diff --git a/src/lock_file/package_identifier.rs b/src/lock_file/package_identifier.rs index d53c9a182..491995d83 100644 --- a/src/lock_file/package_identifier.rs +++ b/src/lock_file/package_identifier.rs @@ -226,7 +226,7 @@ pub enum ConversionError { Extra(String), } -impl<'a> From for PinnedPackage<'a> { +impl From for PinnedPackage { fn from(value: PypiPackageIdentifier) -> Self { PinnedPackage { name: value.name, @@ -234,6 +234,7 @@ impl<'a> From for PinnedPackage<'a> { extras: value.extras, // We are not aware of artifacts for conda python packages. artifacts: vec![], + url: None, } } } diff --git a/src/lock_file/pypi.rs b/src/lock_file/pypi.rs index 4ce22bb29..48924a4a8 100644 --- a/src/lock_file/pypi.rs +++ b/src/lock_file/pypi.rs @@ -9,21 +9,23 @@ use miette::{Context, IntoDiagnostic}; use rattler_conda_types::{Platform, RepoDataRecord}; use rip::index::PackageDb; use rip::python_env::PythonLocation; -use rip::resolve::{resolve, PinnedPackage, ResolveOptions, SDistResolution}; +use rip::resolve::solve_options::{ResolveOptions, SDistResolution}; +use rip::resolve::{resolve, PinnedPackage}; use rip::types::PackageName; use std::path::Path; +use std::sync::Arc; use std::{collections::HashMap, vec}; /// Resolve python packages for the specified project. pub async fn resolve_dependencies<'db>( - package_db: &'db PackageDb, + package_db: Arc, dependencies: IndexMap>, system_requirements: SystemRequirements, platform: Platform, conda_packages: &[RepoDataRecord], python_location: Option<&Path>, sdist_resolution: SDistResolution, -) -> miette::Result>> { +) -> miette::Result> { if dependencies.is_empty() { return Ok(vec![]); } @@ -85,14 +87,14 @@ pub async fn resolve_dependencies<'db>( let mut result = resolve( package_db, &requirements, - &marker_environment, - Some(&compatible_tags), + Arc::new(marker_environment), + Some(Arc::new(compatible_tags)), conda_python_packages .into_iter() .map(|p| (p.name.clone(), p)) .collect(), HashMap::default(), - &ResolveOptions { + ResolveOptions { sdist_resolution, python_location, ..Default::default() diff --git a/src/project/manifest/validation.rs b/src/project/manifest/validation.rs index 4c6dcfb38..f304a6a74 100644 --- a/src/project/manifest/validation.rs +++ b/src/project/manifest/validation.rs @@ -13,7 +13,7 @@ use std::{ impl ProjectManifest { /// Validate the project manifest. - pub fn validate(&self, source: NamedSource, root_folder: &Path) -> miette::Result<()> { + pub fn validate(&self, source: NamedSource, root_folder: &Path) -> miette::Result<()> { // Check if the targets are defined for existing platforms for feature in self.features.values() { let platforms = feature @@ -148,7 +148,7 @@ impl ProjectManifest { // Create an error report for using a platform that is not supported by the project. fn create_unsupported_platform_report( - source: NamedSource, + source: NamedSource, span: Range, platform: &Platform, feature: &Feature, diff --git a/src/project/mod.rs b/src/project/mod.rs index b498b23d4..dc76b65f0 100644 --- a/src/project/mod.rs +++ b/src/project/mod.rs @@ -11,6 +11,7 @@ use once_cell::sync::OnceCell; use rattler_conda_types::{Channel, GenericVirtualPackage, Platform, Version}; use rattler_networking::AuthenticationMiddleware; use reqwest_middleware::ClientWithMiddleware; +use rip::index::PackageSources; use rip::{index::PackageDb, normalize_index_url}; use std::hash::Hash; use std::{ @@ -140,7 +141,7 @@ impl Project { /// Returns the source code of the project as [`NamedSource`]. /// Used in error reporting. - pub fn manifest_named_source(&self) -> NamedSource { + pub fn manifest_named_source(&self) -> NamedSource { NamedSource::new(PROJECT_MANIFEST, self.manifest.contents.clone()) } @@ -366,9 +367,8 @@ impl Project { } /// Returns the Python index URLs to use for this project. - pub fn pypi_index_urls(&self) -> Vec { - let index_url = normalize_index_url(Url::parse("https://pypi.org/simple/").unwrap()); - vec![index_url] + pub fn pypi_index_url(&self) -> Url { + normalize_index_url(Url::parse("https://pypi.org/simple/").unwrap()) } /// Returns the package database used for caching python metadata, wheels and more. See the @@ -378,11 +378,10 @@ impl Project { .package_db .get_or_try_init(|| { PackageDb::new( + PackageSources::from(self.pypi_index_url()), self.authenticated_client().clone(), - &self.pypi_index_urls(), &config::get_cache_dir()?.join("pypi/"), ) - .into_diagnostic() .map(Arc::new) })? .clone())