tykit (Tell You kit)

📜 Description
'tykit--Tell You kit', pronounced like 'ticket', is a toolkit to monitor your scripts' status easily, which has rich and pretty output for progress bar and console logs. The tykit may support more decent output in the future
⚙️ Install
tykit can be easily installed with pip as below
# for python2
pip install tykit
# for python3
pip3 install tykit
🌟 Features
🚀 ProgressBar 进度条
for loop,range,multi-threading and multi-threading with multi-params
pb_range(*args)
This function is just like the python builtin function range()
from tykit import pb_range
from time import sleep
# use pb_range just like range()
for i in pb_range(50):
sleep(0.001)
# or use it as a generator, with some iterabel_files
from tykit import pb_iter
some_task = lambda x: x*x
iterable_file = [x for x in range(100)]
for i in pb_iter(iterable_file):
some_task(i)
pb_multi_thread(workers:int,task,iter_files)
This function intergrates the multi-threading with ProgressBar, which could show the master task's progress in a multi-threading script. The param: workers defined the max-worker of the multi-threading.
from tykit import pb_multi_thread as pbmt
# Firstly, define your task func
task_func = lambda x: x*x*x
# Put your jobs in a iterable data structure
jobs = [x for x in range(1000)]
# run multi-threading with pb(ProgressBar)
# and save the result in a list
max_workers = 20
result = pbmt(max_workers,task_func,jobs)
print(result[10])
pb_multi_thread_partial(workers:int,task,iter_files,**kwargs)
This function is a higher api of pb_multi_thread(), which is suitable for the multi-threading tasks with more than one parameters.
from tykit import pb_multi_thread_partial as pbmtp
# define a task func with multi params
def task(x,a,b,c):
return x+a+b+c
# Put your jobs in a iterable data structure
jobs = [x for x in range(1000)]
# run multi-threading with partial
max_workers = 20
result = pbmtp(max_workers,task,jobs,a=10,b=100,c=-20)
print(result[:10])
🛎️ rlog (Rich-log)
rlog is a module for log printing with rich. It has some functions to print pretty logs and hints. The usage is simple and neat. The samples are shown below👇(for more details, you can find in usage_of_rlog.py in examples)
Metadata
Release files for tykit 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tykit-0.1.5.tar.gz | 15.1 kB | Details |
Release files / tykit-0.1.5.tar.gz
| Download URL | tykit-0.1.5.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb1e26263c0c481b45b8830c619ae5f7d2e6cff477a51bd7a4cc1a6f6fdb8f81
|
|
BLAKE2b-256 checksum How to use checksums |
f9315a456deed976c1879c94c259a72b94b0f480b14066071bb2fff74097256c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.2
|