datui-lib 0.4.4

Data Exploration in the Terminal (library)
Documentation
[package]
name = "datui-lib"
version = "0.4.4"
edition = "2024"
rust-version = "1.95"
description = "Data Exploration in the Terminal (library)"
authors = ["Derek Wisong"]
homepage = "https://derekwisong.github.io/datui"
repository = "https://github.com/derekwisong/datui"
license = "MIT"
readme = "README.md"
keywords = ["cli", "tui", "data", "utility", "analysis"]
categories = ["command-line-utilities", "science"]

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

[features]
default = ["cloud", "http", "sql", "sqlite", "streaming"]
cloud = ["polars/aws", "polars/azure", "polars/gcp", "dep:object_store", "dep:quick-xml", "dep:ureq", "dep:http", "dep:futures"]
http = ["dep:ureq"]
sql = ["polars/sql", "dep:polars-sql", "dep:sqlparser"]
sqlite = ["dep:rusqlite"]
streaming = ["polars/streaming"]

[dependencies]
datui-cli = { path = "../datui-cli", version = "0.4.4" }
clap = { version = "4.5.54", features = ["derive"] }
color-eyre = "0.6.5"
# `event-stream`: the run loop's one terminal reader (app/terminal_input.rs) has to be
# wakeable to stop. `futures-core` names its Stream trait; both already in the tree.
crossterm = { version = "0.29.0", features = ["event-stream"] }
futures-core = "0.3"
dirs = "7.0"
fs2 = "0.4"
globset = "0.4"
ratatui = { version = "0.30.0", features = ["all-widgets"] }
# Cutting a cell by grapheme (exact::cell_prefix); already in the tree through ratatui.
unicode-segmentation = "1.13"
unicode-width = "0.2"
regex = "1.10"
chrono = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
supports-color = "3.0"
toml = "1.1"
# A documentation link is parsed before the browser sees it (app/link_open.rs).
url = "2.5.8"
bzip2 = "0.6"
# static: liblzma compiled in, so a release binary needs no liblzma.so.5 on the
# host; bzip2, flate2 and zstd already build their C code in.
xz2 = { version = "0.1", features = ["static"] }
flate2 = "1.0"
zstd = "0.14"
# Chart export: the chart is drawn once as SVG and read with the bundled font
# (usvg, which sets text with harfrust and skrifa), then written out as SVG,
# rasterized for PNG (resvg), or written as PDF from the same outlines
# (chart/chart_pdf.rs). Pure Rust, so no system font library is needed at run time.
resvg = { version = "0.48.1", default-features = false, features = ["text", "system-fonts"] }
calamine = { version = "0.36", features = ["chrono"] }
orc-rust = "0.9"
arrow = "59"
tempfile = "3.14"
ureq = { version = "3.4", optional = true }
object_store = { version = "0.13.1", optional = true, default-features = false, features = ["aws", "azure", "gcp"] }
# S3 ListBuckets answers in XML, from an endpoint the user pointed datui at and does
# not necessarily control. 0.41 is the first release past the two denial-of-service
# advisories against the 0.38 line, and it is already in the tree behind calamine.
quick-xml = { version = "0.42", optional = true }
# The request type object_store's SigV4 authorizer signs. Pulled in directly rather
# than reached through object_store, whose own re-export is of an internal module of
# the same name, not of this crate.
http = { version = "1", optional = true }
# Already in the tree through object_store; used for its stream helpers.
futures = { version = "0.3", optional = true }
tokio = { version = "1", features = ["rt-multi-thread", "rt", "io-util", "sync", "time"] }
# The system clipboard for the copy dialog. `wayland-data-control` is not
# negotiable: without it arboard writes the XWayland clipboard, which
# Wayland-native pastes never see. Default features off to leave the
# image-data flavor (and the image crate) out.
arboard = { version = "3", default-features = false, features = ["wayland-data-control"] }
# OSC 52 payloads; already in the tree transitively.
base64 = "0.23"
polars-sql = { version = "0.55", optional = true }
# The parser polars-sql uses, at its version: reads a GROUP BY statement to drill into.
sqlparser = { version = "0.62", optional = true, features = ["visitor"] }
ignore = "0.4.33"
# Fixed-record binary files and audio samples are read through a memory map, a
# window at a time. Already in the tree through polars-io.
memmap2 = "0.9"
# Binary format specs: half floats, record checksums, finding sync words, and the
# codecs of compressed blocks. Each is already in the tree through Polars or Arrow.
half = "2.7"
crc = "2.1"
memchr = "2.8"
lz4 = "1.28"
snap = "1.1"
brotli = { version = "8.0", default-features = false, features = ["std"] }
# SQLite databases, read only. `bundled` compiles SQLite into the binary, so no
# platform needs a system library; `hooks` lets a stopped open interrupt a statement.
# Default features off, which leaves extension loading out.
rusqlite = { version = "0.40", optional = true, default-features = false, features = ["bundled", "hooks"] }
# NumPy archives (.npz) are zip files. Already in the tree through calamine, with
# the same features.
zip = { version = "8.6", default-features = false, features = ["deflate"] }
# ELF symbol and section tables, and Rust symbol names demangled. Both already in
# the tree through backtrace, at these versions and with ELF reading on.
object = { version = "0.37.3", default-features = false, features = ["read_core", "elf", "unaligned"] }
rustc-demangle = "0.1.24"
# The log facade, for the log file. Already in the tree through Polars and ureq.
log = "0.4"
# Where `polars_warn!` goes (`set_warning_function`); Polars' own error crate.
polars-error = "0.55"
# The bytes a scan reads in place (`ScanSources::Buffers`): a NUL-padded file up to
# its text. Already in the tree through Polars.
polars-buffer = "0.55"
# The memory available now, which a sample's size is checked against. Already in the
# tree through Polars, with the same features.
sysinfo = { version = "0.39", default-features = false, features = ["system"] }
toml_edit = { version = "0.25.15", default-features = false, features = ["parse", "display"] }

