diff --git a/Cargo.lock b/Cargo.lock index 8a3d916c6..ad7a648e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2931,8 +2931,6 @@ dependencies = [ [[package]] name = "rattler" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66646eab0e70a01b8cf372e10e57a5022f8d111b18870078d2e186f6938f0c5c" dependencies = [ "anyhow", "async-compression", @@ -2977,8 +2975,6 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "085a4ebf784b325311890f7c1dfb9dc017cecb44049cfafef73e02e925e24e22" dependencies = [ "chrono", "fxhash", @@ -3022,8 +3018,6 @@ dependencies = [ [[package]] name = "rattler_digest" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e8b55bd7e3c9efa337b59a26964584975c345bf484eca9fb849b65c2674cee" dependencies = [ "blake2", "digest", @@ -3098,8 +3092,6 @@ dependencies = [ [[package]] name = "rattler_lock" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e0c6694a1e2ce7f9c3b08920ee717890fc7814ca36bcfefc7ec6fff9daac97" dependencies = [ "chrono", "fxhash", @@ -3122,8 +3114,6 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a96e90500af30b653b0c4e08fa572a6d4dfc821c5e213b510a195987b8ed133" dependencies = [ "quote", "syn 2.0.48", @@ -3132,8 +3122,6 @@ dependencies = [ [[package]] name = "rattler_networking" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc36da705ddde163d228bb140eecf521b390716b83db943a43f6606b31954b1" dependencies = [ "anyhow", "async-trait", @@ -3161,8 +3149,6 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27f4784ab14191fb9ae0218979f2ccee0f8cb1ca5c82440c7f38e0fd83808d6" dependencies = [ "bzip2", "chrono", @@ -3188,8 +3174,6 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbcfb255c1dc4e053c2fcac724d2ce404ec40056dea0a50c9f6d949c0a47a80" dependencies = [ "anyhow", "async-compression", @@ -3228,8 +3212,6 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abda3f6112eae2afef9e6b3bc88582c884c1c04765a4b9d7bcf2acb706eaded3" dependencies = [ "enum_dispatch", "indexmap 2.2.2", @@ -3246,8 +3228,6 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7f6035ffc8b6361917d50df6db53cb1002b2042eb6c2bd509dbb5697bbcca1" dependencies = [ "anyhow", "chrono", @@ -3267,8 +3247,6 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d1748ab835be1aab75c6a055889cded915b0e70b6787bd46e0abf9a8ba65a5" dependencies = [ "cfg-if", "libloading", diff --git a/Cargo.toml b/Cargo.toml index 20b652b5e..89882ac45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,19 @@ readme = "README.md" [features] default = ["native-tls"] -native-tls = ["reqwest/native-tls", "rattler_repodata_gateway/native-tls", "rattler/native-tls", "rip/native-tls"] -rustls-tls = ["reqwest/rustls-tls", "reqwest/rustls-tls-native-roots", "rattler_repodata_gateway/rustls-tls", "rattler/rustls-tls", "rip/rustls-tls"] +native-tls = [ + "reqwest/native-tls", + "rattler_repodata_gateway/native-tls", + "rattler/native-tls", + "rip/native-tls", +] +rustls-tls = [ + "reqwest/rustls-tls", + "reqwest/rustls-tls-native-roots", + "rattler_repodata_gateway/rustls-tls", + "rattler/rustls-tls", + "rip/rustls-tls", +] slow_integration_tests = [] [dependencies] @@ -21,7 +32,15 @@ async-once-cell = "0.5.3" async-recursion = "1.0.5" async-scoped = { version = "0.8.0", features = ["use-tokio"] } chrono = "0.4.33" -clap = { version = "4.5.0", default-features = false, features = ["derive", "usage", "wrap_help", "std", "color", "error-context", "env"] } +clap = { version = "4.5.0", default-features = false, features = [ + "derive", + "usage", + "wrap_help", + "std", + "color", + "error-context", + "env", +] } clap-verbosity-flag = "2.1.2" clap_complete = "4.5.0" console = { version = "0.15.8", features = ["windows-console-colors"] } @@ -39,7 +58,14 @@ insta = { version = "1.34.0", features = ["yaml"] } is_executable = "1.0.1" itertools = "0.12.1" lazy_static = "1.4.0" -miette = { version = "7.0.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.4.0" @@ -49,9 +75,15 @@ rattler_conda_types = { version = "0.18.0", default-features = false } rattler_digest = { version = "0.18.0", default-features = false } rattler_lock = { version = "0.18.0", default-features = false } rattler_networking = { version = "0.18.0", default-features = false } -rattler_repodata_gateway = { version = "0.18.0", default-features = false, features = ["sparse"] } -rattler_shell = { version = "0.18.0", default-features = false, features = ["sysinfo"] } -rattler_solve = { version = "0.18.0", default-features = false, features = ["resolvo"] } +rattler_repodata_gateway = { version = "0.18.0", default-features = false, features = [ + "sparse", +] } +rattler_shell = { version = "0.18.0", default-features = false, features = [ + "sysinfo", +] } +rattler_solve = { version = "0.18.0", default-features = false, features = [ + "resolvo", +] } rattler_virtual_packages = { version = "0.18.0", default-features = false } regex = "1.10.3" reqwest = { version = "0.11.24", default-features = false } @@ -71,16 +103,28 @@ tabwriter = { version = "1.4.0", features = ["ansi_formatting"] } tar = "0.4.40" tempfile = "3.10.0" thiserror = "1.0.56" -tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread", "signal"] } +tokio = { version = "1.36.0", features = [ + "macros", + "rt-multi-thread", + "signal", +] } tokio-util = "0.7.10" toml_edit = { version = "0.21.1", features = ["serde"] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } url = "2.5.0" -zip = { version = "0.6.6", default-features = false, features = ["deflate", "time"] } +zip = { version = "0.6.6", default-features = false, features = [ + "deflate", + "time", +] } [target.'cfg(unix)'.dependencies] -nix = { version = "0.27.1", default-features = false, features = ["fs", "signal", "term", "poll"] } +nix = { version = "0.27.1", default-features = false, features = [ + "fs", + "signal", + "term", + "poll", +] } libc = { version = "0.2.153", default-features = false } signal-hook = "0.3.17" @@ -106,13 +150,13 @@ toml = "0.8.10" #resolvo = { git = "https://github.com/mamba-org/resolvo.git", branch = "main" } #deno_task_shell = { path = "../deno_task_shell" } -#rattler = { path = "../rattler/crates/rattler" } -#rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } -#rattler_digest = { path = "../rattler/crates/rattler_digest" } -#rattler_networking = { path = "../rattler/crates/rattler_networking" } -#rattler_repodata_gateway = { path = "../rattler/crates/rattler_repodata_gateway" } -#rattler_shell = { path = "../rattler/crates/rattler_shell" } -#rattler_solve = { path = "../rattler/crates/rattler_solve" } -#rattler_virtual_packages = { path = "../rattler/crates/rattler_virtual_packages" } -#rattler_lock = { path = "../rattler/crates/rattler_lock" } -#rip = { package = "rattler_installs_packages", path = "../rip" } +rattler = { path = "../rattler/crates/rattler" } +rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } +rattler_digest = { path = "../rattler/crates/rattler_digest" } +rattler_networking = { path = "../rattler/crates/rattler_networking" } +rattler_repodata_gateway = { path = "../rattler/crates/rattler_repodata_gateway" } +rattler_shell = { path = "../rattler/crates/rattler_shell" } +rattler_solve = { path = "../rattler/crates/rattler_solve" } +rattler_virtual_packages = { path = "../rattler/crates/rattler_virtual_packages" } +rattler_lock = { path = "../rattler/crates/rattler_lock" } +# rip = { package = "rattler_installs_packages", path = "../rip" } diff --git a/src/cli/add.rs b/src/cli/add.rs index ced94b1fd..eaa23dda1 100644 --- a/src/cli/add.rs +++ b/src/cli/add.rs @@ -56,7 +56,7 @@ pub struct Args { /// - `pixi add --pypi boto3` /// - `pixi add --pypi "boto3==version" /// - #[arg(required = true)] + #[arg(required = true, value_parser = Args::parse_specs)] pub specs: Vec, /// The path to 'pixi.toml' @@ -88,6 +88,21 @@ pub struct Args { pub platform: Vec, } +impl Args { + /// Custom string parser for the dependencies. + /// + /// Disallows strings with non-lowercase characters. + fn parse_specs(specs: &str) -> Result { + if specs.chars().any(|v| !v.is_lowercase()) { + Err(String::from( + "please avoid using capitalized dependency names", + )) + } else { + Ok(specs.to_string()) + } + } +} + impl DependencyType { pub fn from_args(args: &Args) -> Self { if args.pypi { diff --git a/src/project/manifest/mod.rs b/src/project/manifest/mod.rs index 0ed894c22..9d57f7195 100644 --- a/src/project/manifest/mod.rs +++ b/src/project/manifest/mod.rs @@ -355,14 +355,6 @@ impl Manifest { miette::bail!("pixi does not support wildcard dependencies") }; - // Check for duplicates. - if dependency_table.contains_key(name.as_source()) { - return Err(miette::miette!( - "{} is already added.", - console::style(name.as_normalized()).bold(), - )); - } - // Store (or replace) in the document dependency_table.insert(name.as_source(), Item::Value(spec.to_string().into())); @@ -392,14 +384,6 @@ impl Manifest { consts::PYPI_DEPENDENCIES, )?; - // Check for duplicates. - if dependency_table.contains_key(name.as_str()) { - return Err(miette::miette!( - "{} is already added.", - console::style(name.as_source_str()).bold(), - )); - } - // Add the pypi dependency to the table dependency_table.insert(name.as_str(), (*requirement).clone().into());