Skip to content

CLI Reference

Installing the package puts a philanthropy executable on your PATH. See Use the CLI for worked invocations.

philanthropy.cli

A CSV-in / CSV-out command line for analysts who aren't primarily Python engineers. Three subcommands:

philanthropy train    --data gifts.csv --target is_major_donor \
                      --features total_gift_amount,years_active --out model.joblib
philanthropy score    --model model.joblib --data prospects.csv --out scores.csv
philanthropy validate --model model.joblib --data holdout.csv --target is_major_donor

train saves a self-describing bundle (the fitted model, the feature list, and the scikit-learn / philanthropy versions used); score and validate reuse the feature list stored in that bundle unless you override it with --features.

main(argv=None)

Execute the philanthropy command-line interface.

Parameters:

Name Type Description Default
argv list of str

Command-line arguments passed to the parser. If None, defaults to sys.argv[1:].

None
Source code in philanthropy/cli.py
def main(argv: Optional[Sequence[str]] = None) -> None:
    """Execute the philanthropy command-line interface.

    Parameters
    ----------
    argv : list of str, optional
        Command-line arguments passed to the parser. If None, defaults to sys.argv[1:].
    """
    args = _build_parser().parse_args(argv)
    args.func(args)