<p align="center">
<a href="https://gmwa.github.io/koodu/"><img src="https://github.com/GMWA/koodu/blob/main/docs/assets/images/koodu.png" alt="Koodu"></a>
</p>
<p align="center">
<em>Koodu, simple code generator engine written in python.</em>
</p>
<p align="center">
<a href="https://pypi.org/project/koodu" target="_blank">
<img src="https://img.shields.io/pypi/v/koodu?color=%2334D058&label=version" alt="Package version">
</a>
<a href="https://pypi.org/project/koodu" target="_blank">
<img src="https://img.shields.io/pypi/pyversions/koodu.svg?color=%2334D058" alt="Supported Python versions">
</a>
<a href="https://pypi.org/project/koodu" target="_blank">
<img src="https://img.shields.io/pypi/dm/koodu?color=%2334D058&label=downloads" alt="PyPI - Downloads">
</a>
<a href="https://pypi.org/project/koodu" target="_blank">
<img src="https://img.shields.io/pypi/l/koodu?color=%2334D058&label=licence" alt="PyPI - License">
</a>
</p>
# 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:
```console
$ python -m pip install .
```
### from the index
```console
$ pip install koodu
```
## Usage as CLI
### List the available templates
```console
$ koodu list templates
```
### List the available models
```console
$ koodu list models
```
### generate code using a template and et model
```console
$ 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:
```python
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()
```
Raw data
{
"_id": null,
"home_page": "https://gmwa.github.io/koodu/",
"name": "koodu",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Alex Mboutchouang",
"author_email": "mboutchouangalex@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5c/e4/a8cb821caea19fc0f7088b6a2dbd83b41b26af7e497be3bc8d1aa5c4bd9d/koodu-0.0.5.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <a href=\"https://gmwa.github.io/koodu/\"><img src=\"https://github.com/GMWA/koodu/blob/main/docs/assets/images/koodu.png\" alt=\"Koodu\"></a>\n</p>\n<p align=\"center\">\n <em>Koodu, simple code generator engine written in python.</em>\n</p>\n\n\n<p align=\"center\">\n <a href=\"https://pypi.org/project/koodu\" target=\"_blank\">\n <img src=\"https://img.shields.io/pypi/v/koodu?color=%2334D058&label=version\" alt=\"Package version\">\n </a>\n <a href=\"https://pypi.org/project/koodu\" target=\"_blank\">\n <img src=\"https://img.shields.io/pypi/pyversions/koodu.svg?color=%2334D058\" alt=\"Supported Python versions\">\n </a>\n <a href=\"https://pypi.org/project/koodu\" target=\"_blank\">\n <img src=\"https://img.shields.io/pypi/dm/koodu?color=%2334D058&label=downloads\" alt=\"PyPI - Downloads\">\n </a>\n <a href=\"https://pypi.org/project/koodu\" target=\"_blank\">\n <img src=\"https://img.shields.io/pypi/l/koodu?color=%2334D058&label=licence\" alt=\"PyPI - License\">\n </a>\n</p>\n\n\n# Koodu\n\nKoodu 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.\n\n## Installation\n\n### from code source\n\nClone this repository and run:\n\n```console\n$ python -m pip install .\n```\n\n### from the index\n\n```console\n$ pip install koodu\n```\n\n## Usage as CLI\n\n### List the available templates\n\n```console\n$ koodu list templates\n```\n\n### List the available models\n\n```console\n$ koodu list models\n```\n\n### generate code using a template and et model\n\n```console\n$ koodu generate -t fastapi -m blog -o ./examples/blog\n```\n\nThe path to template can be replace directly with build in template such as `fastapi` or `flask`\n\n\n## Usage as python library\n\nKoodu can also be used as python library as follows:\n\n```python\nimport json\nfrom pathlib import Path\nfrom koodu.generator import Generator\n\nwith open(Path(\"./koodu/models/blog.json\"), \"r\", encoding=\"utf-8\") as fp:\n model = json.loads(fp.read())\n\ntemplate_path = Path(\"./koodu/templates/fastapi\")\noutput_path = Path(\"./examples/blog\")\ngenerator = Generator(\n model=model,\n template_folder=template_path,\n output=Path(args.output)\n)\n\nfor file in generator.render():\n file.write()\n```\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Simple and lightweight code generator engine written in python",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://gmwa.github.io/koodu/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "46a4e8412a52c85c2b43e48ff939f396aa302b822eee142c2fb172e2a16cde6d",
"md5": "ea22786291f570e8dc2e040146adbc31",
"sha256": "504d93d9f87e1274133e605b921659451200212184af5a7955e4f808a235bd45"
},
"downloads": -1,
"filename": "koodu-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ea22786291f570e8dc2e040146adbc31",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 38342,
"upload_time": "2024-08-14T01:27:17",
"upload_time_iso_8601": "2024-08-14T01:27:17.890645Z",
"url": "https://files.pythonhosted.org/packages/46/a4/e8412a52c85c2b43e48ff939f396aa302b822eee142c2fb172e2a16cde6d/koodu-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5ce4a8cb821caea19fc0f7088b6a2dbd83b41b26af7e497be3bc8d1aa5c4bd9d",
"md5": "a5e5a3b422ba6d33df6dbbf85b534229",
"sha256": "da1c1fe09a726c4c517f048af7174445ab06ccee516ec905a724353a0fbdcb0e"
},
"downloads": -1,
"filename": "koodu-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "a5e5a3b422ba6d33df6dbbf85b534229",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 23853,
"upload_time": "2024-08-14T01:27:19",
"upload_time_iso_8601": "2024-08-14T01:27:19.410278Z",
"url": "https://files.pythonhosted.org/packages/5c/e4/a8cb821caea19fc0f7088b6a2dbd83b41b26af7e497be3bc8d1aa5c4bd9d/koodu-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-14 01:27:19",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "koodu"
}