From 13539abb20b2a69689b232f7e67f9f0a58c36e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Cl=C3=A9net?= Date: Mon, 10 Jun 2024 16:36:52 +0200 Subject: [PATCH] Command line / entry point for the visualize module --- bids_prov/visualize.py | 7 +++++-- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bids_prov/visualize.py b/bids_prov/visualize.py index fc1783116..ad7408265 100644 --- a/bids_prov/visualize.py +++ b/bids_prov/visualize.py @@ -111,8 +111,8 @@ def main(filename: str, output_file=None, omit_details=True) -> None: viz_jsonld11(jsonld11, output_file) -if __name__ == "__main__": - +def entry_point(): + """ A command line tool for the visualize module """ parser = argparse.ArgumentParser() parser.add_argument("--input_file", type=str, default="res.jsonld", help="data jsonld file ") parser.add_argument("--output_file", type=str, default="res.png", help="output dir where results are written") @@ -120,3 +120,6 @@ def main(filename: str, output_file=None, omit_details=True) -> None: main(opt.input_file, output_file=opt.output_file, omit_details=True) # >> python -m bids_prov.visualize --input_file ./res_temp.jsonld --output_file res.png + +if __name__ == "__main__": + entry_point() diff --git a/pyproject.toml b/pyproject.toml index 88d88dccb..9f6db35d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,4 +53,4 @@ pre-commit = "^3.7.1" pytest-cov = "^5.0.0" [tool.poetry.scripts] -bids_prov_visualizer = "bids_prov.visualize:main" +bids_prov_visualizer = "bids_prov.visualize:entry_point"