No project description provided
Project description
tsk.monster
A cute little task runner.
Usage
from pathlib import Path
from tsk_monster import run, tsk
if __name__ == '__main__':
img1 = Path('img1.jpg')
img2 = Path('img2.jpg')
run(
tsk(
'Download image',
action='wget -o img1.jpg https://picsum.photos/200',
makes=[img1]),
tsk(
'Resize image',
action='convert img1.jpg -resize 100 img2.jpg',
needs=[img1],
makes=[img2]))
Features
- Zero dependencies
- Concise API
- Async and parallel execution
- Tasks run only when needed
Non-file dependencies
You can use any type of dependencies and write your own logic like so:
import asyncio
import logging
from tsk_monster import Tsk, make, need, run
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
async def ingredients():
print('Getting Water')
yield make('Water')
print('Getting Salt')
yield make('Salt')
print('Getting Oil')
yield make('Oil')
print('Getting Flour')
yield make('Flour')
print('Getting Cheese')
yield make('Cheese')
print('Getting Tomato')
yield make('Tomato')
async def dough():
yield need('Water')
yield need('Salt')
yield need('Oil')
yield need('Flour')
print('Making dough...')
await asyncio.sleep(3)
yield make('Dough')
async def pizza():
yield need('Dough')
yield need('Cheese')
yield need('Tomato')
print('Making pizza...')
await asyncio.sleep(2)
print('Pizza is ready!')
yield make('Pizza')
run(
Tsk('Get ingredients', ingredients()),
Tsk('Make dough', dough()),
Tsk('Make pizza', pizza()))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tsk_monster-0.0.4.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for tsk_monster-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ae9e139b51a37e138de57136f74a2c97445b44f6a9b4e418b1e62d894f38f8 |
|
MD5 | 4eea3b71d7154d3f88db6f688fd1c6c1 |
|
BLAKE2b-256 | d278fba2af5807e98d9d7e374ff733a1c9a03486724b3c3f780ee6c0cae56dee |