Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _port(value: str) -> int:
def parser() -> argparse.ArgumentParser:
"""The command line; the server's address and port default to APP_HOST
and APP_PORT (an empty one is unset), read once, here, at start."""
ap = argparse.ArgumentParser(description="Nullius: the run behind a benchmark score.")
ap = argparse.ArgumentParser(prog="nullius serve", description="Nullius: the run behind a benchmark score.")
ap.add_argument("paths", nargs="*", help="job directory (or parent) to scan")
ap.add_argument("--host", default=os.environ.get("APP_HOST") or "127.0.0.1")
ap.add_argument("--port", type=_port, default=os.environ.get("APP_PORT") or "5057")
Expand Down
8 changes: 4 additions & 4 deletions app/nullius/compare/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

EPILOG = """\
examples:
PYTHONPATH=app python3 -m nullius.compare.cli jobs 2026-09-12__22-53-55 2026-09-13__09-10-11
PYTHONPATH=app python3 -m nullius.compare.cli jobs 2026-09-12__22-53-55 2026-09-13__09-10-11 --matched
PYTHONPATH=app python3 -m nullius.compare.cli jobs 2026-09-12__22-53-55 2026-09-13__09-10-11 --json
nullius compare jobs 2026-09-12__22-53-55 2026-09-13__09-10-11
nullius compare jobs 2026-09-12__22-53-55 2026-09-13__09-10-11 --matched
nullius compare jobs 2026-09-12__22-53-55 2026-09-13__09-10-11 --json

exit codes:
0 done
Expand Down Expand Up @@ -212,7 +212,7 @@ def _emit(doc) -> None:

def main(argv=None) -> int:
ap = argparse.ArgumentParser(
prog="python3 -m nullius.compare.cli", description=__doc__.splitlines()[0],
prog="nullius compare", description=__doc__.splitlines()[0],
epilog=EPILOG, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("root", metavar="ROOT", help="the root the jobs are under")
ap.add_argument("job_ids", metavar="JOB_ID", nargs="+",
Expand Down
8 changes: 4 additions & 4 deletions app/nullius/importers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

EPILOG = """\
examples:
PYTHONPATH=app python3 -m nullius.importers.cli /path/to/logs -o jobs_imported
PYTHONPATH=app python3 -m nullius.importers.cli /path/to/logs -o jobs_imported --json
PYTHONPATH=app python3 -m nullius.importers.cli --list
nullius import /path/to/logs -o jobs_imported
nullius import /path/to/logs -o jobs_imported --json
nullius import --list

exit codes:
0 done
Expand All @@ -47,7 +47,7 @@

