Metadata-Version: 2.4
Name: pyshup
Version: 0.1.2
Summary: Python embedded DSL for generating shell scripts
Keywords: python,shell,script,scripting,transpile,codegen,DSL
Author: James Hammer
Author-email: James Hammer <YetAnotherYames@gmail.com>
License-Expression: GPL-3.0-only
License-File: LICENSE
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/JustAnotherJames/pyshup
Project-URL: Issues, https://github.com/JustAnotherJames/pyshup/issues
Description-Content-Type: text/markdown

# Pyshup

**Pyshup** (pronounced “push-up”) is a Python embedded DSL for generating shell scripts.  
Write structured Python code with Pythonic constructs that transpiles into portable, readable shell scripts.

---

## Features

- Embedded DSL in Python for shell scripting  
- context-manager driven AST builder
- Declarative control flow (`If`, `Else`, loops)  
- Variables, commands, and output handling  
- Generates clean, executable shell scripts  
- Composable and structured, making scripts easier to maintain  

---

## Usage

```python
from pyshup import Script, Variable, If, For, Command, Print

script = Script()
with script as s:
    v1 = Variable('v1', 10)
    v2 = Variable('v2', 20)
    v3 = Variable('v3', 0)

    v3.v = v1 + v2

    with If(v3 == 30).Then() as c:
        Print("They're Equal!")
    with c.Else().Then() as c:
        Print("Error, your cpu is bugged")
    
    with For(v3.set(0), v3 < v1 + v2, v3.set(v3 + 1)).Then():
        Print(v3)
    
script.write('./test.sh')
```
And the resulting generated shell:
```bash
v1=10
v2=20
v3=0
v3=$(("$v1" + "$v2"))
if [ $(("$v3" == 30)) -ne 0 ]; then
	echo "They're Equal!"
else
	echo "Error, your cpu is bugged!"
fi
v3=0
while [ $(("$v3" < $(("$v1" + "$v2")))) -ne 0 ]; do
	echo "$v3"
	v3=$(("$v3" + 1))
done
```

---

## Installation

You can install Pyshup via pip:

```bash
pip install pyshup