Skip to main content

YMPrint

Desktop publishing with YAML

The technology of the year 2000…today!

YMPrint is a Python-based PDF authoring application geared towards professionals who need to generate lots of PDF documents. You write the content of your report in YAML (as opposed to Markdown) and YMPrint renders it to PDF with near-instant speeds. YMPrint lets you use Python scripting within your document, create variables, render variable values, and pass live Python objects between report blocks to create a truly expressive authoring system—the likes of which have not been created before.

YMPrint is built upon the incredible ReportLab library.

Site inspection report:
  - >
    This is the first paragraph. The `>` character tells YAML you are entering a
    multi-line string that should be word-wrapped. Leave a blank line to start a
    new paragraph.
  - Findings:
    - Bullets:
      - The handrail is loose on the north stair.
      - Two ceiling tiles are water-stained in the lobby.
    - Items observed:
      - Item Number: 12.01
        Description: There is a problem here. This report documents it.
        Location: Under the stairs
ym convert report.yml
# ✍️ .... 📝 ... PDF created: report.pdf

Why YMPrint?

  • Readable source. Your document is the outline. YAML nesting is the document hierarchy — no markup soup, no LaTeX, no HTML.
  • Batteries included. Bundled fonts, sensible default styles, and a set of blocks for the content markdown can't express.
  • Dynamic content. Interpolate variables with Jinja, execute _py blocks, load JSON, embed matplotlib figures, and auto-fill PDF form fields.
  • Custom templates. Overlay your document onto a designed PDF background and auto-populate its form fields from document variables.

Installation

Requires Python 3.14+.

# With uv (recommended) — installs the `ym` command
uv tool install ymprint

# Or with pip
pip install ymprint

From source:

git clone https://github.com/StructuralPython/yamlreports.git
cd yamlreports
uv sync
uv run ym --help

Usage

YMPrint installs a single command, ym, with two subcommands.

ym convert — render once

ym convert report.yml               # writes report.pdf next to the source
ym convert report.yml --dest out/doc.pdf   # choose an output path

ym live — hot-reload preview

Renders the PDF, opens it in the Okular viewer, and rebuilds on every save. Great for drafting.

ym live report.yml

Core concepts

  • Keys are headings. A mapping key whose value is content becomes a heading; the value is laid out underneath it. Lists render in order, lists of mappings render as tables.

  • Configuration lives in underscore-prefixed front matter — _doc (page template), _style (text styles), and _tablestyle (table styles) — resolved across layered, inheriting priority levels: internal defaults → project config → --config-dir → document front matter.

  • Variables are defined in _vars, interpolated into text with Jinja ({{name}}), and passed as real Python objects into blocks with the $name syntax.

  • Blocks are underscore-prefixed keys that expand into custom content:

    Block Purpose
    _img Embed an image with a caption
    _matplotfig Embed a matplotlib figure
    _info / _warning / _danger / _tip / _note Admonition callouts
    _blockquote A quotation with attribution
    _code A non-executable, syntax-highlighted code block
    _py Execute Python and optionally show the source
    _hc Typeset Python as handcalcs calculations (pip install "ymprint[hc]")
    _p A standalone paragraph with a selectable text style
    _loadjson Load variables from a JSON file
    _table A table from computed data, with formats, sorting and row colours
    _pagebreak Force a page break
    _hrule A configurable horizontal rule
    _spacer Insert vertical whitespace
  • Projects: name project data once in the project config (_data) and use it by name in every document; render a document once per item (_render); declare what a document produces (_export); and build everything in dependency order with ym build. See the guides under Project data in the docs.

Examples

The Examples/ directory contains a runnable report for each major feature — a simple document, document configuration, variables, PDF backgrounds, Python execution, the full set of blocks, and a 1080p slide deck with custom backgrounds. Render any of them with ym convert.

Building your own application

YMPrint can be the engine for your own document tool. A Ymprint instance bundles your custom blocks, render hooks (before_render, on_context, after_render) and a house style, and serves its own convert and live commands:

from ymprint import Ymprint

app = Ymprint(name="calcsheet", config_path="config/")

@app.block("_beam")
def beam_block(block_key, block_value, context):
    ...  # return a list of ReportLab flowables

cli = app.cli()   # calcsheet convert report.yml

See Custom applications for the full guide.

Documentation

The full documentation site lives in docs/ (Sphinx + the Shibuya theme). Build it locally with:

uv run --with-requirements docs/requirements.txt \
    sphinx-build -b html docs docs/_build/html

Then open docs/_build/html/index.html. See docs/README.md for details.

License

See LICENSE.

Metadata

Release files for ymprint 0.8.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 ymprint 0.8.0
File Size Uploaded Provenance Actions
ymprint-0.8.0.tar.gz 9.9 MB With provenance Details for ymprint-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 19.9 MB

Release files / ymprint-0.8.0.tar.gz

Download URL ymprint-0.8.0.tar.gz
Size 9.9 MB
Tags Source
SHA-256 checksum
How to use checksums
60773a9d7f9125b72a806d146f032c88c9ab5d34e20b57734a7e6b57df6bbf2e
BLAKE2b-256 checksum
How to use checksums
5e42976a6ccfa61d65911d157915bc22d52b827d14cf4cb2e2bb4bb7766bec93
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 Oct 29, 2026.

Transparency log

Release files / ymprint-0.8.0-py3-none-any.whl

Download URL ymprint-0.8.0-py3-none-any.whl
Size 10.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d91e7f418d267c071ef9ecadd5fd4938634fb952f7d6d6a29b3b9e71aefb42a9
BLAKE2b-256 checksum
How to use checksums
d1985b8310a1ce3c49076555a69c91970960ff1a151d8ddbffa84db444bda90b
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 Oct 29, 2026.

Transparency log

Security for ymprint 0.8.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 ymprint-0.8.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 Oct 29, 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