Skip to main content

A fast subprocess library

Project description

WARNING: This library requires python 3.8

Fastprocess

A fast subprocess library

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
---------------------------------------------------

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

fastprocess-2.0.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

fastprocess-2.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file fastprocess-2.0.0.tar.gz.

File metadata

  • Download URL: fastprocess-2.0.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for fastprocess-2.0.0.tar.gz
Algorithm Hash digest
SHA256 54b1885ef2ff56df1fdb79efe384627ece05133305eff82884ba9a68bdaa7c59
MD5 21994522afaca4db40a0ed95974dc436
BLAKE2b-256 23f4ba5ad145b341363c79ce9981f4f37edbd1a2c6f39780acb394a91ac6c260

See more details on using hashes here.

File details

Details for the file fastprocess-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: fastprocess-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for fastprocess-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d259d54956ee9eec9c04c5671806bcebc0d725b8b5d211bcc744895ca405e9
MD5 a59b0f99d7efe33dbb080bae3e4afd46
BLAKE2b-256 e3863ee8136804258d33aca0eb12ba8f77bd6d7f1b63cbe6c6cb2fb01451dae3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page