This project has been archived by its maintainers, and is no longer receiving any updates.
Fastprocess
A fast subprocess library
[!NOTE] This library is no longer maintained.
Modern versions of subprocess are very close to as fast as this library, so just use that :)
Usage
Spawning a process with fastprocess is very easy
In [1]: from fastprocess import FastProcess
In [2]: pid = FastProcess(['echo', 'hello', 'world'])
hello world
In [3]: pid.wait()
Out[3]: 0
You can redirect io using the stdin, stdout, and stderr options
In [4]: null = open('/dev/null', 'w')
In [5]: pid = FastProcess(['yes'], stdout=null)
In [6]: pid.terminate()
FastProcess methods
terminate():
Sends SIGTERM to the process
kill(sig):
Sends signal 'sig' to the process
wait():
Waits for the process to exit then returns the exit code
Performance
Here are the results of running ./benchmark/bench
---------------------------------------------------
10000 spawns with fork and exec...
real 0m2.157s
user 0m0.048s
sys 0m2.104s
---------------------------------------------------
10000 spawns with fastprocess...
real 0m2.598s
user 0m1.225s
sys 0m0.356s
---------------------------------------------------
10000 spawns with subprocess...
real 0m12.211s
user 0m7.832s
sys 0m9.072s
---------------------------------------------------
Release files for fastprocess 2.1.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 | |
|---|---|---|---|
| fastprocess-2.1.1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastprocess-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / fastprocess-2.1.1.tar.gz
| Download URL | fastprocess-2.1.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c82ffb1394ebd65c600eae0c2c7efdef96689d7b3f92c99ff4747553ef1a856
|
|
BLAKE2b-256 checksum How to use checksums |
e916669ea44541d91487d8bc49b9e970f5a03652b4277bc2b55e67bc2143dd27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / fastprocess-2.1.1-py3-none-any.whl
| Download URL | fastprocess-2.1.1-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91f276e63f0117e409ee99c908e5032da065ac48c6f3bad51a562e083d65b4f9
|
|
BLAKE2b-256 checksum How to use checksums |
7c41575ec2f84ae4ae2b28bd6baf6ab606bf6e44c0964df5918b981d85736182
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|