No project description provided
Project description
lazy-main
Generalized framework for main loop function.
Installation
pip install lazy-main
How to Use
from lazy_main import LazyMain
def main(*args, **kwargs):
print("Hello World!")
def error_handler(exception):
print("An error occurred!", exception)
if __name__ == "__main__":
LazyMain(
main=main,
error_handler=error_handler, # This is optional.
sleep_min=3,
sleep_max=5,
loop_count=-1 # -1 Means it will loop infinitely.
).run()
You can also pass arguments to the main
function.
from lazy_main import LazyMain
def main(*args, **kwargs):
print(kwargs["hello"]) # World!
if __name__ == "__main__":
LazyMain(
main=main,
).run(
hello="World!",
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lazy_main-0.1.2.tar.gz
(1.7 kB
view details)
Built Distribution
File details
Details for the file lazy_main-0.1.2.tar.gz
.
File metadata
- Download URL: lazy_main-0.1.2.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-100-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f543eeb49d462d36a8b63251cadbfb31d52ab11270dbb63c733c9a50c782723a |
|
MD5 | ed78d57138bf1ef9ee16c627c2d0c1f7 |
|
BLAKE2b-256 | cfad4177419342a0fe844b114fd5d331c411f21c7ce4ea783ef6827c7bcf481d |
File details
Details for the file lazy_main-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: lazy_main-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-100-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c598261c02e8fefa23efabe9cf3276af6b7fa0eb20401e324d539a888ff579e |
|
MD5 | edca349f4e927dcac2989f37466f23bd |
|
BLAKE2b-256 | 21f0167370b0f4c0e0c892705d419c6b0dbad1db7f32116eca6c67d0fc3cd596 |