Cleanup Dependencies (#12)

* Moved deps into ps-core and `pub use` exported them so they're only in one place

* Updated Version Numbers
pull/24/head
Benedikt Terhechte 2 years ago committed by GitHub
parent 3151902bef
commit 9a35b99971
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

64
Cargo.lock generated

@ -50,15 +50,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "andrew"
version = "0.3.1"
@ -1566,7 +1557,7 @@ dependencies = [
[[package]]
name = "postsack"
version = "0.2.0"
version = "1.0.0"
dependencies = [
"ps-core",
"ps-database",
@ -1576,7 +1567,7 @@ dependencies = [
[[package]]
name = "postsack-web"
version = "0.2.0"
version = "1.0.0"
dependencies = [
"console_error_panic_hook",
"ps-core",
@ -1627,24 +1618,20 @@ dependencies = [
[[package]]
name = "ps-core"
version = "0.2.0"
version = "1.0.0"
dependencies = [
"chrono",
"crossbeam-channel",
"eyre",
"flate2",
"getrandom",
"lru",
"once_cell",
"rand",
"regex",
"rsql_builder",
"serde",
"serde_json",
"shellexpand",
"strum",
"strum_macros",
"thiserror",
"tracing",
"tracing-subscriber",
"treemap",
@ -1652,65 +1639,43 @@ dependencies = [
[[package]]
name = "ps-database"
version = "0.2.0"
version = "1.0.0"
dependencies = [
"chrono",
"eyre",
"ps-core",
"rsql_builder",
"rusqlite",
"serde",
"serde_json",
"thiserror",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "ps-gui"
version = "0.2.0"
version = "1.0.0"
dependencies = [
"chrono",
"cocoa",
"crossbeam-channel",
"eframe",
"eyre",
"getrandom",
"image",
"num-format",
"objc",
"once_cell",
"ps-core",
"ps-importer",
"rand",
"shellexpand",
"thiserror",
"tinyfiledialogs",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "ps-importer"
version = "0.2.0"
version = "1.0.0"
dependencies = [
"chrono",
"email-parser",
"emlx",
"eyre",
"flate2",
"mbox-reader",
"once_cell",
"ps-core",
"rand",
"rayon",
"regex",
"serde",
"serde_json",
"shellexpand",
"thiserror",
"tracing",
"tracing-subscriber",
"walkdir",
]
@ -1835,23 +1800,6 @@ dependencies = [
"redox_syscall",
]
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rsql_builder"
version = "0.1.2"

@ -0,0 +1,7 @@
Copyright 2017 Cargo-Bundle developers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,10 +1,5 @@
# Postsack
# What can go into core (web compatible!)?
- database only as trait
- importer only as trait
## Provides a high level visual overview of swaths of email
### Performance
@ -14,6 +9,8 @@ Update: It currently parses 632115 emails in ~56 seconds, so roughly `11.000` em
## Open Issues
- [ ] check for unused dependencies in each crate
- [ ] `pub use ...` some deps in core so that they don't need to be re-imported
- [ ] check the feature.lru to see if it compiles without LRU
- [ ] build static linux binary via docker: Via Github Actions?
- [ ] try to build a static windows binary: Via Github Actions?

@ -1,6 +1,6 @@
[package]
name = "postsack"
version = "0.2.0"
version = "1.0.0"
edition = "2021"
description = "Provides a high level visual overview of swaths of email"

@ -1,6 +1,6 @@
[package]
name = "postsack-web"
version = "0.2.0"
version = "1.0.0"
edition = "2021"
description = "Provides a high level visual overview of swaths of email"

@ -1,16 +1,12 @@
[package]
name = "ps-core"
version = "0.2.0"
version = "1.0.0"
edition = "2021"
description = "Provides a high level visual overview of swaths of email"
[dependencies]
eyre = "0.6.5"
thiserror = "1.0.29"
tracing = "0.1.29"
tracing-subscriber = "0.3.0"
regex = "1.5.3"
flate2 = "1.0.22"
once_cell = "1.8.0"
chrono = {version = "0.4.19", features = ["wasmbind"]}
serde_json = "1.0.70"
@ -26,6 +22,3 @@ lru = { version = "0.7.0"}
[target."cfg(target_arch = \"wasm32\")".dependencies]
# https://docs.rs/getrandom/latest/getrandom/#webassembly-support
getrandom = { version = "0.2", features = ["js"] }
[target."cfg(not(target_arch = \"wasm32\"))".dependencies]
shellexpand = "2.1.0"

@ -8,13 +8,17 @@ pub use database::database_like::{DatabaseLike, DatabaseQuery};
pub use database::db_message::DBMessage;
pub use database::query::{Field, Filter, OtherQuery, Query, ValueField, AMOUNT_FIELD_NAME};
pub use database::query_result::{QueryResult, QueryRow};
pub use importer::{Importerlike, Message, MessageReceiver, MessageSender};
pub use types::{Config, EmailEntry, EmailMeta, FormatType};
// Re-Export some dependencies so they don't
// need to be listed again in other Cargo tomls
pub use chrono;
pub use crossbeam_channel;
pub use eyre;
pub use importer::{Importerlike, Message, MessageReceiver, MessageSender};
pub use serde_json::Value;
pub use rand;
pub use serde_json::{self, Value};
pub use tracing;
// Tracing

@ -1,16 +1,8 @@
[package]
name = "ps-database"
version = "0.2.0"
version = "1.0.0"
edition = "2021"
[dependencies]
eyre = "0.6.5"
thiserror = "1.0.29"
tracing = "0.1.29"
tracing-subscriber = "0.3.0"
rusqlite = {version = "0.26.1", features = ["chrono", "trace", "serde_json", "bundled"]}
chrono = {version = "0.4.19", features = ["wasmbind"]}
serde_json = "1.0.70"
serde = { version = "1.0.130", features = ["derive"]}
rsql_builder = "0.1.2"
ps-core = { path = "../ps-core" }

@ -1,9 +1,9 @@
use std::collections::HashMap;
use std::convert::TryInto;
use eyre::{bail, eyre, Result};
use ps_core::eyre::{bail, eyre, Result};
use ps_core::Value;
use rusqlite::{self, types, Row};
use serde_json::Value;
use ps_core::{EmailMeta, Field, QueryResult, ValueField, AMOUNT_FIELD_NAME};

@ -1,5 +1,3 @@
use chrono::Datelike;
use eyre::{bail, Report, Result};
use rusqlite::{self, params, Connection, Statement};
use std::path::PathBuf;
@ -7,6 +5,10 @@ use std::{collections::HashMap, path::Path, thread::JoinHandle};
use super::sql::*;
use super::{value_from_field, RowConversion};
use ps_core::chrono::Datelike;
use ps_core::eyre::{self, bail, Report, Result};
use ps_core::tracing;
use ps_core::Value;
use ps_core::{
crossbeam_channel::{unbounded, Sender},
Config, DBMessage, DatabaseLike, DatabaseQuery, EmailEntry, OtherQuery, Query, QueryResult,
@ -187,7 +189,7 @@ impl Database {
Ok(())
}
fn select_config_fields(&self) -> Result<HashMap<String, serde_json::Value>> {
fn select_config_fields(&self) -> Result<HashMap<String, Value>> {
let connection = match &self.connection {
Some(n) => n,
None => bail!("No connection to database available in query"),
@ -196,10 +198,7 @@ impl Database {
let mut query_results = HashMap::new();
let mut rows = stmt.query([])?;
while let Some(row) = rows.next()? {
let (k, v) = match (
row.get::<_, String>("key"),
row.get::<_, serde_json::Value>("value"),
) {
let (k, v) = match (row.get::<_, String>("key"), row.get::<_, Value>("value")) {
(Ok(k), Ok(v)) => (k, v),
(a, b) => {
tracing::error!("Invalid row data. Missing fields key and or value:\nkey: {:?}\nvalue: {:?}\n", a, b);
@ -211,7 +210,7 @@ impl Database {
Ok(query_results)
}
fn insert_config_fields(&self, fields: HashMap<String, serde_json::Value>) -> Result<()> {
fn insert_config_fields(&self, fields: HashMap<String, Value>) -> Result<()> {
let connection = match &self.connection {
Some(n) => n,
None => bail!("No connection to database available in query"),

@ -1,34 +1,23 @@
[package]
name = "ps-gui"
version = "0.2.0"
version = "1.0.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
eyre = "0.6.5"
thiserror = "1.0.29"
tracing = "0.1.29"
tracing-subscriber = "0.3.0"
once_cell = "1.8.0"
crossbeam-channel = "0.5.1"
eframe = "0.15.0"
num-format = "0.4.0"
rand = "0.8.4"
chrono = {version = "0.4.19", features = ["wasmbind"]}
ps-core = { path = "../ps-core" }
once_cell = "1.9.0"
[target."cfg(target_os = \"macos\")".dependencies.cocoa]
version = "0.24"
[target."cfg(target_os = \"macos\")".dependencies.objc]
version = "0.2.7"
[target."cfg(target_os = \"macos\")".dependencies]
image = { version = "0.23", default-features = false, features = ["png"] }
cocoa = "0.24"
objc = "0.2.7"
[target."cfg(not(target_arch = \"wasm32\"))".dependencies]
ps-importer = { path = "../ps-importer" }
shellexpand = "2.1.0"
tinyfiledialogs = "3.0"
image = { version = "0.23", default-features = false, features = ["png"] }
[target."cfg(target_arch = \"wasm32\")".dependencies]
# https://docs.rs/getrandom/latest/getrandom/#webassembly-support
getrandom = { version = "0.2", features = ["js"] }
tinyfiledialogs = "3.0"

@ -5,7 +5,7 @@ use eframe::{
use super::Textures;
use super::{StateUIAction, StateUIVariant};
use ps_core::Config;
use ps_core::{eyre, Config};
pub struct ErrorUI {
/// The error to display

@ -3,8 +3,8 @@ use std::thread::JoinHandle;
use eframe::egui::epaint::Shadow;
use eframe::egui::{self, Color32, Pos2, Rect, Response, Stroke};
use eyre::Result;
use rand::seq::SliceRandom;
use ps_core::eyre::{self, Result};
use ps_core::rand::{self, seq::SliceRandom};
use super::super::platform::platform_colors;
use super::super::widgets::background::{shadow_background, AnimatedBackground};

@ -1,5 +1,5 @@
use eframe::egui::{self, Stroke};
use eyre::{Report, Result};
use ps_core::eyre::{Report, Result};
use super::super::widgets::{FilterState, Spinner};
use super::Textures;

@ -8,9 +8,9 @@ use std::path::PathBuf;
pub use super::textures::Textures;
use eframe::egui::{self};
pub use error::ErrorUI;
use eyre::Report;
pub use import::ImporterUI;
pub use main::{MainUI, UIState};
use ps_core::eyre::Report;
pub use startup::StartupUI;
use ps_core::{Config, DatabaseLike, FormatType};

@ -1,6 +1,6 @@
use chrono::prelude::*;
use eframe::egui::{self, Widget};
use eyre::Report;
use ps_core::eyre::Report;
use ps_core::{model::items, model::Engine, Field, QueryRow};
use super::widgets::Table;

@ -1,6 +1,6 @@
use eframe::egui::{self, Color32, Label, Widget};
use eyre::Report;
use num_format::{Locale, ToFormattedString};
use ps_core::eyre::Report;
use ps_core::model::Engine;
use super::app_state::UIState;

@ -1,7 +1,7 @@
#![cfg(target_os = "linux")]
use eframe::egui::{self, Color32};
use eyre::Result;
use ps_core::eyre::Result;
use super::{PlatformColors, Theme};

@ -8,7 +8,7 @@ const SYSTEM_MONO_FONT: &[u8] = include_bytes!("../fonts/mac_mono.ttc");
use cocoa;
use eframe::egui::{self, Color32, FontDefinitions, FontFamily, Stroke};
use eyre::{bail, Result};
use ps_core::eyre::{bail, Result};
use objc::runtime::{Object, YES};
use objc::*;

@ -1,7 +1,7 @@
#![cfg(target_os = "windows")]
use eframe::egui::{self, Color32};
use eyre::Result;
use ps_core::eyre::Result;
use super::{PlatformColors, Theme};

@ -1,5 +1,5 @@
use eframe::egui::{self, Widget};
use eyre::Report;
use ps_core::eyre::Report;
use ps_core::model::{segmentations, Engine};
pub struct SegmentationBar<'a> {

@ -6,6 +6,10 @@
//! This is complicated by the fact that the image in question is only
//! necessary on macOS and I'd rather not load it on Windows or Linux systems.
#[cfg(not(target_os = "macos"))]
use eframe::{self, epi};
#[cfg(target_os = "macos")]
use eframe::{self, egui, epi};
#[cfg(target_os = "macos")]

@ -1,6 +1,6 @@
//! A panel to edit filters
use eframe::egui::{self, vec2, Color32, Response, Widget};
use eyre::Report;
use ps_core::eyre::Report;
use ps_core::{
model::{segmentations, Engine},

@ -1,8 +1,8 @@
use std::collections::hash_map::DefaultHasher;
use eframe::egui::{self, epaint::Galley, Color32, Pos2, Rect, Rgba, Stroke, TextStyle, Widget};
use eyre::Report;
use num_format::{Locale, ToFormattedString};
use ps_core::eyre::Report;
use ps_core::model::{self, segmentations, Engine, Segment};
use super::super::platform::platform_colors;

@ -1,26 +1,19 @@
[package]
name = "ps-importer"
version = "0.2.0"
version = "1.0.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
eyre = "0.6.5"
thiserror = "1.0.29"
tracing = "0.1.29"
tracing-subscriber = "0.3.0"
regex = "1.5.3"
flate2 = "1.0.22"
once_cell = "1.8.0"
email-parser = { git = "https://github.com/terhechte/email-parser", features = ["sender", "to", "in-reply-to", "date", "subject", "mime", "allow-duplicate-headers", "compatibility-fixes"]}
rayon = "1.5.1"
chrono = "0.4.19"
emlx = { git = "https://github.com/terhechte/emlx", features = []}
walkdir = "2.3.2"
mbox-reader = "0.2.0"
rand = "0.8.4"
shellexpand = "2.1.0"
serde_json = "1.0.70"
serde = { version = "1.0.130", features = ["derive"]}
serde = { version = "1.0.131", features = ["derive"]}
ps-core = { path = "../ps-core" }

@ -2,11 +2,12 @@
//! recursively drill down into the appropriate folder
//! until we find `emlx` files and return those.
use eyre::{eyre, Result};
use rayon::prelude::*;
use walkdir::WalkDir;
use super::super::shared::filesystem::emails_in;
use ps_core::eyre::{eyre, Result};
use ps_core::tracing;
use ps_core::{Config, Message, MessageSender};
use super::mail::Mail;

@ -1,9 +1,9 @@
use emlx::parse_emlx;
use eyre::Result;
use std::borrow::Cow;
use std::path::{Path, PathBuf};
use ps_core::eyre::Result;
use ps_core::EmailMeta;
use super::super::shared::parse::ParseableEmail;

@ -1,10 +1,9 @@
use chrono::prelude::*;
use eyre::{bail, Result};
use super::raw_email::RawEmailEntry;
use serde::Deserialize;
use serde_json;
use super::raw_email::RawEmailEntry;
use ps_core::chrono::prelude::*;
use ps_core::eyre::{bail, Result};
use ps_core::serde_json;
use ps_core::EmailMeta;
#[derive(Deserialize, Debug, Clone)]

@ -1,5 +1,6 @@
use eyre::{eyre, Result};
use flate2::read::GzDecoder;
use ps_core::eyre::{eyre, Result};
use ps_core::tracing;
use std::borrow::Cow;
use std::io::Read;

@ -4,10 +4,10 @@
//! (or aho corasick)
//! MBox parsing is also not particularly fast as it currently doesn't use parallelism
use eyre::eyre;
use mbox_reader;
use ps_core::eyre::eyre;
use ps_core::tracing;
use rayon::prelude::*;
use tracing;
use walkdir::WalkDir;
use super::{Config, ImporterFormat, Message, MessageSender, Result};

@ -1,6 +1,6 @@
use std::path::PathBuf;
pub use eyre::Result;
pub use ps_core::eyre::Result;
mod apple_mail;
mod gmailbackup;

@ -1,7 +1,8 @@
use super::parse::{parse_email, ParseableEmail};
use ps_core::{Config, DBMessage, DatabaseLike, Message, MessageSender};
use eyre::{bail, Result};
use ps_core::eyre::{self, bail, Result};
use ps_core::tracing;
use rayon::prelude::*;
pub fn into_database<Mail: ParseableEmail + 'static, Database: DatabaseLike + 'static>(

@ -1,6 +1,6 @@
use eyre::{bail, Result};
use ps_core::eyre::{bail, Result};
use ps_core::tracing::{self, trace};
use rayon::prelude::*;
use tracing::trace;
use std::path::{Path, PathBuf};

@ -1,6 +1,8 @@
use chrono::prelude::*;
use email_parser::address::{Address, EmailAddress, Mailbox};
use eyre::{eyre, Result};
use ps_core::chrono;
use ps_core::chrono::prelude::*;
use ps_core::eyre::{eyre, Result};
use ps_core::tracing;
use std::borrow::Cow;
use std::collections::HashSet;

@ -1,4 +1,4 @@
use eyre::Result;
use ps_core::eyre::Result;
pub(crate) mod formats;
@ -47,7 +47,7 @@ impl<Format: ImporterFormat + 'static> Importerlike for Importer<Format> {
Ok(_) => Ok(()),
Err(e) => match outer_sender.send(Message::Error(e)) {
Ok(_) => Ok(()),
Err(e) => Err(eyre::Report::new(e)),
Err(e) => Err(ps_core::eyre::Report::new(e)),
},
}
});

Loading…
Cancel
Save