Skip to main content

This package adds the posibility of running commands in a shared shell

Project description

Shared shell for launching processes in Python

The purpose of this package is to provide a simple way to launch processes in Python but in the same shell. Only one shell is allocated and all the processes are launched in order. There is no need to allocate a different shell on each execution, and therefore it benefits from faster execution and a smaller memory footprint.

Getting started

Installation via pip:

pip install sharedshell

Using it:

from sharedshell import SharedShell

with SharedShell() as shell:
    print(shell.run('echo 1').stdout)
    print(shell.run('echo 2').stdout)
    print(shell.run('echo 3').stdout)

Output:

1
2
3

Benchmarking:

┌---------------------
| os.system
└--------------------
command: Mean +- std dev: 9.22 sec +- 2.33 sec
┌---------------------
| subprocess
└---------------------
command: Mean +- std dev: 7.48 sec +- 1.92 sec
┌---------------------
| sharedshell
└---------------------
command: Mean +- std dev: 2.11 sec +- 0.03 sec

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

sharedshell-0.0.2.tar.gz (3.7 kB view hashes)

Uploaded Source

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