Skip to content

GoZaddy/Jenna

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenna

Jenna is a tool for generating python code using python code(🧠🧠🧠). This is useful for projects like SchemaGen where you need to generate code based on certain input.

Usage

Here's a sample of how Jenna works:

Input:

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:

# 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.

About

A Python code generation tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages