Metadata-Version: 2.4
Name: inch
Version: 0.2.0
Summary: A Python library for managing and executing long-running tasks in batches with visual progress tracking
Project-URL: Homepage, https://github.com/jannchie/inch
Project-URL: Documentation, https://github.com/jannchie/inch#readme
Project-URL: Bug Tracker, https://github.com/jannchie/inch/issues
Author-email: Jianqi Pan <jannchie@gmail.com>
License: MIT
Keywords: batch-processing,cli,concurrency,multithreading,progress
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: rich>=13.9.2
Description-Content-Type: text/markdown

# inch

Inch is a Python library specifically designed to manage and execute long-running tasks in batches using multithreading. It enhances the user experience by providing a visual progress display through the rich library. The name "Inch" reflects its core functionality, enabling tasks to "move along slowly and carefully," thus ensuring a systematic and controlled execution process.

## DEMO

[Online Demo](https://asciinema.org/a/687421)

## Features

- Define concurrent tasks using an abstract base class.
- Execute multiple tasks concurrently with adjustable worker threads.
- Track and display task progress using the rich library.

## Installation

Inch can be installed using pip:

```bash
pip install inch
```

Show demo:

```bash
python -m inch
```

## Usage

Here's an example of how to use Inch to execute a simple task:

```python
from inch import Inch, InchPoolExecutor
import random
from time import sleep

class TestTask(Inch):
    def __call__(self):
        while self.completed < self.total:
            self.completed += random.randint(1, 200)
            sleep(0.1)

class TestTaskNoProgress(Inch):

    def __call__(self):
        completed = 0
        while completed < 1200:
            completed += random.randint(1, 200)
            sleep(0.1)

with InchPoolExecutor() as executor:
    for i in range(20):
        if i % 5 == 0:
            executor.start_inch(TestTaskNoProgress(name=f"Task {i+1}"))
        else:
            executor.start_inch(TestTask(name=f"Task {i+1}", total=1000))

```
