Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tykit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tykit

A tool kit of progress bars and console logs with rich output, also has a bunch of useful functions used in work.

  • 0.1.5
  • PyPI
  • Socket score

Maintainers
1

tykit (Tell You kit) version rich

Alt Text

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

pbrange

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc