Skip to content

Commit

Permalink
chore: upgrade dependencies (#929)
Browse files Browse the repository at this point in the history
Co-authored-by: Bas Zalmstra <bas@prefix.dev>
  • Loading branch information
ruben-arts and baszalmstra authored Mar 9, 2024
1 parent 27a748c commit 3863d10
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 136 deletions.
175 changes: 107 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ assert_matches = "1.5.0"
async-once-cell = "0.5.3"
async-recursion = "1.0.5"
async-scoped = { version = "0.9.0", features = ["use-tokio"] }
cfg-if = "0.1"
chrono = "0.4.34"
clap = { version = "4.5.1", default-features = false, features = [
cfg-if = "1.0"
chrono = "0.4.35"
clap = { version = "4.5.2", default-features = false, features = [
"derive",
"usage",
"wrap_help",
Expand Down Expand Up @@ -77,25 +77,25 @@ pep508_rs = { git = "https://github.com/astral-sh/uv", tag = "0.1.16" }
platform-host = { git = "https://github.com/astral-sh/uv", tag = "0.1.16" }
platform-tags = { git = "https://github.com/astral-sh/uv", tag = "0.1.16" }
pypi-types = { git = "https://github.com/astral-sh/uv", tag = "0.1.16" }
rattler = { version = "0.19.0", default-features = false }
rattler_conda_types = { version = "0.19.0", default-features = false }
rattler_digest = { version = "0.19.0", default-features = false }
rattler_lock = { version = "0.19.0", default-features = false }
rattler_networking = { version = "0.19.0", default-features = false }
rattler_repodata_gateway = { version = "0.19.0", default-features = false, features = [
rattler = { version = "0.19.2", default-features = false }
rattler_conda_types = { version = "0.20.1", default-features = false }
rattler_digest = { version = "0.19.1", default-features = false }
rattler_lock = { version = "0.20.1", default-features = false }
rattler_networking = { version = "0.19.1", default-features = false }
rattler_repodata_gateway = { version = "0.19.2", default-features = false, features = [
"sparse",
] }
rattler_shell = { version = "0.19.0", default-features = false, features = [
rattler_shell = { version = "0.19.2", default-features = false, features = [
"sysinfo",
] }
rattler_solve = { version = "0.19.0", default-features = false, features = [
rattler_solve = { version = "0.20.1", default-features = false, features = [
"resolvo",
] }
rattler_virtual_packages = { version = "0.19.0", default-features = false }
rattler_virtual_packages = { version = "0.19.2", default-features = false }
regex = "1.10.3"
reqwest = { version = "0.11.24", default-features = false }
reqwest-middleware = "0.2.4"
reqwest-retry = "0.3.0"
reqwest-retry = "0.4.0"
self-replace = "1.3.7"
serde = "1.0.197"
serde-untagged = "0.1.5"
Expand Down Expand Up @@ -145,7 +145,7 @@ libc = { version = "0.2.153", default-features = false }
signal-hook = "0.3.17"

[dev-dependencies]
rattler_digest = "0.19.0"
rattler_digest = "0.19.1"
rstest = "0.18.2"
serde_json = "1.0.114"
serial_test = "3.0.0"
Expand All @@ -158,15 +158,15 @@ toml = "0.8.10"
pep440_rs = { git = "https://github.com/astral-sh/uv", tag = "0.1.16" }
pep508_rs = { git = "https://github.com/astral-sh/uv", tag = "0.1.16" }

rattler = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_conda_types = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_digest = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_lock = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_networking = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_shell = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_solve = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_conda_types = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_digest = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_lock = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_networking = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_shell = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_solve = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", rev = "7e0a130f0603fc2ff204649df9adba78422de2c8" }
#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" }
Expand Down
4 changes: 2 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ compilers = ">=1.6.0"

[feature.docs.dependencies]
mkdocs = "1.5.3.*"
mkdocs-material = ">=9.5.*"
pillow = ">=9.4.0.*"
mkdocs-material = ">=9.5"
pillow = ">=9.4.0"
cairosvg = "2.7.1.*"
mike = "2.0.0.*"

Expand Down
6 changes: 3 additions & 3 deletions src/cli/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use indexmap::IndexMap;
use miette::{IntoDiagnostic, WrapErr};
use rattler_conda_types::{
version_spec::{LogicalOperator, RangeOperator},
Channel, MatchSpec, NamelessMatchSpec, PackageName, Platform, Version, VersionBumpType,
VersionSpec,
Channel, MatchSpec, NamelessMatchSpec, PackageName, ParseStrictness, Platform, Version,
VersionBumpType, VersionSpec,
};
use rattler_repodata_gateway::sparse::SparseRepoData;
use rattler_solve::{resolvo, SolverImpl};
Expand Down Expand Up @@ -142,7 +142,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
.specs
.clone()
.into_iter()
.map(|s| MatchSpec::from_str(&s))
.map(|s| MatchSpec::from_str(&s, ParseStrictness::Strict))
.collect::<Result<Vec<_>, _>>()
.into_diagnostic()?;
add_conda_specs_to_project(
Expand Down
12 changes: 6 additions & 6 deletions src/cli/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use itertools::Itertools;
use miette::IntoDiagnostic;
use rattler::install::Transaction;
use rattler::package_cache::PackageCache;
use rattler_conda_types::{Channel, ChannelConfig, MatchSpec, PackageName, Platform, PrefixRecord};
use rattler_conda_types::{
Channel, ChannelConfig, MatchSpec, PackageName, ParseStrictness, Platform, PrefixRecord,
};
use rattler_networking::AuthenticationMiddleware;
use rattler_repodata_gateway::sparse::SparseRepoData;
use rattler_shell::{
Expand All @@ -19,11 +21,9 @@ use rattler_shell::{
use rattler_solve::{resolvo, SolverImpl};
use reqwest_middleware::ClientWithMiddleware;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::{
path::{Path, PathBuf},
str::FromStr,
};
use ParseStrictness::Strict;

/// Installs the defined package in a global accessible location.
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -341,7 +341,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
let specs = args
.package
.into_iter()
.map(|package_str| MatchSpec::from_str(&package_str))
.map(|package_str| MatchSpec::from_str(&package_str, Strict))
.collect::<Result<Vec<_>, _>>()
.into_diagnostic()?;

Expand Down
4 changes: 2 additions & 2 deletions src/cli/global/remove.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::collections::HashSet;
use std::str::FromStr;

use clap::Parser;
use clap_verbosity_flag::{Level, Verbosity};
use itertools::Itertools;
use miette::IntoDiagnostic;
use rattler_conda_types::ParseStrictness::Strict;
use rattler_conda_types::{MatchSpec, PackageName};

use crate::cli::global::install::{
Expand All @@ -28,7 +28,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
let specs = args
.package
.into_iter()
.map(|package_str| MatchSpec::from_str(&package_str))
.map(|package_str| MatchSpec::from_str(&package_str, Strict))
.collect::<Result<Vec<_>, _>>()
.into_diagnostic()?;
let packages = specs
Expand Down
4 changes: 2 additions & 2 deletions src/cli/global/upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::str::FromStr;
use std::sync::Arc;

use clap::Parser;
use miette::IntoDiagnostic;
use rattler_conda_types::ParseStrictness::Strict;
use rattler_conda_types::{Channel, ChannelConfig, MatchSpec, Platform};
use rattler_networking::AuthenticationMiddleware;

Expand Down Expand Up @@ -41,7 +41,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
.into_diagnostic()?;

// Find the MatchSpec we want to install
let package_matchspec = MatchSpec::from_str(&package).into_diagnostic()?;
let package_matchspec = MatchSpec::from_str(&package, Strict).into_diagnostic()?;

// Return with error if this package is not globally installed.
if !list_global_packages()
Expand Down
31 changes: 18 additions & 13 deletions src/cli/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use indexmap::IndexMap;
use itertools::Itertools;
use miette::IntoDiagnostic;
use minijinja::{context, Environment};
use rattler_conda_types::ParseStrictness::{Lenient, Strict};
use rattler_conda_types::{Channel, ChannelConfig, MatchSpec, Platform};
use regex::Regex;
use std::io::{Error, ErrorKind, Write};
Expand Down Expand Up @@ -318,7 +319,7 @@ fn parse_dependencies(deps: Vec<CondaEnvDep>) -> miette::Result<ParsedDependenci
for dep in deps {
match dep {
CondaEnvDep::Conda(d) => {
let match_spec = MatchSpec::from_str(&d).into_diagnostic()?;
let match_spec = MatchSpec::from_str(&d, Lenient).into_diagnostic()?;
if let Some(channel) = match_spec.clone().channel {
picked_up_channels.push(channel);
}
Expand Down Expand Up @@ -351,7 +352,7 @@ fn parse_dependencies(deps: Vec<CondaEnvDep>) -> miette::Result<ParsedDependenci
.is_some()
})
{
conda_deps.push(MatchSpec::from_str("pip").into_diagnostic()?);
conda_deps.push(MatchSpec::from_str("pip", Strict).into_diagnostic()?);
}

Ok((conda_deps, pip_deps, picked_up_channels))
Expand Down Expand Up @@ -396,18 +397,18 @@ mod tests {
- conda-forge::pytest
- wheel=0.31.1
- sel(linux): blabla
- foo >=1.2.3.* # only valid when parsing in lenient mode
- pip:
- requests
- git+https://git@github.com/fsschneider/DeepOBS.git@develop#egg=deepobs
- torch==1.8.1
"#;

let f = tempfile::NamedTempFile::new().unwrap();
let path = f.path();
let mut file = std::fs::File::create(path).unwrap();
file.write_all(example_conda_env_file.as_bytes()).unwrap();
let mut f = tempfile::NamedTempFile::new().unwrap();
f.write_all(example_conda_env_file.as_bytes()).unwrap();
let (_file, path) = f.into_parts();

let conda_env_file_data = CondaEnvFile::from_path(path).unwrap();
let conda_env_file_data = CondaEnvFile::from_path(&path).unwrap();

assert_eq!(conda_env_file_data.name(), Some("pixi_example_project"));
assert_eq!(
Expand All @@ -433,11 +434,12 @@ mod tests {
assert_eq!(
conda_deps,
vec![
MatchSpec::from_str("python").unwrap(),
MatchSpec::from_str("pytorch::torchvision").unwrap(),
MatchSpec::from_str("conda-forge::pytest").unwrap(),
MatchSpec::from_str("wheel=0.31.1").unwrap(),
MatchSpec::from_str("pip").unwrap(),
MatchSpec::from_str("python", Strict).unwrap(),
MatchSpec::from_str("pytorch::torchvision", Strict).unwrap(),
MatchSpec::from_str("conda-forge::pytest", Strict).unwrap(),
MatchSpec::from_str("wheel=0.31.1", Strict).unwrap(),
MatchSpec::from_str("foo >=1.2.3", Strict).unwrap(),
MatchSpec::from_str("pip", Strict).unwrap(),
]
);

Expand Down Expand Up @@ -588,7 +590,10 @@ mod tests {
let (conda_deps, pip_deps, _) =
parse_dependencies(conda_env_file_data.dependencies().clone()).unwrap();

assert_eq!(conda_deps, vec![MatchSpec::from_str("pip==24.0").unwrap(),]);
assert_eq!(
conda_deps,
vec![MatchSpec::from_str("pip==24.0", Strict).unwrap(),]
);

assert_eq!(
pip_deps,
Expand Down
8 changes: 3 additions & 5 deletions src/lock_file/satisfiability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ use itertools::Itertools;
use miette::Diagnostic;
use pep440_rs::VersionSpecifiers;
use pep508_rs::Requirement;
use rattler_conda_types::ParseStrictness::Strict;
use rattler_conda_types::{MatchSpec, ParseMatchSpecError, Platform};
use rattler_lock::{CondaPackage, Package, PypiPackage};
use std::{
collections::{HashMap, HashSet},
str::FromStr,
};
use std::collections::{HashMap, HashSet};
use thiserror::Error;
use uv_normalize::PackageName;

Expand Down Expand Up @@ -223,7 +221,7 @@ pub fn verify_conda_platform_satisfiability(
.file_name()
.unwrap_or_else(|| record.package_record().name.as_normalized());
for depends in &record.package_record().depends {
let spec = MatchSpec::from_str(depends.as_str())
let spec = MatchSpec::from_str(depends.as_str(), Strict)
.map_err(|e| PlatformUnsat::FailedToParseMatchSpec(depends.clone(), e))?;
specs.push((spec, source))
}
Expand Down
25 changes: 18 additions & 7 deletions src/project/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pub use metadata::ProjectMetadata;
use miette::{miette, Diagnostic, IntoDiagnostic, LabeledSpan, NamedSource};
pub use python::PyPiRequirement;
use rattler_conda_types::{
ChannelConfig, MatchSpec, NamelessMatchSpec, PackageName, Platform, Version,
ChannelConfig, MatchSpec, NamelessMatchSpec, PackageName,
ParseStrictness::{Lenient, Strict},
Platform, Version,
};
use serde::de::{DeserializeSeed, MapAccess, Visitor};
use serde::{Deserialize, Deserializer};
Expand Down Expand Up @@ -953,7 +955,16 @@ impl<'de, 'a> DeserializeSeed<'de> for &'a NamelessMatchSpecWrapper {
D: Deserializer<'de>,
{
serde_untagged::UntaggedEnumVisitor::new()
.string(|str| NamelessMatchSpec::from_str(str).map_err(serde::de::Error::custom))
.string(|str| {
match NamelessMatchSpec::from_str(str, Strict) {
Ok(spec) => Ok(spec),
Err(_) => {
let spec = NamelessMatchSpec::from_str(str, Lenient).map_err(serde::de::Error::custom)?;
tracing::warn!("Parsed '{str}' as '{spec}', in a future version this will become an error.", spec=&spec);
Ok(spec)
}
}
})
.map(|map| {
NamelessMatchSpec::deserialize(serde::de::value::MapAccessDeserializer::new(map))
})
Expand Down Expand Up @@ -1180,7 +1191,7 @@ mod tests {
use super::*;
use crate::project::manifest::channel::PrioritizedChannel;
use insta::assert_snapshot;
use rattler_conda_types::{Channel, ChannelConfig};
use rattler_conda_types::{Channel, ChannelConfig, ParseStrictness};
use rstest::*;
use std::str::FromStr;
use tempfile::tempdir;
Expand Down Expand Up @@ -2501,7 +2512,7 @@ bar = "*"
let mut manifest = Manifest::from_str(Path::new(""), file_contents).unwrap();
manifest
.add_dependency(
&MatchSpec::from_str(" baz >=1.2.3").unwrap(),
&MatchSpec::from_str(" baz >=1.2.3", Strict).unwrap(),
SpecType::Run,
None,
&FeatureName::Default,
Expand All @@ -2522,7 +2533,7 @@ bar = "*"
);
manifest
.add_dependency(
&MatchSpec::from_str(" bal >=2.3").unwrap(),
&MatchSpec::from_str(" bal >=2.3", Strict).unwrap(),
SpecType::Run,
None,
&FeatureName::Named("test".to_string()),
Expand All @@ -2546,7 +2557,7 @@ bar = "*"

manifest
.add_dependency(
&MatchSpec::from_str(" boef >=2.3").unwrap(),
&MatchSpec::from_str(" boef >=2.3", Strict).unwrap(),
SpecType::Run,
Some(Platform::Linux64),
&FeatureName::Named("extra".to_string()),
Expand All @@ -2571,7 +2582,7 @@ bar = "*"

manifest
.add_dependency(
&MatchSpec::from_str(" cmake >=2.3").unwrap(),
&MatchSpec::from_str(" cmake >=2.3", ParseStrictness::Strict).unwrap(),
SpecType::Build,
Some(Platform::Linux64),
&FeatureName::Named("build".to_string()),
Expand Down
3 changes: 1 addition & 2 deletions src/pypi_name_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ use async_once_cell::OnceCell;
use http_cache_reqwest::{CACacheManager, Cache, CacheMode, HttpCache, HttpCacheOptions};
use miette::{IntoDiagnostic, WrapErr};
use rattler_conda_types::{PackageUrl, RepoDataRecord};
use rattler_networking::retry_policies::ExponentialBackoff;
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use reqwest_retry::RetryTransientMiddleware;
use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware};
use serde::Deserialize;
use std::{collections::HashMap, str::FromStr};
use url::Url;
Expand Down
Loading

0 comments on commit 3863d10

Please sign in to comment.