Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/split crates #16

Merged
merged 8 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/index/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tokio = { version = "1.32.0", features = ["rt", "macros", "rt-multi-thread"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
url = "2.4.1"
rip_bin = {path = "../rip_bin"}


[package.metadata.release]
Expand Down
11 changes: 2 additions & 9 deletions crates/index/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use tracing_subscriber::util::SubscriberInitExt;
use url::Url;

use rattler_installs_packages::{Extra, PackageName, PackageRequirement, Wheel};
use rip::writer::{global_multi_progress, IndicatifWriter};
use rip::utils::normalize_index_url;
use rip_bin::{global_multi_progress, IndicatifWriter};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
Expand All @@ -33,14 +34,6 @@ enum Command {
Index,
ListExtras,
}
fn normalize_index_url(mut url: Url) -> Url {
let path = url.path();
if !path.ends_with('/') {
url.set_path(&format!("{path}/"));
}
url
}

pub async fn index(index_url: Url) -> Result<(), miette::Error> {
let cache_dir = dirs::cache_dir()
.ok_or_else(|| miette::miette!("failed to determine cache directory"))?
Expand Down
2 changes: 1 addition & 1 deletion crates/rattler_installs_packages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rattler_installs_packages"
version.workspace = true
edition.workspace = true
authors = ["Bas Zalmstra <[email protected]>"]
authors = ["Bas Zalmstra <[email protected]>", "Tim de Jager <[email protected]>"]
description = "Datastructures and algorithms to interact with Python packaging ecosystem"
categories.workspace = true
homepage.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/rattler_installs_packages/src/package_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ mod test {
.unwrap();

let (_artifact, _metadata) = package_db
.get_pep658_metadata::<Wheel>(&artifact_info)
.get_pep658_metadata::<Wheel>(artifact_info)
.await
.unwrap();
}
Expand Down
26 changes: 9 additions & 17 deletions crates/rip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
name = "rip"
version.workspace = true
edition.workspace = true
authors = ["Bas Zalmstra <[email protected]>"]
description = "Binary to verify and play around with rattler_installs_packages"
authors = ["Bas Zalmstra <[email protected]>", "Tim de Jager <[email protected]>"]
description = "Implementation of resolvo for use with rattler_installs_packages"
categories.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
readme.workspace = true
default-run = "rip"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["native-tls"]
Expand All @@ -22,21 +23,12 @@ console = { version = "0.15.7", features = ["windows-console-colors"] }
dirs = "5.0.1"
indexmap = "2.0.0"
indicatif = "0.17.7"
itertools = "0.11.0"
miette = { version = "5.10.0", features = ["fancy"] }
rand = "0.8.5"
rattler_installs_packages = { path = "../rattler_installs_packages", default-features = false }
reqwest = { version = "0.11.20", default-features = false }
resolvo = "0.1.0"
rusqlite = { version = "0.29.0", features = ["bundled"] }
serde = "1.0.188"
serde_json = "1.0.107"
serde_with = "3.3.0"
tabwriter = { version = "1.3.0", features = ["ansi_formatting"] }
tokio = { version = "1.32.0", features = ["rt", "macros", "rt-multi-thread"] }
reqwest = "0.11.19"
tokio = { version = "1.29.1", features = ["rt", "macros", "rt-multi-thread"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
url = "2.4.1"
url = "2.4.0"
rattler_installs_packages = { path = "../rattler_installs_packages" }
resolvo = "0.1.0"

[package.metadata.release]
# Dont publish the binary
Expand Down
3 changes: 2 additions & 1 deletion crates/rip/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod pypi_provider;
pub mod writer;

pub mod utils;
10 changes: 10 additions & 0 deletions crates/rip/src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use url::Url;

/// Normalize url according to pip standards
pub fn normalize_index_url(mut url: Url) -> Url {
let path = url.path();
if !path.ends_with('/') {
url.set_path(&format!("{path}/"));
}
url
}
39 changes: 39 additions & 0 deletions crates/rip_bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "rip_bin"
version.workspace = true
edition.workspace = true
authors = ["Bas Zalmstra <[email protected]>", "Tim de Jager <[email protected]>"]
description = "Binary to verify and play around with rattler_installs_packages"
categories.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
readme.workspace = true
default-run = "rip_bin"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.3.23", features = ["derive"] }
console = { version = "0.15.7", features = ["windows-console-colors"] }
dirs = "5.0.1"
indexmap = "2.0.0"
indicatif = "0.17.6"
itertools = "0.11.0"
miette = { version = "5.10.0", features = ["fancy"] }
rattler_installs_packages = { path = "../rattler_installs_packages" }
resolvo = "0.1.0"
tabwriter = { version = "1.2.1", features = ["ansi_formatting"] }
tokio = { version = "1.29.1", features = ["rt", "macros", "rt-multi-thread"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"]}
url = "2.4.0"
rand = "0.8.4"
serde = "1.0.188"
serde_json = "1.0.107"
rusqlite = { version = "0.29.0", features = ["bundled"] }
rip = {path = "../rip"}

[package.metadata.release]
# Dont publish the binary
release = false
File renamed without changes.
21 changes: 2 additions & 19 deletions crates/rip/src/main.rs → crates/rip_bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rip_bin::{global_multi_progress, IndicatifWriter};
use std::io::Write;

use clap::Parser;
Expand All @@ -9,7 +10,7 @@ use url::Url;
use rattler_installs_packages::{PackageRequirement, Requirement};
use rip::{
pypi_provider::{PypiDependencyProvider, PypiPackageName},
writer::{global_multi_progress, IndicatifWriter},
utils::normalize_index_url,
};

#[derive(Parser)]
Expand Down Expand Up @@ -128,21 +129,3 @@ async fn main() {
eprintln!("{e:?}");
}
}

fn normalize_index_url(mut url: Url) -> Url {
let path = url.path();
if !path.ends_with('/') {
url.set_path(&format!("{path}/"));
}
url
}

#[cfg(test)]
mod test {
use rattler_installs_packages::Version;

#[test]
fn valid_version() {
assert!(Version::parse("1.2.1").is_some());
}
}