[package]
name = "alimentar"
version = "0.2.0"
edition = "2021"
authors = ["paiml"]
description = "Data Loading, Distribution and Tooling in Pure Rust"
license = "MIT"
repository = "https://github.com/paiml/alimentar"
keywords = ["data", "ml", "arrow", "parquet", "dataset"]
categories = ["data-structures", "science"]
rust-version = "1.75"

[features]
default = ["local", "tokio-runtime", "cli", "mmap", "shuffle", "provenance"]
local = []
mmap = ["dep:memmap2"]
shuffle = ["dep:rand"]
provenance = ["dep:sha2"]
tokio-runtime = ["dep:tokio"]
s3 = ["dep:aws-sdk-s3", "dep:aws-config", "tokio-runtime"]
http = ["dep:reqwest"]
hf-hub = ["http"]
cli = ["dep:clap"]
wasm = ["dep:wasm-bindgen", "dep:wasm-bindgen-futures", "dep:js-sys", "dep:getrandom"]
format-encryption = ["dep:aes-gcm", "dep:argon2", "dep:x25519-dalek", "dep:hkdf", "dep:sha2", "dep:rand_core", "dep:getrandom"]
format-signing = ["dep:ed25519-dalek", "dep:getrandom"]
format-streaming = ["mmap"]

[dependencies]
# Core (always)
arrow = { version = "53", default-features = false, features = ["prettyprint", "ipc"] }
arrow-csv = { version = "53" }
arrow-json = { version = "53" }
parquet = { version = "53", default-features = false, features = ["arrow", "snap"] }
thiserror = "2"
bytes = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"

# Format serialization
rmp-serde = "1"
zstd = "0.13"
lz4_flex = "0.11"

# Random (for shuffle) - with JS support for WASM
rand = { version = "0.8", optional = true }
getrandom = { version = "0.2", features = ["js"], optional = true }

# Memory mapping (not available on WASM)
memmap2 = { version = "0.9", optional = true }

# CLI (optional, not for WASM)
clap = { version = "4", features = ["derive"], optional = true }

# Async (feature-gated)
tokio = { version = "1", features = ["rt", "fs", "sync", "rt-multi-thread"], optional = true }

# S3 (feature-gated)
aws-sdk-s3 = { version = "1", optional = true }
aws-config = { version = "1", optional = true }

# HTTP (feature-gated)
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "blocking"], optional = true }

# WASM (feature-gated)
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
js-sys = { version = "0.3", optional = true }

# Encryption (feature-gated, WASM-safe)
aes-gcm = { version = "0.10", optional = true }
argon2 = { version = "0.5", optional = true }
x25519-dalek = { version = "2", features = ["static_secrets"], optional = true }
hkdf = { version = "0.12", optional = true }
sha2 = { version = "0.10", optional = true }
rand_core = { version = "0.6", optional = true }

# Signing (feature-gated, WASM-safe)
ed25519-dalek = { version = "2", features = ["rand_core"], optional = true }

[dev-dependencies]
tempfile = "3"
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
criterion = { version = "0.5", features = ["html_reports"] }

[[bin]]
name = "alimentar"
path = "src/main.rs"
required-features = ["cli"]

[lib]
name = "alimentar"
path = "src/lib.rs"

[profile.release]
lto = true
codegen-units = 1
strip = true

[lints.rust]
# Use deny instead of forbid to allow override in mmap module
unsafe_code = "deny"
# Enable additional high-value lints
unsafe_op_in_unsafe_fn = "warn"
missing_docs = "warn"

[lints.clippy]
unwrap_used = "deny"
expect_used = "deny"
# panic is allowed in tests (where it's used for assertions)
# Additional quality lints
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
# Allow some pedantic lints that are too noisy
missing_errors_doc = "allow"
missing_panics_doc = "allow"
module_name_repetitions = "allow"
must_use_candidate = "allow"
too_many_lines = "allow"
cognitive_complexity = "allow"
significant_drop_tightening = "allow"
redundant_pub_crate = "allow"
missing_const_for_fn = "allow"
option_if_let_else = "allow"

[[bench]]
name = "dataset_bench"
harness = false
