Skip to main content

A fast subprocess library

Project description

WARNING: This library requires python 3.8


A fast subprocess library


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

Sends SIGTERM to the process

Sends signal 'sig' to the process

Waits for the process to exit then returns the exit code


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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fastprocess, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size fastprocess-2.0.0-py3-none-any.whl (5.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size fastprocess-2.0.0.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page