diff --git a/Cargo.lock b/Cargo.lock index b2bf41e7..034dcacd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1706,18 +1706,6 @@ dependencies = [ "zip", ] -[[package]] -name = "rattler_libsolv_rs" -version = "0.8.0" -source = "git+https://github.com/baszalmstra/rattler?branch=refactor/lazy_solver#babf03e8d99758cfc820186bff918bb8b3853bd0" -dependencies = [ - "bitvec", - "elsa", - "itertools", - "petgraph", - "tracing", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -1830,6 +1818,19 @@ dependencies = [ "winreg", ] +[[package]] +name = "resolvo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dab30801b54723f1949c6453a35db09c89e2ce7e052dc63e715f32fb40e427c" +dependencies = [ + "bitvec", + "elsa", + "itertools", + "petgraph", + "tracing", +] + [[package]] name = "rip" version = "0.1.0" @@ -1843,8 +1844,8 @@ dependencies = [ "miette", "rand", "rattler_installs_packages", - "rattler_libsolv_rs", "reqwest", + "resolvo", "rusqlite", "serde", "serde_json", diff --git a/crates/rattler_installs_packages/src/package_database.rs b/crates/rattler_installs_packages/src/package_database.rs index 964c5475..01ad072f 100644 --- a/crates/rattler_installs_packages/src/package_database.rs +++ b/crates/rattler_installs_packages/src/package_database.rs @@ -6,7 +6,6 @@ use crate::{ artifact_name::InnerAsArtifactName, html, http::{CacheMode, Http}, - package_name::PackageName, project_info::{ArtifactInfo, ProjectInfo}, FileStore, NormalizedPackageName, }; diff --git a/crates/rip/Cargo.toml b/crates/rip/Cargo.toml index a7b8993a..e5bff1f7 100644 --- a/crates/rip/Cargo.toml +++ b/crates/rip/Cargo.toml @@ -20,7 +20,7 @@ indicatif = "0.17.6" itertools = "0.11.0" miette = { version = "5.10.0", features = ["fancy"] } rattler_installs_packages = { path = "../rattler_installs_packages" } -rattler_libsolv_rs = { git = "https://github.com/baszalmstra/rattler", branch = "refactor/lazy_solver" } +resolvo = "0.1.0" reqwest = "0.11.19" tabwriter = { version = "1.2.1", features = ["ansi_formatting"] } tokio = { version = "1.29.1", features = ["rt", "macros", "rt-multi-thread"] } @@ -31,4 +31,4 @@ rand = "0.8.4" serde = "1.0.188" serde_with = "3.0.0" serde_json = "1.0.107" -rusqlite = { version = "0.29.0", features = ["bundled"] } \ No newline at end of file +rusqlite = { version = "0.29.0", features = ["bundled"] } diff --git a/crates/rip/src/bin/index.rs b/crates/rip/src/bin/index.rs index 09de384f..de252713 100644 --- a/crates/rip/src/bin/index.rs +++ b/crates/rip/src/bin/index.rs @@ -14,7 +14,7 @@ use tracing_subscriber::fmt::format::FmtSpan; use tracing_subscriber::util::SubscriberInitExt; use url::Url; -use rattler_installs_packages::{Extra, NormalizedPackageName, PackageName, PackageRequirement, Wheel}; +use rattler_installs_packages::{Extra, PackageName, PackageRequirement, Wheel}; use rip::writer::{global_multi_progress, IndicatifWriter}; #[derive(Parser)] @@ -74,8 +74,10 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> { for n in names { bar.inc(1); let package_name = PackageName::from_str(&n)?; - let mut artifacts_per_version = - package_db.available_artifacts(package_name.clone()).await?.clone(); + let mut artifacts_per_version = package_db + .available_artifacts(package_name.clone()) + .await? + .clone(); artifacts_per_version.sort_keys(); let (chosen_version, available_artifacts) = @@ -86,7 +88,7 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> { }; let mut rows = request - .query(&[package_name.as_str(), chosen_version.to_string().as_str()]) + .query([package_name.as_str(), chosen_version.to_string().as_str()]) .into_diagnostic()?; if rows.next().into_diagnostic()?.is_some() { // Skip if we have it in the database @@ -102,7 +104,7 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> { .filter(|a| !a.yanked.yanked) .collect::>(); - if available_artifacts.len() == 0 { + if available_artifacts.is_empty() { continue; } @@ -119,16 +121,16 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> { }; insert_stmt - .insert(&[ + .insert([ package_name.as_str(), chosen_version.to_string().as_str(), serde_json::to_string(&metadata.requires_dist) .into_diagnostic()? .as_str(), - &serde_json::to_string(&metadata.requires_python) + serde_json::to_string(&metadata.requires_python) .into_diagnostic()? .as_str(), - &serde_json::to_string(&metadata.extras) + serde_json::to_string(&metadata.extras) .into_diagnostic()? .as_str(), ]) @@ -181,7 +183,7 @@ pub fn query_extras() -> Result<(), miette::Error> { .into_diagnostic()?; total += requires_dist.len(); for req in requires_dist { - if req.extras.len() > 0 { + if !req.extras.is_empty() { println!( "{}: {}", req.name.as_str(), diff --git a/crates/rip/src/main.rs b/crates/rip/src/main.rs index 2091ed38..f8858354 100644 --- a/crates/rip/src/main.rs +++ b/crates/rip/src/main.rs @@ -1,18 +1,16 @@ -use std::fmt::{Debug, Display}; use std::io::Write; use clap::Parser; use miette::IntoDiagnostic; -use rattler_libsolv_rs::{DefaultSolvableDisplay, DependencyProvider, Solver, VersionSet}; -use tracing::Level; -use tracing_subscriber::fmt::format::FmtSpan; -use tracing_subscriber::util::SubscriberInitExt; +use resolvo::{DefaultSolvableDisplay, DependencyProvider, Solver}; +use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; use url::Url; -use rattler_installs_packages::requirement::Requirement; -use rattler_installs_packages::{NormalizedPackageName, PackageRequirement}; -use rip::pypi_provider::{PypiDependencyProvider, PypiPackageName}; -use rip::writer::{global_multi_progress, IndicatifWriter}; +use rattler_installs_packages::{requirement::Requirement, PackageRequirement}; +use rip::{ + pypi_provider::{PypiDependencyProvider, PypiPackageName}, + writer::{global_multi_progress, IndicatifWriter}, +}; #[derive(Parser)] #[command(author, version, about, long_about = None)] @@ -30,11 +28,9 @@ async fn actual_main() -> miette::Result<()> { let args = Args::parse(); // Setup tracing subscriber - tracing_subscriber::fmt() - .with_max_level(Level::INFO) - .with_span_events(FmtSpan::ENTER) - .with_writer(IndicatifWriter::new(global_multi_progress())) - .finish() + tracing_subscriber::registry() + .with(fmt::layer().with_writer(IndicatifWriter::new(global_multi_progress()))) + .with(EnvFilter::from_default_env()) .init(); // Determine cache directory @@ -47,7 +43,7 @@ async fn actual_main() -> miette::Result<()> { let package_db = rattler_installs_packages::PackageDb::new( Default::default(), &[normalize_index_url(args.index_url)], - cache_dir.clone(), + cache_dir, ) .into_diagnostic()?; diff --git a/crates/rip/src/pypi_provider.rs b/crates/rip/src/pypi_provider.rs index b1e3d907..259a73a1 100644 --- a/crates/rip/src/pypi_provider.rs +++ b/crates/rip/src/pypi_provider.rs @@ -1,9 +1,8 @@ -use clap::builder::Str; use rattler_installs_packages::requirement::Requirement; use rattler_installs_packages::{ CompareOp, Extra, NormalizedPackageName, PackageDb, Specifier, Specifiers, Version, Wheel, }; -use rattler_libsolv_rs::{ +use resolvo::{ Candidates, Dependencies, DependencyProvider, NameId, Pool, SolvableId, SolverCache, VersionSet, }; use std::collections::HashMap;