Skip to content

Bootstrap statrs-cli #1

Description

@YeungOnion

Tracking issue for standing up this repository as the machine-friendly CLI proposed in statrs-dev/statrs#445.

Background

statrs-dev/statrs#445 proposed pulling the CLI example from statrs PR #302 out of the core statrs crate and into a standalone project, so the command interface, dependencies, and release cycle can evolve independently of the library.

Goals

  • Provide a statrs CLI for one-off calculations, shell scripts, and implementation verification without writing/compiling a Rust program.
  • Machine-friendly by default: JSON input/output, stdin/stdout support, documented non-zero exit codes, structured validation errors, deterministic sampling via explicit seed, no interactive prompts.
  • Discoverable operations via a schema subcommand (e.g. statrs schema, statrs schema distribution normal).
  • Depend on statrs only through its public API.

Example surface (from the proposal)

statrs distribution normal cdf --mean 0 --std-dev 1 --x 1.96
statrs sample normal --mean 0 --std-dev 1 --count 100 --seed 42
statrs test t-one-sample --population-mean 200 --input values.json
statrs describe --input values.json

I think it can definitely start with json command input, as it becomes more immediately self documenting than clap (no need to reach back into the command schema), representations of multivariates are more natural.

NORM='"distribution": {"normal": {"mu": "0.0", "sigma": 1}}'
statrs pdf "{$NORM, \"x\": \"1.96\"}"
statrs cdf "{$NORM, \"x\": \"1.96\"}"
statrs icdf "{$NORM, \"p\": \"0.999\"}"
statrs sample "{$NORM}"

DCH='"distribution": {"dirichlet": {"alpha": ["1.5", "0.5", "0.4"]}}'

EDIT: wording, I used the verb "recurse" very incorrectly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions