#schema #infer #validate #python #data-type #macro #baskerville

macro baskerville_macro

Macros for 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

#1615 in Procedural macros

46 downloads per month
Used in baskerville

MIT license

3KB


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

~310–760KB
~18K SLoC