simple-ipc
Inter-process communication based on stdio
A simple python interface for inter-process communication, a way to asynchronously exchange data with external programs at runtime. The internal mechanism functions by writing data to stdout and reading from stdin using multi threading.
Installation
pip install simple-ipc
Usage
Import the module first:
import ipcfrom ipc import Worker
Parameters
Worker(command, callback=None, start=True, verbose=False)
-
commanda path to an executable along with optional arguments- list: may include spaces
- str: no support for spaces
-
callback(optional) a function that is called after new data has been received- must take exactly one argument
-
start(optional) start the worker automatically when created -
verbose(optional) print status messages
Examples
worker = Worker(['with space.exe', 'spaced arg'], start=False)
with Worker('program.exe', verbose=True) as worker:
...
Worker('path/to/program.exe arg', lambda data: print(data))
A worker object
All data will be converted to type str internally.
Methods
start()starts the workersend(data)sends the data to the external processstop()initiates the termination of all threads and clears all data
Properties
runningindicates the status of the worker (read-only)datacontains the most recent value (read-only)
Example program
from random import randint
from ipc import Worker
def process(data):
if int(data) == 5:
print('Process data...')
worker = Worker('program.exe', process)
while worker.running:
number = randint(1, 10)
worker.send(number)
print(f'Data: {worker.data}')
More example code can be found here.
Metadata
Release files for simple-ipc 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple-ipc-1.2.1.tar.gz | 3.3 kB | Without provenance | Details for simple-ipc-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_ipc-1.2.1-py2-none-any.whl | Python 2 | none | any | Details for simple_ipc-1.2.1-py2-none-any.whl |
Total release size: 7.7 kB
Release files / simple-ipc-1.2.1.tar.gz
| Download URL | simple-ipc-1.2.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4170c8e0b3b4849da3affc7447f461c657e3de7f9bf2e184007fd1f81a486d1
|
|
BLAKE2b-256 checksum How to use checksums |
a5f52912383a76b735a44d552b661c4c2a2865cd594e46607f970bfba032e2fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17
|
Release files / simple_ipc-1.2.1-py2-none-any.whl
| Download URL | simple_ipc-1.2.1-py2-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
f81dd4799a33d5b613f1737e6d61bf0adfd6a21562aa5dbb123fff6c9c71b9eb
|
|
BLAKE2b-256 checksum How to use checksums |
393056d1ad8f50e101389e542af2e4a070787cc442a8d78e0d587b0883bf5b6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17
|
Security for simple-ipc 1.2.1
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.