Run CPU bound code with subinterpreters using asyncio.
Project description
aiointerpreters
Run CPU bound code in subinterpreters using asyncio.
Installation
Pick the tool of your choosing
uv add aiointerpreters
uv pip install aiointerpreters
pip install aiointerpreters
poetry add aiointerpreters
pdm add aiointerpreters
pipenv install aiointerpreters
Motivation
The concurrent.interpreters api will be added in Python 3.14.
There are several high level mechanisms to access subinterpreters, such as Interpreter.call_in_thread and InterpreterPoolExecutor. But they both come with drawbacks:
call_in_thread: only works for top level functions with no arguments.InterpreterPoolExecutor: uses pickles to pass data between interpreters similar toProcessPoolExecutor.
There are no simple options to take advantage of the fast shared memeory.
Architecture
We must run the interpreters in threads to achieve parallelism. In order to notify futures in the background we must also have a coordniator thread to handle the results.
sequenceDiagram
participant M as Main
participant C as Coordinator
participant W1 as Worker 1
participant W2 as Worker 2
M ->> W1: task queue
M ->> W2: task queue
W1 -->> C: result queue
C -->> M: notify
W2 -->> C: result queue
C -->> M: set_result
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiointerpreters-0.1.1.tar.gz.
File metadata
- Download URL: aiointerpreters-0.1.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3b9ba1a308bd0b5edfe65bfb32c5ea630da0ed6e9f2dcb11ef9093aaff525c0
|
|
| MD5 |
5288673ccf43667d5d4809c345c2f546
|
|
| BLAKE2b-256 |
b5510443a2078ae760778a8f51734a284941e5ba1cdd0a0b31459c6faaa6918e
|
Provenance
The following attestation bundles were made for aiointerpreters-0.1.1.tar.gz:
Publisher:
python-publish.yml on Jamie-Chang/aiointerpreters
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiointerpreters-0.1.1.tar.gz -
Subject digest:
b3b9ba1a308bd0b5edfe65bfb32c5ea630da0ed6e9f2dcb11ef9093aaff525c0 - Sigstore transparency entry: 353236309
- Sigstore integration time:
-
Permalink:
Jamie-Chang/aiointerpreters@89f8b86b1bcd1fde5ff03088ee0bcbaf1fba12b6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Jamie-Chang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89f8b86b1bcd1fde5ff03088ee0bcbaf1fba12b6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiointerpreters-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aiointerpreters-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae6207bc5b6d9d8d281bd73e70473d59f3155ea80364a56eab0ec8d2d712fa48
|
|
| MD5 |
a215edb02d909b866abbd4add3f4f255
|
|
| BLAKE2b-256 |
f16e1e27b8bbe0b8fecf05fdea17e73e8169bc9e23cf2a105890650b345dbf5c
|
Provenance
The following attestation bundles were made for aiointerpreters-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on Jamie-Chang/aiointerpreters
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiointerpreters-0.1.1-py3-none-any.whl -
Subject digest:
ae6207bc5b6d9d8d281bd73e70473d59f3155ea80364a56eab0ec8d2d712fa48 - Sigstore transparency entry: 353236317
- Sigstore integration time:
-
Permalink:
Jamie-Chang/aiointerpreters@89f8b86b1bcd1fde5ff03088ee0bcbaf1fba12b6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Jamie-Chang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89f8b86b1bcd1fde5ff03088ee0bcbaf1fba12b6 -
Trigger Event:
release
-
Statement type: