Bläddra i källkod

refactor: streamline entry point and update version

Reorganized the script's main execution logic into a `main` function for clearer entry point definition and better maintainability. Updated the project version to 0.1.1, reflecting these changes alongside minor fixes. Adjusted the script reference in `pyproject.toml` to align with the new entry point structure, ensuring proper package execution as a console script. This refactor enhances code readability and supports more flexible future updates.
Kumi 6 månader sedan
förälder
incheckning
02d7441f38
2 ändrade filer med 6 tillägg och 4 borttagningar
  1. 2 2
      pyproject.toml
  2. 4 2
      src/matrix_rssbot/__main__.py

+ 2 - 2
pyproject.toml

@@ -7,7 +7,7 @@ allow-direct-references = true
 
 [project]
 name = "matrix-rssbot"
-version = "0.1.0"
+version = "0.1.1"
 
 authors = [
   { name="Private.coffee Team", email="support@private.coffee" },
@@ -41,7 +41,7 @@ dependencies = [
 "Bug Tracker" = "https://git.private.coffee/PrivateCoffee/matrix-rssbot/issues"
 
 [project.scripts]
-rssbot = "matrix_rssbot:main"
+rssbot = "matrix_rssbot.__main__:main"
 
 [tool.hatch.build.targets.wheel]
 packages = ["src/matrix_rssbot"]

+ 4 - 2
src/matrix_rssbot/__main__.py

@@ -18,8 +18,7 @@ def get_version():
     return package_version
 
 
-if __name__ == "__main__":
-    # Parse command line arguments
+def main():
     parser = ArgumentParser()
     parser.add_argument(
         "--config",
@@ -53,3 +52,6 @@ if __name__ == "__main__":
         print("Received KeyboardInterrupt - exiting...")
     except SystemExit:
         print("Received SIGTERM - exiting...")
+
+if __name__ == "__main__":
+    main()