Skip to content

Commit 332a68b

Browse files
authored
Merge pull request #17 from csdms/mcflugen/fix-entry-point
Fix standard-names entry point
2 parents 12b3b60 + 4a8b758 commit 332a68b

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ jobs:
2222

2323
steps:
2424
- uses: actions/checkout@v4
25-
26-
- uses: conda-incubator/setup-miniconda@v2
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
2727
with:
2828
python-version: ${{ matrix.python-version }}
29-
miniforge-variant: Miniforge3
30-
miniforge-version: latest
31-
auto-update-conda: true
3229

3330
- name: Install package and testing dependencies
34-
run: |
35-
pip install .[dev,test]
31+
run: pip install nox
3632

3733
- name: Test
38-
run: nox -s test
34+
run: |
35+
nox -s test
36+
nox -s test-cli

noxfile.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
PYTHON_VERSION = "3.12"
1212

1313

14-
@nox.session(python=PYTHON_VERSION, venv_backend="conda")
14+
@nox.session
1515
def test(session: nox.Session) -> None:
1616
"""Run the tests."""
1717
session.install(".[peg,testing]")
@@ -26,6 +26,18 @@ def test(session: nox.Session) -> None:
2626
session.run("coverage", "report", "--ignore-errors", "--show-missing")
2727

2828

29+
@nox.session(name="test-cli")
30+
def test_cli(session: nox.Session) -> None:
31+
"""Test the cli."""
32+
session.install(".[peg]")
33+
34+
session.run("standard-names", "--help")
35+
session.run("standard-names", "--version")
36+
for cmd in ("build", "dump", "scrape", "sql", "validate"):
37+
session.run("standard-names", cmd, "--help")
38+
session.run("standard-names", cmd)
39+
40+
2941
@nox.session
3042
def lint(session: nox.Session) -> None:
3143
"""Look for lint."""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ docs = [
6666
]
6767

6868
[project.scripts]
69-
"standard-names" = "standard_names.cmd.main:main"
69+
"standard-names" = "standard_names.cli.main:main"
7070

7171
[build-system]
7272
requires = [

src/standard_names/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.8.dev0"
1+
__version__ = "0.2.9.dev0"

src/standard_names/cli/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ def _add_cmd(name: str, *, help: str) -> argparse.ArgumentParser:
6363
"file", type=argparse.FileType("r"), nargs="*", help="Read names from a file"
6464
)
6565
dump_parser.add_argument(
66-
"--field", "-f", action="append", help="Fields to print", choices=VALID_FIELDS
66+
"--field",
67+
"-f",
68+
action="append",
69+
default=[],
70+
help="Fields to print",
71+
choices=VALID_FIELDS,
6772
)
6873
dump_parser.add_argument(
6974
"--sort", action=argparse.BooleanOptionalAction, help="Sort/don't sort names"
@@ -120,7 +125,7 @@ def build(args: argparse.Namespace) -> int:
120125

121126

122127
def dump(args: argparse.Namespace) -> int:
123-
fields = [VALID_FIELDS[field] for field in args.field] or None
128+
fields = [VALID_FIELDS[field] for field in args.field]
124129

125130
registry = NamesRegistry([])
126131
for file in args.file:

0 commit comments

Comments
 (0)