trailpack.cli

Command-line interface for Trailpack.

Provides commands for data processing, validation, and project management.

Attributes

app

console

Functions

check([parquet_file])

Check existing Parquet file for standard compliance.

init([project_name, directory])

Initialize a new Trailpack project structure.

main([version])

Trailpack - Dataset standardization tool.

process([data, sheet, mapping, metadata, output, ...])

Process data file with configs to create a Frictionless Data Package.

ui([port, host])

Launch the Streamlit UI for interactive data mapping.

validate([data, sheet, mapping, metadata])

Validate data and configs without creating output (dry-run).

version_callback(value)

Print version and exit.

Module Contents

trailpack.cli.check(parquet_file: pathlib.Path = typer.Argument(..., help='Path to Parquet file to check'))[source]

Check existing Parquet file for standard compliance.

Reads the Parquet file, extracts metadata, validates against Trailpack standard, and displays quality level.

Example

trailpack check my-dataset.parquet

trailpack.cli.init(project_name: str = typer.Argument(..., help='Name of the project to initialize'), directory: pathlib.Path | None = typer.Option(None, '--dir', '-d', help='Directory to create project in (default: current)'))[source]

Initialize a new Trailpack project structure.

Creates a directory with example configs, data folder, and README with instructions.

Example

trailpack init my-dataset trailpack init my-dataset –dir ~/projects

trailpack.cli.main(version: bool = typer.Option(None, '--version', '-v', callback=version_callback, is_eager=True, help='Show version and exit'))[source]

Trailpack - Dataset standardization tool.

Interactive UI for mapping data to ontologies and creating Frictionless Data Packages for LCA and sustainability research.

trailpack.cli.process(data: pathlib.Path = typer.Option(..., '--data', '-d', help='Path to data file (Excel, CSV)'), sheet: str = typer.Option(None, '--sheet', '-s', help='Sheet name (for Excel files)'), mapping: pathlib.Path = typer.Option(..., '--mapping', '-m', help='Path to mapping config JSON'), metadata: pathlib.Path = typer.Option(..., '--metadata', '-M', help='Path to metadata config JSON'), output: pathlib.Path = typer.Option(..., '--output', '-o', help='Output Parquet file path'), validate_standard: bool = typer.Option(True, '--validate/--no-validate', help='Validate against Trailpack standard'))[source]

Process data file with configs to create a Frictionless Data Package.

Reads data, applies column mappings, validates against standard, and exports to Parquet format with embedded metadata.

Example

trailpack process

–data inventory.xlsx –sheet “Sheet1” –mapping mapping.json –metadata metadata.json –output clean-data.parquet

trailpack.cli.ui(port: int = typer.Option(8501, '--port', '-p', help='Port to run Streamlit on'), host: str = typer.Option('localhost', '--host', help='Host to bind to'))[source]

Launch the Streamlit UI for interactive data mapping.

Opens a browser at localhost:8501 with the full interactive interface for mapping columns to ontologies and exporting data packages.

Example

trailpack ui trailpack ui –port 8080

trailpack.cli.validate(data: pathlib.Path = typer.Option(..., '--data', '-d', help='Path to data file (Excel, CSV)'), sheet: str = typer.Option(None, '--sheet', '-s', help='Sheet name (for Excel files)'), mapping: pathlib.Path = typer.Option(..., '--mapping', '-m', help='Path to mapping config JSON'), metadata: pathlib.Path = typer.Option(..., '--metadata', '-M', help='Path to metadata config JSON'))[source]

Validate data and configs without creating output (dry-run).

Checks data quality, type consistency, and standard compliance without writing any files.

Example

trailpack validate

–data inventory.xlsx –mapping mapping.json –metadata metadata.json

trailpack.cli.version_callback(value: bool)[source]

Print version and exit.

trailpack.cli.app[source]
trailpack.cli.console[source]