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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file atentry-1.0.0.tar.gz.

File metadata

  • Download URL: atentry-1.0.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.17.4-200.fc35.x86_64

File hashes

Hashes for atentry-1.0.0.tar.gz
Algorithm Hash digest
SHA256 618752421850bd57e6555b62c00b438892de42be66372aaf09012ff11563f4e7
MD5 68543c0c24fbdc1ce00a31db8798f945
BLAKE2b-256 003267d9c944f7f6d4052c39b50a792b2f8c800ccdecaf557d61671eb67db5f4

See more details on using hashes here.

File details

Details for the file atentry-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: atentry-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.17.4-200.fc35.x86_64

File hashes

Hashes for atentry-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b239616a1229a0fe8e2e636db8ef1a4b6ae3352af92747884f564225b4adb3da
MD5 3c5513374b081b0feaffe2a84ac01255
BLAKE2b-256 0bc60806f8eb7585fcd235593903998581ed34223fe9c570e3eafd598b4e9ff1

See more details on using hashes here.

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