streamweave 0.2.1

Composable, async, stream-first computation in pure Rust
Documentation
[package]
name = "streamweave"
version = "0.2.1"
edition = "2024"
authors = ["Tom Wieland <tom.wieland@gmail.com>"]  # Add your info
description = "Composable, async, stream-first computation in pure Rust"
license = "CC-BY-SA-4.0"
repository = "https://github.com/Industrial/streamweave"  # Add your repo
homepage = "https://github.com/Industrial/streamweave"  # Add homepage
documentation = "https://docs.rs/streamweave"  # Add docs
keywords = ["stream", "async", "pipeline", "data-processing", "rust"]
categories = ["asynchronous", "data-structures", "web-programming::http-server"]
readme = "README.md"

# rust-analyzer configuration
# This ensures rust-analyzer uses native target (not wasm32) for better IDE support
[package.metadata.rust-analyzer]
# Configure rust-analyzer to check with kafka feature enabled
# and use native target so Kafka code is not marked as inactive
check.allTargets = true

[features]
default = ["native"]

# Native platform features (full functionality)
native = [
    "tokio/full",
    "tokio-stream/io-util",
    "dep:async-compression",
    "dep:hyper-tungstenite",
    "dep:hyper-util",
    "dep:jsonschema",
    "dep:tokio-tungstenite",
    "dep:tokio-util",
    "dep:tracing-subscriber",
    "file-formats",
    "random",
    "http-server",
]

# WebAssembly platform features (browser/Node.js compatible)
# Note: Random number generation requires browser crypto API
# UUID and random features are disabled for WASM due to getrandom limitations
wasm = [
    "tokio/sync",
    "tokio/macros",
    "tokio/rt",
    "tokio/time",
]

# Minimal WASM feature for smallest bundle size
# Includes core stream processing with minimal tokio features
wasm-minimal = [
    "tokio/sync",
    "tokio/rt",
    "tokio/time",
    "tokio/macros",
]

# Optional file format support (native only due to file I/O)
file-formats = [
    "dep:arrow",
    "dep:parquet",
    "dep:csv",
    "dep:rmp-serde",
]

# Random number generation support
random = [
    "dep:rand",
    "dep:uuid",
]

# Compression support (native only)
compression = ["dep:async-compression"]

# Kafka integration (native only)
kafka = ["dep:rdkafka"]

# Redis Streams integration (native only)
redis-streams = ["dep:redis"]

# Database integration (native only)
database = ["dep:sqlx"]

# HTTP polling integration (native only)
http-poll = ["dep:reqwest"]

# HTTP server integration (native only)
http-server = ["dep:axum", "dep:tower", "dep:tower-http", "dep:http-body-util"]

# SQL query interface (native only - requires sqlparser)
sql = ["dep:sqlparser"]

# Machine learning integration (native only - requires ML frameworks)
ml = ["dep:ort", "dep:ndarray"]

# OpenTelemetry integration (native only)
opentelemetry = ["dep:opentelemetry", "dep:opentelemetry_sdk", "dep:opentelemetry-otlp", "dep:tracing-opentelemetry"]

# Prometheus metrics export (native only)
# Note: We generate Prometheus text format manually, no external crate needed
prometheus = []

[dependencies]
# Async runtime and utilities - base features for both native and WASM
tokio = { version = "1.0", default-features = false, features = ["macros", "rt"] }
futures = "0.3"
async-trait = "0.1"

# Compression (native only)
async-compression = { version = "0.4", features = ["tokio", "gzip", "deflate"], optional = true }

# Serialization (always available)
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# File format dependencies (native only - requires file I/O)
csv = { version = "1.3", optional = true }
rmp-serde = { version = "1.3", optional = true }
arrow = { version = "54", default-features = false, features = ["ipc"], optional = true }
parquet = { version = "54", default-features = false, features = ["arrow", "snap", "lz4", "zstd"], optional = true }

# JSON Schema validation (optional - not WASM-compatible due to getrandom dependency)
jsonschema = { version = "0.37", optional = true }

# Time handling (works in WASM)
chrono = { version = "0.4", features = ["serde"] }

# Random number generation (optional - required for random producers and UUID message IDs)
rand = { version = "0.9", optional = true }

# UUID generation (optional - required for UUID-based message IDs)
uuid = { version = "1.0", features = ["v4", "serde"], optional = true }

# Pin utilities (works in WASM)
pin-project = "1.0"

# Stream utilities (works in WASM)
async-stream = "0.3.3"

# WebSocket and HTTP (native only)
hyper-tungstenite = { version = "0.19", optional = true }
hyper-util = { version = "0.1", features = ["full"], optional = true }
tokio-tungstenite = { version = "0.28", optional = true }

# Kafka integration (native only - requires librdkafka)
# Note: Requires cmake, pkg-config, openssl, zlib, and zstd to build
# These are provided by devenv.nix when using devenv.sh
# To use SSL, the system must have OpenSSL available (provided by devenv)
rdkafka = { version = "0.36", optional = true, features = ["cmake-build"] }

# Redis Streams integration (native only - requires Redis)
redis = { version = "0.26", optional = true, features = ["tokio-comp", "streams", "connection-manager"] }

# Database integration (native only - requires PostgreSQL/MySQL/SQLite)
# sqlx with runtime mode for dynamic queries and connection pooling
sqlx = { version = "0.8", optional = true, default-features = false, features = [
  "runtime-tokio-native-tls",
  "postgres",
  "mysql",
  "sqlite",
  "chrono",
  "uuid",
] }

# HTTP client for polling (native only)
reqwest = { version = "0.12", optional = true, default-features = false, features = [
  "json",
  "gzip",
  "brotli",
] }

# HTTP server framework (native only)
axum = { version = "0.7", optional = true, features = ["macros", "query", "form", "json", "multipart"] }
tower = { version = "0.4", optional = true }
tower-http = { version = "0.5", optional = true, features = ["cors", "trace", "compression-gzip", "compression-deflate"] }
http-body-util = { version = "0.1", optional = true }

# SQL parser for SQL-like querying (native only)
sqlparser = { version = "0.40", optional = true }

# ONNX Runtime for machine learning inference (native only)
ort = { version = "2.0.0-rc.10", optional = true }
# Array operations for tensor handling
ndarray = { version = "0.15", optional = true }

# OpenTelemetry integration (native only)
# Using latest versions - all updated to 0.31 for compatibility
opentelemetry = { version = "0.31", optional = true, features = ["trace", "metrics"] }
opentelemetry_sdk = { version = "0.31", optional = true, features = ["rt-tokio", "trace", "metrics"] }
opentelemetry-otlp = { version = "0.31", optional = true, default-features = false, features = ["trace", "metrics", "grpc-tonic"] }
tracing-opentelemetry = { version = "0.32", optional = true }

# Prometheus metrics export (native only)
# Note: We generate Prometheus text format manually, no external crate needed
# This is a feature flag for enabling Prometheus support, but no dependencies are needed

# Utilities (mostly WASM-compatible)
jsonwebtoken = { version = "10.2", default-features = false, features = ["rust_crypto"] }
mime = "0.3"
num-traits = "0.2.19"
regex = "1.10"
serde_urlencoded = "0.7"
sha2 = "0.10"
thiserror = "2.0.17"
tokio-stream = { version = "0.1", default-features = false }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.20", optional = true }
base64 = "0.22.1"
tokio-util = { version = "0.7.14", optional = true }

# Configure getrandom for WASM support (required for some dependencies)
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }

[[example]]
name = "basic_pipeline"
path = "examples/basic_pipeline/main.rs"

[[example]]
name = "advanced_pipeline"
path = "examples/advanced_pipeline/main.rs"

[[example]]
name = "kafka_integration"
path = "examples/kafka_integration/main.rs"

[[example]]
name = "redis_streams_integration"
path = "examples/redis_streams_integration/main.rs"

[[example]]
name = "database_integration"
path = "examples/database_integration/main.rs"

[[example]]
name = "http_poll_integration"
path = "examples/http_poll_integration/main.rs"
required-features = ["http-poll"]

[[example]]
name = "http_server_integration"
path = "examples/http_server_integration/main.rs"
required-features = ["http-server"]

[[example]]
name = "metrics_monitoring"
path = "examples/metrics_monitoring/main.rs"

[[example]]
name = "file_formats"
path = "examples/file_formats/main.rs"

[[example]]
name = "stateful_processing"
path = "examples/stateful_processing/main.rs"

[[example]]
name = "sql_dialect"
path = "examples/sql_dialect/main.rs"
required-features = ["sql"]

[[example]]
name = "visualization"
path = "examples/visualization/main.rs"

[[example]]
name = "visualization_web"
path = "examples/visualization_web/main.rs"

[[example]]
name = "sql_parser"
path = "examples/sql_parser/main.rs"
required-features = ["sql"]

[[example]]
name = "sql_query"
path = "examples/sql_query/main.rs"
required-features = ["sql"]

[[example]]
name = "error_handling"
path = "examples/error_handling/main.rs"

[[example]]
name = "advanced_transformers"
path = "examples/advanced_transformers/main.rs"

[[example]]
name = "windowing"
path = "examples/windowing/main.rs"

[[example]]
name = "exactly_once"
path = "examples/exactly_once/main.rs"

[dev-dependencies]
proptest = "1.4"
tempfile = "3.10.0"

# Release profile optimizations
[profile.release]
lto = true
codegen-units = 1
panic = "abort"
strip = true

# WASM-optimized release profile
[profile.wasm-release]
inherits = "release"
opt-level = "z"  # Optimize for size
lto = true
codegen-units = 1
panic = "abort"
strip = true