Skip to main content

Never see `if __name__ == "__main__"` again!

Project description

The @entry decorator

PyPI PyPI - Python Version

Tired of the traditional python if __name__ == '__main__': pattern? Try @entry instead!

@entry is designed to be a simple decorator for declaring main functions in python. In the backend, the same module name check is performed, but it keeps your code a little cleaner.

Usage

Simple example:

from atentry import entry

@entry
def main():
    print("Hello, world!")

Using a return value:

from atentry import entry

@entry
def main() -> int:
    print("Hello, world!")
    return 128 # Program exit code

Installation

Loading this library in your project is as simple as:

# Using Poetry
poetry add atentry

# Using PiP
python3 -m pip install atentry

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atentry-1.0.0.tar.gz (14.4 kB view hashes)

Uploaded Source

Built Distribution

atentry-1.0.0-py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page