# Pointing fd 2 at the log while the TUI owns the terminal. Already in the tree.
[target.'cfg(unix)'.dependencies]
libc = "0.2"
# SIGTERM and SIGHUP end a session as a quit does. signal-hook-registry, which this
# turns on, is already in the tree through crossterm.
tokio = { version = "1", features = ["signal"] }

# The file type of standard input, to tell `NUL` from a pipe, and the standard
# handles, for the tee. Already in the tree.
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_Console"] }
# Closing the console window, logging off and shutting down end a session as a quit
# does. Tokio's console control handler, on the windows-sys above.
tokio = { version = "1", features = ["signal"] }

[dependencies.polars]
version = "0.55"
default-features = false
features = [
    "avro",
    "csv",
    "decompress",
    # Not optional despite looking it: render/home_view.rs matches on
    # `DataType::Decimal` unconditionally. It used to arrive only as a transitive
    # dependency of `polars/sql`, so every build without the `sql` feature failed to
    # compile.
    "dtype-decimal",
    # The same for `DataType::Array`, which formats/schema_union.rs matches on; it arrived
    # only through `polars/streaming` or `polars/sql`.
    "dtype-array",
    # Decimal's values are 128-bit, and grouping by them (value counts, a bar
    # chart's categories, `by`) hashes them as unsigned 128-bit: without this
    # Polars panics.
    "dtype-u128",
    "dtype-datetime",
    "dtype-time",
    "dtype-duration",
    # One- and two-byte integers: fixed-record binary files carry them, and Parquet,
    # Arrow and Avro files too. Without these Polars has no supertype or cast for
    # them, so `u8 + 7` or Int64 / UInt8 failed in a query (#625).
    "dtype-i8",
    "dtype-i16",
    "dtype-u8",
    "dtype-u16",
    "ipc",
    # Key-like columns drill in to the rows whose value is not the only one of its
    # kind, which is `is_duplicated` and nothing else expresses in one pass.
    "is_unique",
    "json",
    "lazy",
    # `Expr::meta()`, which a drill uses to read a key's column; it arrived only
    # through `polars/sql`.
    "meta",
    "parquet",
    "polars-io",
    "pivot",
    "temporal",
    "timezones",
    "month_start",
    "month_end",
    "coalesce",
    "regex",
    "abs",
    "round_series",
    # log and exp in the q query language.
    "log",
    "strings",
]
# "sql" enabled via optional feature sql = ["polars/sql", "dep:polars-sql", "dep:sqlparser"]

[dependencies.polars-parquet]
version = "0.55"
default-features = false

# Polars' JSON writer, for list and struct cells written into a CSV or a copy:
# the same text NDJSON export produces, without a lazy round trip per copy.
[dependencies.polars-json]
version = "0.55"
default-features = false

# Polars' Avro schema and serializers, already in the tree through polars/avro:
# its `AvroWriter` cannot name fields apart from the columns or keep a doc.
# `io_ipc`, in the tree through polars/ipc: the IPC reader and writer behind the
# files Arrow streams and GPS logs are converted to.
[dependencies.polars-arrow]
version = "0.55"
default-features = false
features = ["io_avro", "io_ipc"]

[dev-dependencies]
tempfile = "3.8"
# The fixture stamp's digest (tests/shared.rs). Polars already builds it.
sha2 = "0.11"
criterion = "0.8"
# A terminal screen model: app/draw.rs checks a scroll moved by the terminal leaves
# the screen a full redraw would. Nothing in the tree parses escapes into a screen.
vt100 = "0.16"

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