From a9ef8c86d3932ad4a82cb3c0aa694cc2273e42e3 Mon Sep 17 00:00:00 2001 From: yadavchiragg Date: Sun, 15 Nov 2026 20:32:23 +0530 Subject: [PATCH] feat(cli): support 'python -m concore_cli' Running 'python -m concore_cli' failed with "'concore_cli' is a package and cannot be directly executed" because the package had no __main__.py. Add it so the CLI also runs as a module when the concore script is not on PATH. Tests and docs included. --- concore_cli/README.md | 6 ++++++ concore_cli/__main__.py | 4 ++++ tests/test_cli_main_module.py | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 concore_cli/__main__.py create mode 100644 tests/test_cli_main_module.py diff --git a/concore_cli/README.md b/concore_cli/README.md index 78f98b1a..65bf531f 100644 --- a/concore_cli/README.md +++ b/concore_cli/README.md @@ -8,6 +8,12 @@ A command-line interface for managing concore neuromodulation workflows. pip install -e . ``` +If the `concore` command is not on your `PATH`, the same CLI runs as a module: + +```bash +python3 -m concore_cli --help +``` + ## Quick Start ```bash diff --git a/concore_cli/__main__.py b/concore_cli/__main__.py new file mode 100644 index 00000000..251f6300 --- /dev/null +++ b/concore_cli/__main__.py @@ -0,0 +1,4 @@ +from .cli import cli + +if __name__ == "__main__": + cli(prog_name="concore") diff --git a/tests/test_cli_main_module.py b/tests/test_cli_main_module.py new file mode 100644 index 00000000..bdd97eb8 --- /dev/null +++ b/tests/test_cli_main_module.py @@ -0,0 +1,27 @@ +import subprocess +import sys +from pathlib import Path + +REPO = Path(__file__).resolve().parent.parent + + +def _run(*args): + return subprocess.run( + [sys.executable, "-m", "concore_cli", *args], + cwd=REPO, + capture_output=True, + text=True, + ) + + +def test_python_dash_m_runs_the_cli(): + result = _run("--version") + assert result.returncode == 0, result.stderr + assert result.stdout.startswith("concore, version ") + + +def test_python_dash_m_shows_commands_under_the_concore_name(): + result = _run("--help") + assert result.returncode == 0, result.stderr + assert "Usage: concore" in result.stdout + assert "validate" in result.stdout