Set your shell free !
Project description
shell
Set your shell free !
Combine python and shell command.
Features
- Light: There are no dependencies
- Async: Work with async/await
- Testable: Unshell script are easily testable because they yield execution control
Setup
pip install unshell
alias unshell=$(pip show unshell | grep Location | cut -d: -f2)/unshell/cli.py
Usage
Execute script through Shell
Execute script through unshell runtime
Usage:
unshell COMMAND [SCRIPT_PATH] [ARGS...]
Commands:
help Print this help message
run run a script through unshell runtime
Given the script: pause.py to pause all docker containers
def pause():
ids = yield from fetchContainerIds()
for id in ids:
yield f"docker pause {id}"
def fetchContainerIds():
ids = yield f"docker ps -q --no-trunc"
return ids.splitlines()
Run it through unshell
unshell run pause.py
Embedded script inside apps
Given the precedent script pause.py
from unshell import Unshell
import os
def main():
script = resolve('./scripts/pause.js') # resolve your python module
try:
Unshell({"env": os.environ})(script)
except Exception as err:
print(err)
Examples
Here is some examples of what you can do with unshell
Contribute
poetry config --local virtualenvs.in-project true
poetry shell
make install
watch make dev
License
The code is available under the MIT license.
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
unshell-0.7.0.tar.gz
(7.5 kB
view details)
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 unshell-0.7.0.tar.gz.
File metadata
- Download URL: unshell-0.7.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.5 Linux/5.13.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd11789996477404658604921b54ebde03933aeef7fc9de34a4d4ed9aeff7a91
|
|
| MD5 |
d70c71a47e938bdca07bfb74a8506f9e
|
|
| BLAKE2b-256 |
3e8936a5b4272edfa395d8278814d089499d2af91ddee333cabe81d8328da1c9
|
File details
Details for the file unshell-0.7.0-py3-none-any.whl.
File metadata
- Download URL: unshell-0.7.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.5 Linux/5.13.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175fe5107a4ab45cb9366b4c473b47adf89e97ae306bc2553c661b5d98adc144
|
|
| MD5 |
c14ebcd68d7c61471ece90842ffac0a3
|
|
| BLAKE2b-256 |
fe1f76988f5f2e1fc6e19cc3891e3f64aba2a87edbf946097e0821f71069b00f
|