Skip to content

Commit

Permalink
Merge pull request #17 from csdms/mcflugen/fix-entry-point
Browse files Browse the repository at this point in the history
Fix standard-names entry point
  • Loading branch information
mcflugen committed Mar 4, 2024
2 parents 12b3b60 + 4a8b758 commit 332a68b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 13 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand All @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ docs = [
]

[project.scripts]
"standard-names" = "standard_names.cmd.main:main"
"standard-names" = "standard_names.cli.main:main"

[build-system]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion src/standard_names/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.8.dev0"
__version__ = "0.2.9.dev0"
9 changes: 7 additions & 2 deletions src/standard_names/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 332a68b

Please sign in to comment.