Skip to main content

Multiprocessing/multithreading made easy

Project description

multifutures

PyPI - Version PyPI - Python Version ci

Multiprocessing/multithreading made easy!


Table of Contents

Installation

python -mpip install multifutures

Usage

import multifutures as mf


def return_square(number: float) -> float:
    squared = number**2
    return squared


results = mf.multiprocess(
    func=return_square,
    func_kwargs=[{"number": i} for i in range(10)],
)

for result in results:
    print(result)

Will print:

FutureResult(exception=None, kwargs={'number': 0}, result=0)
FutureResult(exception=None, kwargs={'number': 1}, result=1)
FutureResult(exception=None, kwargs={'number': 2}, result=4)
FutureResult(exception=None, kwargs={'number': 3}, result=9)
FutureResult(exception=None, kwargs={'number': 4}, result=16)
FutureResult(exception=None, kwargs={'number': 5}, result=25)
FutureResult(exception=None, kwargs={'number': 6}, result=36)
FutureResult(exception=None, kwargs={'number': 7}, result=49)
FutureResult(exception=None, kwargs={'number': 8}, result=64)
FutureResult(exception=None, kwargs={'number': 9}, result=81)

License

multifutures is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multifutures-0.3.2.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

multifutures-0.3.2-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page