CLI Util for project code gen by jinja snippets
Project description
Koroviev
Code jinja template generator for structured projects :)Install
pip3 install koroviev
Help and init
For see commands list (man), type to console:
koroviev
For init, type to console (in project root folder):
koroviev init
Simple example: Create template and generate
Test project structure:
test_project
├── .koroviev_templates
├── .koroviev.toml
└── test_project
├── ... other ...
├── base.py
└── cruds
For example, I add one template with name "crud" in my config file (.koroviev.toml) with two params
[setup]
language = 'python'
project_folder = 'test_project'
templates_folder = '.koroviev_templates'
template_extension = 'py'
[templates.crud]
comment = "my test template"
target_project_dir = "cruds/"
params = ["name", "table"]
For easy get auto generate templates folder structure
koroviev structure generate
Create template type folder 'unary': '/home/user/projects/test_project/.koroviev_templates/unary'...
Create template file 'test': '/home/user/projects/test_project/.koroviev_templates/unary/test.py'...
Structure after template folder generate:
test_project
├── .koroviev_templates
│ └── unary
│ └── crud.py
├── .koroviev.toml
└── test_project
├── ... other ...
├── base.py
└── cruds
Fill crud.py with this code:
from test_project.base import BaseCRUD
class {{name|capitalize}}CRUD(BaseCRUD):
table = "{{table}}"
Next, generate "test" crud by this template:
$ koroviev gen crud
Input name for generated file: test
Input 'name' value: test
Input 'table' value: test
Create file by template: /home/user/projects/test_project/test_project/cruds/test.py...
Result cruds/test.py
:
from test_project.base import BaseCRUD
class TestCRUD(BaseCRUD):
table = "test"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
koroviev-0.1.21.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file koroviev-0.1.21.tar.gz
.
File metadata
- Download URL: koroviev-0.1.21.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/5.4.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f34086ddd901ee4ec3db06bc0c8a3332a6523a3969e66b921b9a319e658bb2b |
|
MD5 | bacd99328341288400ffb736321b695b |
|
BLAKE2b-256 | e7662775e371f2eb3d8fb5643b9087a3efd2216925307d6448cc120e828be0a9 |
File details
Details for the file koroviev-0.1.21-py3-none-any.whl
.
File metadata
- Download URL: koroviev-0.1.21-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/5.4.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb3cbe2dfee6005bb0ce860184bf7fb68b5360cdb62812bfe384f99a849d6a14 |
|
MD5 | 8613ffee73454ddeaff46a46e2121270 |
|
BLAKE2b-256 | 01373f5acfd9c5b4331de74bbd56dd516e393bed8c106f5fc1c42c27db9e9e50 |