Skip to content

Template for a threaded worker-based applications in Python.

License

CC0-1.0, MIT licenses found

Licenses found

CC0-1.0
LICENSE-CC0
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

NibblePoker/Template-Python-Worker-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NibblePoker's Python Worker App Template

Template for a simple threaded worker-based applications in Python.

This template has successfully been used internally for "nibblepoker.lu" since 2021 and has finally been made public for easier referencing and usage in future projects.

The whole demo totals at around 300 LoC and is quite easy to modify.
It can also be taken appart and re-incorporated in other project freely due to the very permissive license.

Customization

Application's Name

The application's name can be changed in 'app/app.py', and you just need to adapt the following lines:

# > Printing the logs header
print_header(logger, "My App")

Workers

Workers are simple objects that extend a common class and point to a thread's main function.

A short example can be found in 'app/my_app/workers/example.py'.

If you want to add your own, you just need to edit the following lines in 'app/app.py' to include your own.

# > Preparing workers.
logger.info("Preparing workers...")
workers: list[Worker] = list()
workers.append(create_example_worker(
    config=config,
    name_suffix="demo",
    sleep_count=5,
    sleep_length_ms=750,
))

Usage

Any Host

cd app/
python ./app.py

Docker-compose

docker-compose up --build -d

Licenses

This project is dual-licensed under the following open-source licenses.
You can choose the one that best suits your needs:

  1. MIT License
      ● Just include the LICENSE-MIT file and be done with it while using an OSI license.

  2. CC0 1.0 Universal (CC0 1.0) (Public Domain)
      ● Do whatever you want with it.
      ● No credit, mentions or anything else is needed.
      ● Just have fun programming :)

About

Template for a threaded worker-based applications in Python.

Topics

Resources

License

CC0-1.0, MIT licenses found

Licenses found

CC0-1.0
LICENSE-CC0
MIT
LICENSE-MIT

Stars

Watchers

Forks