mainmethod.py
Provides C-like main method support.
Sample usage:
# file: script.py
from mainmethod import mainmethod
@mainmethod
def main():
print('hello, world!')
Running the script defined above will execute the method main.
$ python script.py
hello, world
No more need for
if __name__ == '__main__':
main()
The decorator inspects the method marked as main and supports these signatures;
main(). -> No command line arguments.main(argv)(ormain(args)) -> Getsys.argvpassed to the main method call.
from mainmethod import mainmethod
@mainmethod
def main(argv):
message = 'hello, world'
if '--loud' in argv:
message = message.upper()
print(message)
The decorator also automatically gathers the return value from the main method and uses it as the return status code.
Metadata
Release files for mainmethod 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mainmethod-0.1.1.tar.gz | 2.2 kB | Without provenance | Details for mainmethod-0.1.1.tar.gz |
Release files / mainmethod-0.1.1.tar.gz
| Download URL | mainmethod-0.1.1.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c666a1e89997ecd2c89cf63bf5db58ae71cb0298c324673922ed4fe214ac0e64
|
|
BLAKE2b-256 checksum How to use checksums |
52b9d03ab3518fee2d60e0aaef3ef37aaea8bff318da2dc55ca51c86d5c19bf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
|
Security for mainmethod 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.