diff --git a/menu_tools/object_performance/plotter.py b/menu_tools/object_performance/plotter.py index ada63958..0a802868 100755 --- a/menu_tools/object_performance/plotter.py +++ b/menu_tools/object_performance/plotter.py @@ -508,7 +508,7 @@ def run(self): plotter.plot() -def run(): +def main(): parser = argparse.ArgumentParser() parser.add_argument( "cfg_plots", @@ -527,4 +527,4 @@ def run(): if __name__ == "__main__": - run() + main() diff --git a/menu_tools/object_performance/tests/test_turnons_v29.py b/menu_tools/object_performance/tests/test_turnons_v29.py index 4ae892d0..9c4c0e85 100644 --- a/menu_tools/object_performance/tests/test_turnons_v29.py +++ b/menu_tools/object_performance/tests/test_turnons_v29.py @@ -28,7 +28,7 @@ def test_matching_plots_reproduced(test_name): # Run Plotting with patch.object(sys, "argv", testargs): - plotter.run() + plotter.main() # Load result and assert correct outcome with open( diff --git a/menu_tools/rate_plots/plotter.py b/menu_tools/rate_plots/plotter.py index a328d27a..13983d84 100644 --- a/menu_tools/rate_plots/plotter.py +++ b/menu_tools/rate_plots/plotter.py @@ -296,7 +296,7 @@ def run(self, apply_offline_conversion: bool = False) -> None: plotter.plot() -if __name__ == "__main__": +def main(): parser = argparse.ArgumentParser() parser.add_argument( "cfg_plots", help="Path of YAML file specifying the desired plots." @@ -306,3 +306,7 @@ def run(self, apply_offline_conversion: bool = False) -> None: plotter = RatePlotCentral(args.cfg_plots) plotter.run(apply_offline_conversion=True) plotter.run() + + +if __name__ == "__main__": + main() diff --git a/poetry.lock b/poetry.lock index e72abf79..a405b5a2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -851,28 +851,28 @@ xmp = ["defusedxml"] [[package]] name = "platformdirs" -version = "4.1.0" +version = "4.2.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false python-versions = ">=3.8" files = [ - {file = "platformdirs-4.1.0-py3-none-any.whl", hash = "sha256:11c8f37bcca40db96d8144522d925583bdb7a31f7b0e37e3ed4318400a8e2380"}, - {file = "platformdirs-4.1.0.tar.gz", hash = "sha256:906d548203468492d432bcb294d4bc2fff751bf84971fbb2c10918cc206ee420"}, + {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"}, + {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"}, ] [package.extras] -docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] +docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] [[package]] name = "pluggy" -version = "1.3.0" +version = "1.4.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" files = [ - {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, - {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] [package.extras] @@ -1009,13 +1009,13 @@ six = ">=1.5" [[package]] name = "pytz" -version = "2023.3.post1" +version = "2023.4" description = "World timezone definitions, modern and historical" optional = false python-versions = "*" files = [ - {file = "pytz-2023.3.post1-py2.py3-none-any.whl", hash = "sha256:ce42d816b81b68506614c11e8937d3aa9e41007ceb50bfdcb0749b921bf646c7"}, - {file = "pytz-2023.3.post1.tar.gz", hash = "sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b"}, + {file = "pytz-2023.4-py2.py3-none-any.whl", hash = "sha256:f90ef520d95e7c46951105338d918664ebfd6f1d995bd7d153127ce90efafa6a"}, + {file = "pytz-2023.4.tar.gz", hash = "sha256:31d4583c4ed539cd037956140d695e42c033a19e984bfce9964a3f7d59bc2b40"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 105c1a6e..95db9597 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,14 @@ flake8 = "^7.0.0" [tool.poetry.group.test.dependencies] pytest = "7.4.3" +[tool.poetry.scripts] +object_performance = "menu_tools.object_performance.plotter:main" +rate_plots = "menu_tools.rate_plots.plotter:main" + +[options.entry_points."console_scripts"] +object_performance = "menu_tools.object_performance.plotter:main" +rate_plots = "menu_tools.rate_plots.plotter:main" + [tool.pytest.ini_options] filterwarnings = [ "error",