Skip to main content

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

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:

pip install inch

Show demo:

python -m inch

Usage

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

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

Metadata

Release files for inch 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inch 0.2.0
File Size Uploaded
inch-0.2.0.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inch 0.2.0
File Interpreter ABI Platform
inch-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.1 kB

Release files / inch-0.2.0.tar.gz

Download URL inch-0.2.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0d2aa9330094c89121ae043f2272f0b94963ee9b1e89bd7e8aef215e49d3c0d8
BLAKE2b-256 checksum
How to use checksums
e02921a1ca50d808efb69877414268bb92e6674718f822be49702498500141a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / inch-0.2.0-py3-none-any.whl

Download URL inch-0.2.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad01d5b6d9268c01b83039060aeaf0e79d6de16b51ad0d87a79c924695378b33
BLAKE2b-256 checksum
How to use checksums
780dce2dd8683e262781750e8fb6d661dc448a14f017afba3c9cf53c5c8385da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page