Skip to content

flipbit03/main

Repository files navigation

@main

PyPI - Python Version PyPI - Version

@main decorator which runs the tagged function if the current module is being executed as a script.

No more if __name__ == "__main__": all over the place.

That's it!

Installation

pip install python-main # or
poetry add python-main # ...

Usage

from python_main import main

A = 10
B = 20


@main
def do_print():
    """This will run if this module is executed."""
    print(A + B)