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	0m3.021s
user	0m0.151s
sys	0m1.420s
---------------------------------------------------
10000 spawns with fastprocess (posix_spawn)...

real	0m3.240s
user	0m1.746s
sys	0m0.265s
---------------------------------------------------
10000 spawns with old fastprocess (fork/exec)...

real	0m3.624s
user	0m0.863s
sys	0m2.738s
---------------------------------------------------
10000 spawns with subprocess...

real	0m10.873s
user	0m4.902s
sys	0m9.480s
---------------------------------------------------

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-1.0.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

fastprocess-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastprocess-1.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for fastprocess-1.0.1.tar.gz
Algorithm Hash digest
SHA256 80f19433c43b76b9e5224ccf4ec0023ab039c3ee1c7d3f2cedba1a6ec47d8e1b
MD5 223c0b9eb22d5e5d25fde00f9020d14a
BLAKE2b-256 6cfc070696438308b8dfbd6577215402ce02ca99c6ed816c04e8e94e600eb3b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastprocess-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for fastprocess-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f592aeea517ce6f12349b84987a9444a93db267da997bffb1e1be3577bebb3f
MD5 32e1d25dc9ec3cc3573be569c289a9f3
BLAKE2b-256 c4eb699fb1857480fd00c385f7c2916eb0fbd7d5848a4566083b087cf0ae017e

See more details on using hashes here.

Supported by

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