Define the main function in one step and make it testable
Project description
Define the main function in one step.
For any non-trivial projects, use typer and dtyper instead!
Usage example
Without an return code
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:])
With a return code
import def_main
@def_main
def main(*argv):
print('hello,', *argv)
return argv
means precisely the same as:
def main(*argv):
print('hello,', *argv)
return argv
if __name__ == '__main__':
import sys
returncode = main(sys.argv[1:])
sys.exit(returncode)
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.11.0.tar.gz
(1.7 kB
view hashes)
Built Distribution
Close
Hashes for def_main-0.11.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4df73e045dd77cd1191708deda21ad7f34af73e410e83da52e380777bc7582f9 |
|
MD5 | 70757c8003942fcf2877a8deff75a5fc |
|
BLAKE2b-256 | 7d33650de94de1a910b22eca1addf8f4c9e3cb24b5c7d24a9f682237112be221 |