Giter Site home page Giter Site logo

nibblepoker / template-python-worker-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 15 KB

Template for a threaded worker-based applications in Python.

License: Creative Commons Zero v1.0 Universal

Dockerfile 5.59% Python 94.41%
python worker-threads docker

template-python-worker-app's Introduction

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 :)

template-python-worker-app's People

Contributors

aziascreations avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.