From bd48688d7700153cdc08cd7cd56408c8d78fff23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20M=C3=BCller?= Date: Mon, 23 Nov 2026 12:32:37 +0100 Subject: [PATCH] fix: `python -m chipstream.cli` failed with ModuleNotFoundError `chipstream/cli/__main__.py` imported `_main` as a top-level module instead of relative to the package. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG | 2 ++ chipstream/cli/__main__.py | 2 +- tests/test_cli.py | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index ee2d0e3..c54ee33 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +0.11.2 + - fix: `python -m chipstream.cli` failed with ModuleNotFoundError 0.11.1 - enh: don't show rounded 100% in CLI progress - setup: bump dcnum to 0.31.2 diff --git a/chipstream/cli/__main__.py b/chipstream/cli/__main__.py index f5b5eef..5c3ef9b 100644 --- a/chipstream/cli/__main__.py +++ b/chipstream/cli/__main__.py @@ -1,4 +1,4 @@ -from _main import main +from ._main import main if __name__ == '__main__': main() diff --git a/tests/test_cli.py b/tests/test_cli.py index a2bb24e..8379d55 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,6 @@ +import subprocess +import sys + import dcnum.read import h5py import numpy as np @@ -201,6 +204,18 @@ def test_cli_limit_events(cli_runner, limit_events, dcnum_yield, assert h5.attrs["experiment:event count"] == dcnum_yield +def test_cli_python_m(): + """Run the CLI via `python -m chipstream.cli`""" + result = subprocess.run( + [sys.executable, "-m", "chipstream.cli", "--version"], + capture_output=True, + text=True, + check=False, + ) + assert result.returncode == 0, result.stderr + assert chipstream.__version__ in result.stdout + + def test_cli_set_pixel_size(cli_runner): path_temp = retrieve_data( "fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip")