https://github.com/gozaddy/jenna
A Python code generation tool
https://github.com/gozaddy/jenna
Last synced: about 1 year ago
JSON representation
A Python code generation tool
- Host: GitHub
- URL: https://github.com/gozaddy/jenna
- Owner: GoZaddy
- License: mit
- Created: 2021-05-03T02:30:36.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-21T21:58:06.000Z (over 4 years ago)
- Last Synced: 2025-01-18T15:55:40.329Z (about 1 year ago)
- Language: Python
- Size: 14.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jenna
Jenna is a tool for generating python code using python code(🧠🧠🧠). This is useful for projects like [SchemaGen](https://github.com/GoZaddy/SchemaGen) where you need to generate code based on certain input.
# Usage
Here's a sample of how Jenna works:
Input:
```python
from jenna import Jenna, If, IfElse, Expr, String
jen = Jenna('test.py')
ie = IfElse(
if_=If(
expr=Expr(f"{String('a')} != {String('b')}"),
action=[Expr("print('true')")]
),
else_action=[Expr("print('else')")]
)
ie.add_elif(
If(
expr=Expr(f"{String('a')} == {String('b')}"),
action=[Expr("print('false')")],
if_type='elif'
)
)
jen.write_if_else(ie)
```
Output:
```python
# This file was generated by Jenna
if 'a' != 'b':
print('true')
elif 'a' == 'b':
print('false')
else:
print('else')
```
# Contributing
I'm currently busy with life et al and would really appreciate contributions to Jenna.