def main(argv=None) -> int:
ap = argparse.ArgumentParser(
prog="python3 -m nullius.importers.cli", description=__doc__.splitlines()[0],
prog="nullius import", description=__doc__.splitlines()[0],
epilog=EPILOG, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("run_dir", nargs="?", help="the harness's run tree")
ap.add_argument("-o", "--out", default="jobs_imported",
Expand Down
2 changes: 1 addition & 1 deletion app/nullius/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def migrate_providers(apply_it: bool) -> int:


def main(argv=None) -> int:
parser = argparse.ArgumentParser(description="Copy legacy settings, custom catalogue entries and workspaces; preview by default.")
parser = argparse.ArgumentParser(prog="nullius migrate", description="Copy legacy settings, custom catalogue entries and workspaces; preview by default.")
parser.add_argument("--from", dest="checkout", type=Path, help="existing Nullius checkout (left unchanged)")
parser.add_argument("--secrets", type=Path, help="also copy a legacy benchmark licence directory")
parser.add_argument("--providers", action="store_true",
Expand Down
2 changes: 1 addition & 1 deletion app/nullius/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def secrets_dir(env=None) -> str:


def main(argv=None) -> int:
parser = argparse.ArgumentParser(description="Show Nullius's persistent user directories (no secret values).")
parser = argparse.ArgumentParser(prog="nullius paths", description="Show Nullius's persistent user directories (no secret values).")
parser.add_argument("--json", action="store_true")
args = parser.parse_args(argv)
values = {"settings": settings_file(), "secrets": secrets_dir(), "prices": prices_file(), "own prices": own_prices_file(), "catalogue": catalogue_dir(),
Expand Down
14 changes: 7 additions & 7 deletions app/nullius/runs/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@

EPILOG = """\
examples:
PYTHONPATH=app python3 -m nullius.runs.cli list jobs
PYTHONPATH=app python3 -m nullius.runs.cli list jobs jobs_imported --json
PYTHONPATH=app python3 -m nullius.runs.cli show jobs 2026-09-12__22-53-55 --json
PYTHONPATH=app python3 -m nullius.runs.cli show jobs 2026-09-12__22-53-55 astropy__astropy-8707__agWFDYq
PYTHONPATH=app python3 -m nullius.runs.cli show jobs 2026-09-12__22-53-55 astropy__astropy-8707__agWFDYq --call 3 --request
PYTHONPATH=app python3 -m nullius.runs.cli show jobs 2026-09-12__22-53-55 astropy__astropy-8707__agWFDYq --calls
nullius runs list jobs
nullius runs list jobs jobs_imported --json
nullius runs show jobs 2026-09-12__22-53-55 --json
nullius runs show jobs 2026-09-12__22-53-55 astropy__astropy-8707__agWFDYq
nullius runs show jobs 2026-09-12__22-53-55 astropy__astropy-8707__agWFDYq --call 3 --request
nullius runs show jobs 2026-09-12__22-53-55 astropy__astropy-8707__agWFDYq --calls

exit codes:
0 done
Expand Down Expand Up @@ -339,7 +339,7 @@ def _show(args) -> int:

def main(argv=None) -> int:
ap = argparse.ArgumentParser(
prog="python3 -m nullius.runs.cli", description=__doc__.splitlines()[0],
prog="nullius runs", description=__doc__.splitlines()[0],
epilog=EPILOG, formatter_class=argparse.RawDescriptionHelpFormatter)
sub = ap.add_subparsers(dest="command", metavar="COMMAND")
ls = sub.add_parser("list", help="the job ids under one or more roots, newest first",
Expand Down
2 changes: 1 addition & 1 deletion app/nullius/standard/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def stopped(signum, frame):


def main(argv=None):
ap = argparse.ArgumentParser(prog="nullius.standard.cli", description=__doc__.split("\n\n")[0])
ap = argparse.ArgumentParser(prog="nullius standard", description=__doc__.split("\n\n")[0])
sub = ap.add_subparsers(dest="cmd", required=True)
sub.add_parser("list", help="every definition, and which pairs fit")
c = sub.add_parser("check", help="check the definitions, or one file")
Expand Down
8 changes: 4 additions & 4 deletions app/nullius/workspace_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

EPILOG = """\
examples:
PYTHONPATH=app python3 -m nullius.workspace_cli list
WORKSPACES_DIR=/srv/nullius/workspaces PYTHONPATH=app python3 -m nullius.workspace_cli list --json
PYTHONPATH=app python3 -m nullius.workspace_cli list --home /tmp/ws
nullius workspace list
WORKSPACES_DIR=/srv/nullius/workspaces nullius workspace list --json
nullius workspace list --home /tmp/ws

exit codes:
0 done
Expand Down Expand Up @@ -95,7 +95,7 @@ def _list(args) -> int:

def main(argv=None) -> int:
ap = argparse.ArgumentParser(
prog="python3 -m nullius.workspace_cli", description=__doc__.splitlines()[0],
prog="nullius workspace", description=__doc__.splitlines()[0],
epilog=EPILOG, formatter_class=argparse.RawDescriptionHelpFormatter)
sub = ap.add_subparsers(dest="command", metavar="COMMAND")
ls = sub.add_parser("list", help="the workspaces under the home directory, most recently opened first",
Expand Down
1 change: 0 additions & 1 deletion app/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def test_each_cli_has_help_with_examples_and_the_exit_codes(self):
out = self.sh(module, *args, "--help")
self.assertEqual(out.returncode, 0, out.stderr)
self.assertIn("usage:", out.stdout)
self.assertIn(f"python3 -m nullius.{module}", out.stdout)
self.assertIn("examples:", out.stdout)
self.assertIn("exit codes:", out.stdout)
self.assertIn("--json", out.stdout)
Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_cli_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_help_and_json_results_across_the_named_failure_kinds(self):
with self.subTest(help=module):
out = self.sh(module, "--help")
self.assertEqual(out.returncode, 0, out.stderr)
for line in ("usage:", f"python3 -m nullius.{module}", "examples:", "exit codes:"):
for line in ("usage:", "examples:", "exit codes:"):
self.assertIn(line, out.stdout)
self.assertEqual(out.stderr, "")

Expand Down
11 changes: 11 additions & 0 deletions app/tests/test_unified_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ def test_top_level_help_and_module_entry_point(self):
self.assertIn(command, result.stdout)
self.assertEqual(list(self.root.iterdir()), [])

def test_each_command_help_names_the_command_as_typed(self):
for command in cli.COMMANDS:
if command == "serve": # needs Flask: the route suite reads its parser
continue
with self.subTest(command=command):
result = self.run_cli(command, "--help")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertTrue(result.stdout.startswith(f"usage: nullius {command} "), result.stdout[:80])
self.assertNotIn("PYTHONPATH", result.stdout)
self.assertNotIn("-m nullius.", result.stdout)

def test_version_uses_distribution_name_and_keeps_command_name(self):
for missing, expected in ((False, "0.1.0rc1"), (True, "source checkout")):
with self.subTest(missing=missing):
Expand Down
3 changes: 3 additions & 0 deletions app/ui_tests/test_settings_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,9 @@ def args(self, argv=(), **env):
os.environ.update(env)
return web.parser().parse_args(list(argv))

def test_help_names_the_command_as_typed(self):
self.assertTrue(web.parser().format_help().startswith("usage: nullius serve "))

def test_app_host_and_app_port_are_the_defaults_and_the_flags_win(self):
a = self.args(APP_HOST="0.0.0.0", APP_PORT="6000")
self.assertEqual((a.host, a.port), ("0.0.0.0", 6000))
Expand Down
Loading