A library of small functions that simplify scripting in python
Project description
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysh-3.3.1.tar.gz.
File metadata
- Download URL: pysh-3.3.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.3 Linux/6.0.19-4-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e13f4ee9b5b16df1666434053903caba40aaad7f4ec50b00442ec1523aab9d70
|
|
| MD5 |
3149334bf0492276166841d38d4ce0fa
|
|
| BLAKE2b-256 |
b18321df6f4f0ace0b88473325b5d0f965dabfdd13d61ca57af43f665b47bd91
|
File details
Details for the file pysh-3.3.1-py3-none-any.whl.
File metadata
- Download URL: pysh-3.3.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.3 Linux/6.0.19-4-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7350f825c0b8bbeb26d6dcced515718a3c34e2f6daea750d4714b9f7688f548a
|
|
| MD5 |
68e668b33e034f43640b832826a1e5a6
|
|
| BLAKE2b-256 |
bb737d5dd3505f0d24a689a5226a13ae05f394023dc05d3b108590bc9bf5bfcc
|