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)
| File | Size | Uploaded | |
|---|---|---|---|
| pysh-3.3.1.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|