Skip to main content

Simple markdown/html report templating with loops, tables, lists, media, slots, Pydantic and SQLAlchemy.

Project description

relator

 ______________________  
|______________________| 
   |________________|    
 .-'                '-.  
(26)================(05) 
  |  ||  ||  ||  ||  |   
  |  ||  ||  ||  ||  |      111111111       1111111111    111            33333333       33333333333      00000000      00000000
  |  ||  ||  ||  ||  |      11       11     1        1    1 1           33       3      3         3     00      00     00      00
  |  ||  ||  ||  ||  |      11 1111   1     1  1111111    1 1           3  3333  3      3333   3333     0  0000  0     00 0000  0
  |  ||  ||  ||  ||  |      11 1  1   1     1  1          1 1           3  3   3  3        3   3        0  0  0  0     00 0  0  0
  |  ||  ||  ||  ||  |      11 1111   1     1  11111      1 1           3  3333   3        3   3        0  0  0  0     00 0000  0
  |  ||  ||  ||  ||  |      11       11     1      1      1 1           3         3        3   3        0  0  0  0     00      00
  |  ||  ||  ||  ||  |      11 111 11       1  11111      1 1           3   3333  3        3   3        0  0  0  0     00 000 00
  |  ||  ||  ||  ||  |      11 1 11  1      1  1          1 1           3  3   3  3        3   3        0  0  0  0     00  0 00  0
  |  ||  ||  ||  ||  |      11 1   1  1     1  1111111    1 1111111     3  3   3  3        3   3        0  0000  0     00  0   0  0
  |  ||  ||  ||  ||  |      11 1     1      1        1    1 1     1     3  3   3  3        3   3        00      00     00  0     0 
  |  ||  ||  ||  ||  |      1111     1111   1111111111    111111111     3333   3333        33333         00000000      00000     0000
   |________________|    
  |__________________|   
 |____________________|  
|______________________| 
| |||||||||||||||||||| |     --------------------------------------------------------------------------------------
|______________________| 
                                                   TEMPLATES      ▪      DATA      ▪      REPORTS

Шаблоны Markdown/HTML для отчётов: таблицы, списки, циклы %%len=%%, секции %%render%%, дерево [[TREE]], JSON [[JSON]], слоты @@...@@, медиа (Pillow, matplotlib), сохранение контекста при compile и inject, опционально Pydantic и SQLAlchemy.

Установка

pip install relator
pip install "relator[integrations]"

Импорт

from relator import Template

t = Template("template.md", assets_dir="assets")
t.data(["title", "Заголовок"])
t.compile("out.md")

Документация

docs/GUIDE.md — синтаксис, API, пример шаблон + код.

prototyping/example/99_full_reference/ — длинный шаблон и скрипт сборки.

Остальные сценарии: prototyping/example/README.md.

CLI

relator --template template.md --inspect
relator --template template.md --context ctx.json --output report.md

Релиз на PyPI

python -m build
twine check dist/*
twine upload dist/*

Версию меняйте в pyproject.toml. Токен PyPI храните только в переменных окружения или в CI, не в репозитории.

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

relator-1.3.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

relator-1.3.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file relator-1.3.0.tar.gz.

File metadata

  • Download URL: relator-1.3.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for relator-1.3.0.tar.gz
Algorithm Hash digest
SHA256 175d93b277cadb2dc57c95679bde82c5d8a1a482273eb8a6d0f06bcedb4c3ba0
MD5 397657ff003c27a5a9b60abf3ef15d73
BLAKE2b-256 0ad2555403c4dfd385df73a08105c72b041e46bc0fe6a1f6457b382f48e153fd

See more details on using hashes here.

File details

Details for the file relator-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: relator-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for relator-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83343c179d34d18e68a98b227b1cfe0199495fc25054763f1da30b7aa2b27e33
MD5 9541a8956da015555d678575832547ed
BLAKE2b-256 b38403a421ea2c10be1a2e0eaad55d0a010d8597d98ca9d4b78fd54f60d31222

See more details on using hashes here.

Supported by

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