Skip to main content

Simple and lightweight code generator engine written in python

Project description

Koodu

Koodu, simple code generator engine written in python

Koodu

It is a simple universal code generator. Koodu allows the user to generate codes with the same structure in several projects to save time. Koodu allows you to follow the DRY(Don't Repeat Youself) philosophy, i.e. instead of writing the same code several times, write a template once and use it on several models to generate different code efficiently.

Installation

Clone this repository and run:

python -m pip install .

Usage as CLI

List the available templates

koodu list templates

List the available models

koodu list models

generate code using a template and et model

koodu generate
> -t path-to-template
> -m path-to-model
> -o output-path

The path to temple can be replace directly with build in template such as frontend or backend

Usage as python library

Koodu can also be used as python library as follows:

import json
from pathlib import Path
from koodu.generator import Generator

with open(Path("path-to-model"), "r", encoding="utf-8") as fp:
    model = json.loads(fp.read())

template_path = Path("path-to-template")
output_path = Path("output-path")
generator = Generator(
    model=model,
    template_folder=template_path,
    output=Path(args.output)
)

for file in generator.render():
    file.write()

How to contritube

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

koodu-0.0.1.tar.gz (17.2 kB view hashes)

Uploaded Source

Built Distribution

koodu-0.0.1-py3-none-any.whl (26.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page