From 27c471b69ed49b49b8306e7a0aa4e96f820a52e8 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Sun, 3 Mar 2024 16:48:12 -0700 Subject: [PATCH 1/5] fix path to entry point --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 70cb3ab..3865261 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ docs = [ ] [project.scripts] -"standard-names" = "standard_names.cmd.main:main" +"standard-names" = "standard_names.cli.main:main" [build-system] requires = [ From d48d1e2ada90255a9c99e4bf9fc0ada491c75de1 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Sun, 3 Mar 2024 16:48:28 -0700 Subject: [PATCH 2/5] add a test-cli session --- noxfile.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 2aa98e8..eeb3afa 100644 --- a/noxfile.py +++ b/noxfile.py @@ -11,7 +11,7 @@ PYTHON_VERSION = "3.12" -@nox.session(python=PYTHON_VERSION, venv_backend="conda") +@nox.session def test(session: nox.Session) -> None: """Run the tests.""" session.install(".[peg,testing]") @@ -26,6 +26,18 @@ def test(session: nox.Session) -> None: session.run("coverage", "report", "--ignore-errors", "--show-missing") +@nox.session(name="test-cli") +def test_cli(session: nox.Session) -> None: + """Test the cli.""" + session.install(".[peg]") + + session.run("standard-names", "--help") + session.run("standard-names", "--version") + for cmd in ("build", "dump", "scrape", "sql", "validate"): + session.run("standard-names", cmd, "--help") + session.run("standard-names", cmd) + + @nox.session def lint(session: nox.Session) -> None: """Look for lint.""" From 92cafe755c3d4d2b69fa7436d303b2b88cf2152b Mon Sep 17 00:00:00 2001 From: mcflugen Date: Sun, 3 Mar 2024 16:50:30 -0700 Subject: [PATCH 3/5] run cli tests; use setup-python --- .github/workflows/test.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 269552b..bc3fccd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,17 +22,15 @@ jobs: steps: - uses: actions/checkout@v4 - - - uses: conda-incubator/setup-miniconda@v2 + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - miniforge-variant: Miniforge3 - miniforge-version: latest - auto-update-conda: true - name: Install package and testing dependencies - run: | - pip install .[dev,test] + run: pip install nox - name: Test - run: nox -s test + run: | + nox -s test + nox -s test-cli From 4daf71b5ef3c2a2b5e9d5c581b30116a5325f982 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Sun, 3 Mar 2024 16:51:02 -0700 Subject: [PATCH 4/5] bump version to 0.2.9.dev0 --- src/standard_names/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/standard_names/_version.py b/src/standard_names/_version.py index a93b78a..bb0ee74 100644 --- a/src/standard_names/_version.py +++ b/src/standard_names/_version.py @@ -1 +1 @@ -__version__ = "0.2.8.dev0" +__version__ = "0.2.9.dev0" From 4a8b75825eedfb58dfd1859e47cca0b436f747c1 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Sun, 3 Mar 2024 16:51:46 -0700 Subject: [PATCH 5/5] noop for dump command prints no fields --- src/standard_names/cli/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/standard_names/cli/main.py b/src/standard_names/cli/main.py index 239fa58..b511bb4 100644 --- a/src/standard_names/cli/main.py +++ b/src/standard_names/cli/main.py @@ -63,7 +63,12 @@ def _add_cmd(name: str, *, help: str) -> argparse.ArgumentParser: "file", type=argparse.FileType("r"), nargs="*", help="Read names from a file" ) dump_parser.add_argument( - "--field", "-f", action="append", help="Fields to print", choices=VALID_FIELDS + "--field", + "-f", + action="append", + default=[], + help="Fields to print", + choices=VALID_FIELDS, ) dump_parser.add_argument( "--sort", action=argparse.BooleanOptionalAction, help="Sort/don't sort names" @@ -120,7 +125,7 @@ def build(args: argparse.Namespace) -> int: def dump(args: argparse.Namespace) -> int: - fields = [VALID_FIELDS[field] for field in args.field] or None + fields = [VALID_FIELDS[field] for field in args.field] registry = NamesRegistry([]) for file in args.file: