CLI reference

eqcli

Tools for creating equity reports in docker and writing release notes

Usage:

eqcli [OPTIONS] COMMAND [ARGS]...

Options:

  --help  Show this message and exit.

batch-write

Write one or more batches of reports using snakemake running in a docker container. This creates a Project instance which, in turn, creates Batch objects for each option supplied to --locfile and/or --locurl. Then reports are generated for each batch inside the docker container and written out to outdir. The --print-quarto and --print-snakemake flags will provide some feedback as the containers run, but the Batch objects will try to parse logs from their containers and print running counts of successful and failed attempts to write reports.

Todo

  • Reimplement progress bar for interactive use
  • Develop more robust log parsing

Usage:

eqcli batch-write [OPTIONS]

Options:

  -i, --image TEXT         Name or URL of docker image  [default: ghcr.io/ct-
                           data-haven/regions:latest]
  -c, --config-file FILE   Path to snakemake config yaml file  [default:
                           config.yml]
  -t, --file-pattern TEXT  Template literal string to create filenames; can
                           use values from config-file  [default:
                           {id}_equity_{doc_yr}.pdf]
  -f, --locfile FILE       Path to file of location names, one name per line.
                           Can be given multiple times for multiple files.
  -u, --locurl URL         URL to file of location names, one name per line.
                           Can be given multiple times for multiple files.
  -X, --clean              Clean output directory before writing new files
  -G, --clean-glob TEXT    Glob to use for deleting files
  -l, --print-logs         Print logs from docker run
  -q, --print-quarto       Print logs from quarto
  -s, --print-snakemake    Print logs from snakemake
  -r, --tag-rename         Rename files based on version tag
  -p, --project-name TEXT  Name of project
  -o, --outdir DIRECTORY   Path to output directory on the host machine
                           [default: to_distro]
  -v, --version TEXT       Version if tagging; takes precedence over version-
                           file
  -V, --version-file FILE  Path to version file if tagging  [default:
                           pyproject.toml]
  -n, --dry-run            Dry run: print expected operations but do nothing
  --help                   Show this message and exit.

release-notes

Write notes as a markdown table to serve as release notes. The table will include each report's ID as parsed based on id_regex, the path to that file, and the last time modified. This can then be uploaded as release notes on GitHub, either as is or after amending the markdown file manually.

Usage:

eqcli release-notes [OPTIONS]

Options:

  -I, --id-regex TEXT      Regex pattern to extract IDs from filenames
                           [default: (\w+)_equity]
  -m, --md-out FILE        Path to write out notes to markdown  [default:
                           release-notes.md]
  --xwalk-path FILE        Path to crosswalk file for grouping reports, such
                           as between towns and COGs
  --xwalk-join-col TEXT    Column name to join IDs to crosswalk
  --xwalk-group-col TEXT   Column name to group by in the crosswalk
  -q, --quiet              Quiet output
  -p, --project-name TEXT  Name of project
  -o, --outdir DIRECTORY   Path to output directory on the host machine
                           [default: to_distro]
  -v, --version TEXT       Version if tagging; takes precedence over version-
                           file
  -V, --version-file FILE  Path to version file if tagging  [default:
                           pyproject.toml]
  -n, --dry-run            Dry run: print expected operations but do nothing
  --help                   Show this message and exit.

zip-release

Zip all the files from outdir, optionally matching by a glob string. If no glob is given, will match all PDF files in the output directory. Use a crosswalk and the --zip-by-group flag in order to bundle files into some group before zipping.

Usage:

eqcli zip-release [OPTIONS]

Options:

  -I, --id-regex TEXT      Regex pattern to extract IDs from filenames
                           [default: (\w+)_equity]
  -m, --md-out FILE        Path to write out notes to markdown  [default:
                           release-notes.md]
  --xwalk-path FILE        Path to crosswalk file for grouping reports, such
                           as between towns and COGs
  --xwalk-join-col TEXT    Column name to join IDs to crosswalk
  --xwalk-group-col TEXT   Column name to group by in the crosswalk
  -q, --quiet              Quiet output
  -p, --project-name TEXT  Name of project
  -o, --outdir DIRECTORY   Path to output directory on the host machine
                           [default: to_distro]
  -v, --version TEXT       Version if tagging; takes precedence over version-
                           file
  -V, --version-file FILE  Path to version file if tagging  [default:
                           pyproject.toml]
  -n, --dry-run            Dry run: print expected operations but do nothing
  -g, --glob TEXT          Glob to select files for zipping  [default: *.pdf]
  --zip-by-group           Bundle files by grouping column to zip
  -z, --zipdir DIRECTORY   Path to directory for zipped files  [default: .]
  --help                   Show this message and exit.