This release is a pre-release and may not be stable for production use.
TasKKontrol is a package for automating tasks.
Basic structure:
Triggerobjects are used to keep track of when tasks need to execute.Taskobjects link together aTriggerobject and a function that represents the task.- A singular
Kontrollerobject is used to manage all tasks.
Triggers
This version of this package implements 3 types of triggers all inheriting the Trigger object.
ConditionTrigger Object:
Defined using a function, which when returns True will activate the trigger.
Example usage:
value = 10
def is_large ():
global value
return True if value > 5 else False
my_trigger = ConditionTrigger(is_large)
CompletionTrigger Object:
Defined using another Task object, trigger activates when the task is finished executing.
Example usage:
def true ():
return True
def do_work ():
print("Working")
first_task = Task(ConditionTrigger(true), do_work)
second_task = Task(CompletionTrigger(first_task), do_work)
TimerTrigger Object:
Defined using a gmtime object, trigger will activate at the time of the object.
Example usage:
from time import time, gmtime
start_time = time()
delay_trigger = TimerTrigger(gmtime(start_time + 10)) # 10 second delay
Tasks
Task Object:
Constructor takes a Trigger object and a target function which will be executed when the trigger activates.
Example usage:
value = 10
def is_large ():
global value
return True if value > 5 else False
def do_work ():
print("Working")
my_task = Task(ConditionTrigger(is_large), do_work)
Kontroller
Kontroller Object:
All tasks need to be added to a Kontroller instance using the addTask() member function. To begin the execution of tasks the Kontroller instance needs to be started either with the start() or launch() member functions. Using the start() function is recomended as it initiates the Kontroller on a seperate thread allowing for concurrent execution.
Example usage:
from TasKKontrol.Task import Task
from TasKKontrol.Triggers import ConditionTrigger, CompletionTrigger
from TasKKontrol.Kontroller import Kontroller
def true ():
return True
def print1 ():
print("1")
def print2 ():
print("2")
def print3 ():
print("3")
# instantiate Kontroller
kontroller = Kontroller()
# create tasks
task1 = Task(ConditionTrigger(true), print1)
task2 = Task(CompletionTrigger(task1), print2)
task3 = Task(CompletionTrigger(task2), print3)
# add tasks
kontroller.addTask(task1)
kontroller.addTask(task2)
kontroller.addTask(task3)
# start the kontroller
kontroller.start()
# start() function is nonblocking
print("Work in parallel with kontroller")
# wait for kontroller to finish
kontroller.wait_finish()
Created and maintained by Artyom Yesayan
Metadata
Release files for TasKKontrol 0.1.0a0
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 | |
|---|---|---|---|---|
| taskkontrol-0.1.0a0.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| TasKKontrol-0.1.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / taskkontrol-0.1.0a0.tar.gz
| Download URL | taskkontrol-0.1.0a0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
297be782ad56b0c40563a2c856ef61e9f46b3bddb0ca20123ddd2b46ab986414
|
|
BLAKE2b-256 checksum How to use checksums |
4134193f26d9836581abff4e11b7f0754f63b315f1450540c20b0260fce57937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / TasKKontrol-0.1.0a0-py3-none-any.whl
| Download URL | TasKKontrol-0.1.0a0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f590d2e143300d3cdb42a8c895ebd01e3ff84e3f73b3af59afc254f6a3e76164
|
|
BLAKE2b-256 checksum How to use checksums |
463c7e9136a5c6d3a7fbc63ea86959e914789e54e72913e094078aa5b147e479
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Security for TasKKontrol 0.1.0a0
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.