Skip to main content

Small boiler plate with tools for multithreading.

Project description

Check Deploy

minibone

Small boiler plate with tools for multithreading.

Minibone is a set of valuable classes for:

  • Daemon: for multithreading tasks
  • Config: To handle configuration setting
  • Among others (I will add more later)

It will be deployed to PyPi when a new release is created

Installation

$ pip install minibone

Usage

Daemon

It is just another python class to do jobs / tasks in the background

Usage as SubClass

  • Subclass Daemon
  • call super().init() in yours
  • Overwrite on_process method with yours
  • Add logic you want to run inside on_process
  • Be sure your methods are safe-thread to avoid race condition
  • self.lock is available for lock.acquire / your_logic / lock.release
  • call start() method to keep running on_process in a new thread
  • call stop() to finish the thread

Check sample_clock.py for a sample

Usage as callback mode

  • Instance Daemon by passing a callable
  • Add logic to your callable method
  • Be sure your callable and methods are safe-thread to avoid race condition
  • call start() method to keep running callable in a new thread
  • call stop() to finish the thread

Check sample_clock_callback.py for a sample

Config

Allows to handle configuration settings in memory and persists them into toml/yaml/json format

from minibone.config import Config

cfg = Config(settings={"listen": "localhost", "port": 80}, filepath="config.toml")

cfg.add("debug", True)

cfg.to_toml()

cfg2 = Config.from_toml("config.toml")

Contribution

  • Feel free to clone this repository, and send any pull requests.
  • Add issues if something is not working as expected.

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

minibone-0.1.0.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

minibone-0.1.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file minibone-0.1.0.tar.gz.

File metadata

  • Download URL: minibone-0.1.0.tar.gz
  • Upload date:
  • Size: 43.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for minibone-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2d12c4e4f0609f7dd2be669a2a29a97c87d08b54b1b403a0d4100f0339aa17a
MD5 adc5cbb81ce4eb909a70289cfb013a87
BLAKE2b-256 94b022831fe141d83424ed117a6dad2cee4c9de177499871058fad0b48af626a

See more details on using hashes here.

File details

Details for the file minibone-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: minibone-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for minibone-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55cbedb021435c00dae2a4887431ea896a347179b528c4b19152e850b5968c05
MD5 46cfc38fc2455d7bb5ba219387375761
BLAKE2b-256 0b981f1201fdb23bece1ecc3d11ab6cbabd185fb9be5a3400e1bb3fb65ac148a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page