Skip to main content

Wrapper on an iterable to support interruption & auto resume, retrying and multiprocessing.

The code is tested on Linux.

APIs

Please refer to the signature of function.iterate_wrapper or generator.IterateWrapper for usage.

Examples

iterate_wrapper

from typing import IO
from time import sleep

from iterwrap import iterate_wrapper

def square(f_io: IO, item: int, fn: Callable[[float], float]):
    result = fn(item)
    f_io.write(f"{result}\n")

data = list(range(10))
num_workers = 3
iterate_wrapper(
    square,
    data,
    output="output.txt",
    num_workers=num_workers,
    fn=lambda x: x * x,
)

with open("output.txt") as f:
    print(f.read()) # [0, 1, 4, 9, ..., 81]

IterateWrapper

Just the same as tqdm.tqdm.

from iterwrap import IterateWrapper

data = [1, 2, 3]
results = []
for i in IterateWrapper(data):
    results.append(i * i)
print(results) # [1, 4, 9]

Metadata

Release files for iterwrap 0.4.6.post1

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

Source distribution (sdist)

Source distribution for iterwrap 0.4.6.post1
File Size Uploaded Provenance Actions
iterwrap-0.4.6.post1.tar.gz 27.6 kB Without provenance Details for iterwrap-0.4.6.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iterwrap 0.4.6.post1
File Interpreter ABI Platform Actions
iterwrap-0.4.6.post1-py3-none-any.whl Python 3 none any Details for iterwrap-0.4.6.post1-py3-none-any.whl

Total release size: 56.2 kB

Release files / iterwrap-0.4.6.post1.tar.gz

Download URL iterwrap-0.4.6.post1.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
926b1e9bea4463ffd2772f26778f70bf4d090b45b61ae99f565a723fd06f1802
BLAKE2b-256 checksum
How to use checksums
5b2ccc7c31988b93d1ad181cabb8ad1d6aa5d1eaa59c5b10d6ab143a17e43fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Release files / iterwrap-0.4.6.post1-py3-none-any.whl

Download URL iterwrap-0.4.6.post1-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ecbd657ec70981328ff38fc557b7d0ce1ca9ca4eddceee68383eb7741e230bb
BLAKE2b-256 checksum
How to use checksums
d9f72c9e9e529ca5534b9d590bdad57429724d825e72ffcf66e4150cd6ebc4f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Security for iterwrap 0.4.6.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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