Skip to main content

isis-report-lib

Python library for tabular PDF reports with customizable hierarchical layouts — extracted from the isis_report PoC (Robyn microservice), without the server.

  • Input: dict/ReportPayload (meta + optional layout + data) or .toon text
  • Rendering: Jinja2 (templates bundled in the package)
  • PDF: Playwright (Chromium)
  • API: synchronous (generate_pdf) + asynchronous (agenerate_pdf)

Installation

pip install isis-report-lib
playwright install chromium   # required to generate PDFs

Dev:

pip install -e ".[dev]"

Quickstart

from isis_report_lib import generate_pdf, generate_pdf_from_toon, render_html

payload = {
    "meta": {"title": "Sales Order", "sub_title": "2024", "mode": "exact"},
    "layout": {
        "company": {"label": "Company", "format_mask": "str", "alignment": "left"},
        "orders": {
            "order": {"label": "Code", "format_mask": "int", "alignment": "right"},
            "total": {"label": "Total", "format_mask": "float", "alignment": "right"},
        },
    },
    "data": [{"company": "ACME", "orders": [{"order": 750, "total": 4000}]}],
}

pdf_bytes = generate_pdf(payload)
open("report.pdf", "wb").write(pdf_bytes)

# Without Playwright: just the intermediate HTML
html = render_html(payload)

# From .toon
toon = open("examples/sales_order.toon", encoding="utf-8").read()
open("report_toon.pdf", "wb").write(generate_pdf_from_toon(toon))

Async:

from isis_report_lib import agenerate_pdf, agenerate_pdf_from_toon

pdf = await agenerate_pdf(payload)
pdf = await agenerate_pdf_from_toon(toon_text)

CLI

# PDF from .toon or .json (format guessed from extension)
isis-report generate examples/sales_order.toon -o report.pdf
isis-report generate payload.json --page-format Letter

# Intermediate HTML without a browser (prints to stdout unless -o is given)
isis-report render examples/sales_order.toon -o report.html

PDF options (forwarded to Playwright's page.pdf):

generate_pdf(payload, pdf_options={"format": "A4", "margin": {"top": ".2in", "bottom": ".5in"}})

Full example in examples/. Note: the sync API opens/closes the browser per call (no leaked processes); the async API reuses the shared pool.

Payload

Field Type Required Description
meta object yes title, sub_title, mode ("exact"/"gray"), company
layout object no hierarchical field definition; omit to infer from data
data array yes raw records or template format ({"fields": ..., "groups": ...})

Masks: str · int (thousands 1.234) · float (pt-BR 1.234,50) · date.

.toon syntax

meta:
  title: Sales Order
  mode: exact
layout:
  product{Product,str,left}
  total{Total,float,right}
data[1]:
  - product: Pen
    total: 5.50

data[n] holds the records (dados[n] still accepted as a legacy alias). See examples/sales_order.toon.

API

Function Description
generate_pdf(payload, pdf_options?) -> bytes sync PDF from dict/ReportPayload
agenerate_pdf(...) same, async
generate_pdf_from_toon(text, ...) / agenerate_pdf_from_toon PDF from .toon
render_html(payload) / arender_html / render_html_from_toon intermediate HTML (no browser)
ToonParser().parse(text) / parse_toon(text) .toon -> dict
TabularReportService(pdf_options?) pipeline execute(payload) (Fetch→Process→HTML→PDF)

Tests

pytest -q
pytest -q --cov=isis_report_lib   # coverage gate: 85% (enforced in the CI e2e job)
ruff check src tests

Real-PDF tests require playwright install chromium and are skipped (-m "not browser") when no browser is available.

License

MIT — see LICENSE.

Metadata

Release files for isis-report-lib 0.2.0

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

Source distribution (sdist)

Source distribution for isis-report-lib 0.2.0
File Size Uploaded Provenance Actions
isis_report_lib-0.2.0.tar.gz 22.0 kB With provenance Details for isis_report_lib-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for isis-report-lib 0.2.0
File Interpreter ABI Platform Actions
isis_report_lib-0.2.0-py3-none-any.whl Python 3 none any Details for isis_report_lib-0.2.0-py3-none-any.whl

Total release size: 40.9 kB

Release files / isis_report_lib-0.2.0.tar.gz

Download URL isis_report_lib-0.2.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5290a5a006968b76cbfeac2da1816f6c90dddc51228fb3bba55cbeb1cd152703
BLAKE2b-256 checksum
How to use checksums
12e395572fb4e16a92658d45b7d877162cdc4a9bcdab9af1490846dc12bbbffc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / isis_report_lib-0.2.0-py3-none-any.whl

Download URL isis_report_lib-0.2.0-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd42125a6c7e6b458a91409dcef199af1c7c4bcf6cb544c673f36ca261602a67
BLAKE2b-256 checksum
How to use checksums
cfbe53fd6c0667eaefa8660470e5c32b692e500867a441dc6f66779c59177ff2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for isis-report-lib 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for isis_report_lib-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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