Skip to main content

Koodu

Koodu, simple code generator engine written in python.

Package version Supported Python versions PyPI - Downloads PyPI - License

Koodu

Koodu is a simple universal code generator. It allows users to generate codes with the same structure in several projects to save time. Koodu allows users 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

from code source

Clone this repository and run:

$ python -m pip install .

from the index

$ pip install koodu

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 fastapi -m blog -o ./examples/blog

The path to template can be replace directly with build in template such as fastapi or flask

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("./koodu/models/blog.json"), "r", encoding="utf-8") as fp:
    model = json.loads(fp.read())

template_path = Path("./koodu/templates/fastapi")
output_path = Path("./examples/blog")
generator = Generator(
    model=model,
    template_folder=template_path,
    output=Path(args.output)
)

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

Metadata

Release files for koodu 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for koodu 0.0.5
File Size Uploaded
koodu-0.0.5.tar.gz 23.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for koodu 0.0.5
File Interpreter ABI Platform
koodu-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 62.2 kB

Release files / koodu-0.0.5.tar.gz

Download URL koodu-0.0.5.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
da1c1fe09a726c4c517f048af7174445ab06ccee516ec905a724353a0fbdcb0e
BLAKE2b-256 checksum
How to use checksums
5ce4a8cb821caea19fc0f7088b6a2dbd83b41b26af7e497be3bc8d1aa5c4bd9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Linux/5.15.0-117-generic

Release files / koodu-0.0.5-py3-none-any.whl

Download URL koodu-0.0.5-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
504d93d9f87e1274133e605b921659451200212184af5a7955e4f808a235bd45
BLAKE2b-256 checksum
How to use checksums
46a4e8412a52c85c2b43e48ff939f396aa302b822eee142c2fb172e2a16cde6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Linux/5.15.0-117-generic

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page