Skip to main content

pysh

A library of small functions that simplify scripting in python

Installation

pip install pysh

Usage

sh

Run a shell command and display the output:

sh("git status")

Capture the output of a shell command:

res = sh("git status", capture=True)
print(res.stdout)

cd

Change the current working directory:

cd("path/to/dir")

Change the current working directory temporarily:

with cd("path/to/dir"):
    sh("git status")

env

Set an environment variable:

env(var="value")

Set an environment variable temporarily:

with env(PGPASSWORD="MyPassword", PGUSER="postgres"):
    sh("createdb -h localhost -p 5432 -O postgres mydb")

which

Checks whether an executable/script/builtin is available:

git_is_installed = which("git")

Metadata

Release files for pysh 3.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysh 3.3.1
File Size Uploaded
pysh-3.3.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysh 3.3.1
File Interpreter ABI Platform
pysh-3.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / pysh-3.3.1.tar.gz

Download URL pysh-3.3.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e13f4ee9b5b16df1666434053903caba40aaad7f4ec50b00442ec1523aab9d70
BLAKE2b-256 checksum
How to use checksums
b18321df6f4f0ace0b88473325b5d0f965dabfdd13d61ca57af43f665b47bd91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.11.3 Linux/6.0.19-4-MANJARO

Release files / pysh-3.3.1-py3-none-any.whl

Download URL pysh-3.3.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7350f825c0b8bbeb26d6dcced515718a3c34e2f6daea750d4714b9f7688f548a
BLAKE2b-256 checksum
How to use checksums
bb737d5dd3505f0d24a689a5226a13ae05f394023dc05d3b108590bc9bf5bfcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.11.3 Linux/6.0.19-4-MANJARO

Release history Release notifications | RSS feed

This release

3.3.1 This release

2 release files

3.3.0

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.3

2 release files

3.0.2

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

0.2

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page