#csv #schema #python #validate #infer #data-type #csv-input

baskerville

Infer and validate data-type schemas in Rust

3 releases (breaking)

0.3.0 Mar 3, 2024
0.2.0 Sep 11, 2023
0.1.0 Sep 6, 2023

#1667 in Database interfaces

Download history 3/week @ 2024-02-19 79/week @ 2024-02-26 76/week @ 2024-03-04 16/week @ 2024-03-11 34/week @ 2024-04-01

54 downloads per month

MIT license

625KB
615 lines


Crates.io docs.rs GitHub

Infer and validate data-type schemas in Rust and Python.

RustPython

Installation

cargo add baskerville

Example

# mascots.csv
Name,LOC,Species
Ferris,42,Crab
Corro,7,Urchin
use baskerville::{infer_csv_with_options, CsvInput, InferOptions};

fn main() {
    let fields = infer_csv_with_options(
        CsvInput::Path("mascots.csv"),
        &mut InferOptions {
            has_headers: true,
            ..InferOptions::default()
        },
    )
    .unwrap();
    println!("{fields}");
}

Output:

╭──────┬─────────┬─────────╮
│ Name │ LOC     │ Species │
├──────┼─────────┼─────────┤
│ Text │ Integer │ Text    │
│      │ Float   │         │
│      │ Text    │         │
╰──────┴─────────┴─────────╯

Contributing

Versioning

The repo bases versioning from Conventional Commits

Dependencies

~3–10MB
~76K SLoC