From d2edf150cf2c876971383a4a484f289ce7e7f680 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 6 Jan 2025 16:22:23 -0500 Subject: Remove Python main idiom and add coding conventions to README.md I realized I don't need this stupid `__main__` convention anymore because my build system always calls Python programs like `python -m main`, so I just need to have a function named `main()`. I also started adding some general coding conventions to the README and fixed a typo. --- Omni/Log.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Omni/Log.py') diff --git a/Omni/Log.py b/Omni/Log.py index e644a1a..8d61139 100644 --- a/Omni/Log.py +++ b/Omni/Log.py @@ -14,7 +14,7 @@ class LowerFormatter(logging.Formatter): def setup(level: int = logging.INFO) -> logging.Logger: - """Run this in your __main__ function.""" + """Run this in your `main()` function.""" logging.basicConfig( level=level, format="%(levelname)s: %(name)s: %(message)s", @@ -30,6 +30,7 @@ def setup(level: int = logging.INFO) -> logging.Logger: return logger -if __name__ == "__main__": +def main() -> None: + """Entrypoint to test that this kinda works.""" setup() logging.debug("i am doing testing") -- cgit v1.2.3