From b6543ee0fb5cbd0f1413b602a816059c896a9af0 Mon Sep 17 00:00:00 2001 From: k88hudson-cfa Date: Tue, 3 Feb 2026 00:03:55 -0500 Subject: [PATCH 1/5] feat: Add support for installing as a tool --- docs/index.md | 28 ++++++++++++++++++++++------ griddler/__main__.py | 4 ++-- pyproject.toml | 3 +++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/docs/index.md b/docs/index.md index 00fa4fa..3dcaf02 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,20 +1,35 @@ # griddler -Griddles are the main functionality of griddle. Read about the [griddle schema](griddles.md) to get started. +Griddles are the main functionality of griddle. Read about the [griddle schema](griddles.md) to learn more about the format. -## Using griddler from the command line +## Getting started -Griddler can also be used on the command line to read an input YAML (or JSON) and write output JSON: +### Command-line usage +Griddler can be used from the command line with any language. It reads a YAML (or JSON) +griddle definition and writes the expanded parameter sets as JSON. + +You can install it from GitHub with `uv` or another git-backed package maanger: + +```bash +uv tool install git+https://github.com/cdcgov/griddler.git ``` -python -m griddler my_griddle.yaml > my_parameter_sets.json + +Example usage: + +```bash +griddler my_griddle.yaml > my_parameter_sets.json ``` Use the `--help` flag for more details. -## Using griddle in other python projects +### Python API -You can generate a griddle directly in Python: +You can also directly generate a griddle directly in Python: + +```bash +uv add git+https://github.com/cdcgov/griddler.git +``` ```python import yaml @@ -29,3 +44,4 @@ parameter_sets = griddle.parse() ``` See the [API reference](api.md) for specifics on griddler's internals. + diff --git a/griddler/__main__.py b/griddler/__main__.py index 6c0b25d..cdf4f6a 100644 --- a/griddler/__main__.py +++ b/griddler/__main__.py @@ -7,9 +7,9 @@ import griddler -def main(args): +def main(args=None): parser = argparse.ArgumentParser( - prog="python -m griddler", + prog="griddler", description="Parse a griddle into a list of dictionaries.", ) diff --git a/pyproject.toml b/pyproject.toml index 6934fc7..86c48d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,3 +23,6 @@ dev = [ [build-system] requires = ["hatchling"] build-backend = "hatchling.build" + +[project.scripts] +griddler = "griddler.__main__:main" From 712eaf5d35d74d74c9e7865c6614af0c292f650d Mon Sep 17 00:00:00 2001 From: k88hudson-cfa Date: Tue, 3 Feb 2026 00:26:45 -0500 Subject: [PATCH 2/5] fix: Show help if no args --- griddler/__main__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/griddler/__main__.py b/griddler/__main__.py index cdf4f6a..eb7a699 100644 --- a/griddler/__main__.py +++ b/griddler/__main__.py @@ -52,6 +52,11 @@ def main(args=None): args = parser.parse_args(args) + # Show help if no args are provided + if args.input is sys.stdin and sys.stdin.isatty(): + parser.print_help() + sys.exit(1) + if args.from_ == "yaml": raw = yaml.safe_load(args.input) elif args.from_ == "json": From 70acdf79f270921f2a93e39b0ad5becf86a23d65 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 05:27:20 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 3dcaf02..5c1b43b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ Griddles are the main functionality of griddle. Read about the [griddle schema](griddles.md) to learn more about the format. -## Getting started +## Getting started ### Command-line usage @@ -44,4 +44,3 @@ parameter_sets = griddle.parse() ``` See the [API reference](api.md) for specifics on griddler's internals. - From 50e33f81ab72287ddeda6f544a4bc46df5a916d6 Mon Sep 17 00:00:00 2001 From: Scott Olesen Date: Wed, 20 May 2026 15:09:23 -0400 Subject: [PATCH 4/5] Update docs/index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 5c1b43b..e7a7aaf 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ griddle definition and writes the expanded parameter sets as JSON. You can install it from GitHub with `uv` or another git-backed package maanger: ```bash -uv tool install git+https://github.com/cdcgov/griddler.git +uv tool install git+https://github.com/cdcgov/pygriddler.git ``` Example usage: From 8bffb563a2788c453bff9d00cb23d84223cabcef Mon Sep 17 00:00:00 2001 From: Scott Olesen Date: Wed, 20 May 2026 15:09:30 -0400 Subject: [PATCH 5/5] Update docs/index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index e7a7aaf..8516306 100644 --- a/docs/index.md +++ b/docs/index.md @@ -28,7 +28,7 @@ Use the `--help` flag for more details. You can also directly generate a griddle directly in Python: ```bash -uv add git+https://github.com/cdcgov/griddler.git +uv add git+https://github.com/cdcgov/pygriddler.git ``` ```python