Skip to content

Commit

Permalink
introduce CLI shortcuts for running and
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhundhausen committed Jan 31, 2024
1 parent 5329918 commit 643b65e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions menu_tools/object_performance/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def run(self):
plotter.plot()


def run():
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"cfg_plots",
Expand All @@ -527,4 +527,4 @@ def run():


if __name__ == "__main__":
run()
main()
2 changes: 1 addition & 1 deletion menu_tools/object_performance/tests/test_turnons_v29.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 5 additions & 1 deletion menu_tools/rate_plots/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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()
22 changes: 11 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 643b65e

Please sign in to comment.