Metadata-Version: 2.4
Name: aio_process_pool
Version: 0.0.3
Summary: An async, (hopefully soon fully) concurrent.futures.Executor compliant, android compatible process pool implementation
Project-URL: Documentation, https://github.com/jeff-dh/aio_process_pool#readme
Project-URL: Issues, https://github.com/jeff-dh/aio_process_pool/issues
Project-URL: Source, https://github.com/jeff-dh/aio_process_pool
Author-email: jeff-dh <1105041+jeff-dh@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.8
Requires-Dist: pytest-asyncio
Description-Content-Type: text/markdown

# aio_process_pool

[![PyPI - Version](https://img.shields.io/pypi/v/aio_process_pool.svg)](https://pypi.org/project/aio_process_pool)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aio_process_pool.svg)](https://pypi.org/project/aio_process_pool)

-----

Tihs pacakage provides an async, (hopefully soon fully) `concurrent.futures.Executor` compliant, android compatible process pool.

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

## Installation

```console
pip install aio_process_pool
```

## Usage

```python
from aio_process_pool import AsyncProcessPool


def foo(x):
    return x


# Note:
# - the process pool must be initialize AFTER all functions that are supposed
#   to be called are defined
# - it's not save to initialize a process pool from a multithreaded process
#   because it's based on `os.fork` / `multiprocessing.Process`
pool = AsyncProcessPool()


async def using_run():
    return await pool.run(foo, 72)


async def using_executor():
    from functools import partial

    loop = asyncio.get_event_loop()
    return await loop.run_in_executor(pool, partial(foo, 74))
```

## License

`aio_process_pool` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
