Skip to main content

A simple definition of main

Project description

Define a Python main function in one step - no more __main__!

For any non-trivial projects, use typer and dtyper instead.

Why?

  1. Less typing

  2. Avoid the foolish == '__main_' and other mistakes

How to install

Use pip:

pip install def_main

Usage example

import def_main

@def_main
def main(*argv):
    print('hello,', *argv)

means precisely the same as:

def main(*argv):
    print('hello,', *argv)

if __name__ == '__main__':
    import sys

    main(sys.argv[1:])

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

def_main-0.10.0.tar.gz (1.8 kB view hashes)

Uploaded Source

Built Distribution

def_main-0.10.0-py3-none-any.whl (1.8 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