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
from pysh import sh, cd, env, which
sh("git status") # will display the output of git status
res = sh("git status", capture=True) # will capture stdout and stderr of git status
print(res.stdout) # will print stdout of git status
cd("path/to/dir") # will change the current working directory to path/to/dir
with cd("path/to/dir"): # will change the current working directory to path/to/dir and then change it back to the original directory
sh("git status")
env(var="value") # will set the environment variable var to value
with env(PGPASSWORD="MyPassword"): # will set the environment variable PGPASSWORD to MyPassword and then set it back to the original value
sh("createdb -U postgres -h localhost -p 5432 -O postgres mydb")
which("git") # will return the path to the git executable or None if git is not installed
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
pysh-3.1.2.tar.gz
(2.7 kB
view hashes)
Built Distribution
pysh-3.1.2-py3-none-any.whl
(2.8 kB
view hashes)