Turn a function into a process with a simple decorator.
Project description
pyproc
Description
Turn a function into a process with a simple decorator.
This repo is highly inspired by python-worker
Installation
pip install python-pyproc
Guide
from pyproc import process
@process
def func(x: int) -> int:
...
func(123)
@process
async def func(x : int) -> int:
...
await func(123)
Get Return Value
import time
@process
def func(a: int) -> int:
# do some work
time.sleep(5)
return a + 1
worker = func(10)
# this will await the worker to finished and return the value
worker.result # 11 will return after 5 seconds
worker.result # 11 no wait this time
Notes
Only Pass Pickable Types!. Passing Non Pickable Types Like Genrators Will Cause An Error
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-pyproc-1.0.0a0.tar.gz
(4.0 kB
view details)
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 python-pyproc-1.0.0a0.tar.gz.
File metadata
- Download URL: python-pyproc-1.0.0a0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61b722abde0dc080686d047ecb4a64236ea3e49c73cc2f96d193779c1f1799bf
|
|
| MD5 |
dc7d346b189dcd01f3b9b9c9a5674aae
|
|
| BLAKE2b-256 |
1101678e330c8c3380ab1f37ae92e15e510d8552e416f642da51e64b22285d0a
|
File details
Details for the file python_pyproc-1.0.0a0-py3-none-any.whl.
File metadata
- Download URL: python_pyproc-1.0.0a0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0098ca685908ebf4ee20c2a30954405c2b50a649f18bd3e324b9507c1a3b8e0f
|
|
| MD5 |
a11f26d69e68c0e112820a4bcef987ac
|
|
| BLAKE2b-256 |
fe004cd3331706d10a552298f78b93758d7c0ed52430c2f993425fc62a5d708e
|