From 4d5268cac162fa8c27fe52870a83a1f97a4c0640 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 29 Mar 2022 14:48:03 -0400 Subject: [PATCH] Move into module and define entry point script --- .gitignore | 1 + octoprint_reservations/__init__.py | 0 .../google_calendar.py | 0 main.py => octoprint_reservations/main.py | 2 +- pyproject.toml | 5 ++++- 5 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 octoprint_reservations/__init__.py rename google_calendar.py => octoprint_reservations/google_calendar.py (100%) rename main.py => octoprint_reservations/main.py (96%) diff --git a/.gitignore b/.gitignore index 9aabce7..a9bd19a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /printers.yaml /__pypackages__/ /.pdm.toml +__pycache__/ diff --git a/octoprint_reservations/__init__.py b/octoprint_reservations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/google_calendar.py b/octoprint_reservations/google_calendar.py similarity index 100% rename from google_calendar.py rename to octoprint_reservations/google_calendar.py diff --git a/main.py b/octoprint_reservations/main.py similarity index 96% rename from main.py rename to octoprint_reservations/main.py index 332435f..a397e6e 100755 --- a/main.py +++ b/octoprint_reservations/main.py @@ -5,7 +5,7 @@ from datetime import datetime, timedelta from octorest import OctoRest from ruamel.yaml import YAML -from google_calendar import CalendarService +from .google_calendar import CalendarService def get_printer_job(calendar, printer): diff --git a/pyproject.toml b/pyproject.toml index 5a0168c..956c42c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "Octoprint Reservations" +name = "octoprint_reservations" version = "0.1.0" description = "" authors = [{ name = "Adam Goldsmith", email = "adam@adamgoldsmith.name" }] @@ -12,6 +12,9 @@ dependencies = [ ] requires-python = ">=3.9" +[project.scripts] +octoreservations = "octoprint_reservations.main:main" + [tool.pdm] [[tool.pdm.source]] url = "https://pypi.org/simple"