Skip to main content

QueryMD

Build a report from Markdown, SQL queries, and reusable chart definitions. The output is one standalone HTML file with interactive charts, fonts, styles, data downloads, and provenance embedded. It needs no network connection or supporting files.

Run the example

From this folder:

uv run querymd examples/measurements/report.md

For a fuller report (a headline that states the finding, a KPI strip, cards, a highlighted chart, a table with bars and an at-risk callout, all on invented batch data):

uv run querymd examples/batch-review/report.md

Open examples/measurements/report.html. The example uses invented measurements. It uses only the included CSV and query library.

To select other series:

uv run querymd examples/measurements/report.md --param series=alpha,beta

To rebuild whenever the report, its library files, sources, or evidence change:

uv run querymd examples/measurements/report.md --watch

A failed rebuild prints the error, keeps the previous report, and keeps watching. Add --strict to fail on charts, tables, or parameters the report defines but never uses.

To print a PDF alongside the HTML, for a document-management system or a batch record:

uv run querymd examples/measurements/report.md --pdf

The PDF goes next to the HTML unless you give a path (--pdf out/review.pdf). It uses the report's print layout, with a footer giving the title, snapshot hash and page numbers on every page. Paper is A4 unless you pass --paper letter. Printing needs Chrome, Chromium or Edge on Linux or macOS; querymd finds a common install, or set QUERYMD_BROWSER to the browser's path. No other dependency is needed. As with the HTML, querymd replaces only PDFs a browser printed, and --watch reprints after each rebuild.

To validate a report without writing anything, for example in CI:

uv run querymd check examples/measurements/report.md

check loads the sources, runs every query, and compiles every chart and table, including library charts the report does not reference. It exits non-zero on the first problem.

Report blocks and library files are checked against a JSON Schema, which catches misspelt settings. querymd schema prints it. For autocomplete in editors that use the YAML language server, start a library file with:

# yaml-language-server: $schema=https://raw.githubusercontent.com/phlohouse/querymd/main/src/querymd/report.schema.json

Use your own data

Create a Markdown report with a top fenced report YAML block. Declare CSV, Parquet, JSON, read-only DuckDB, or Iceberg sources in that report (Iceberg needs uv sync --extra iceberg). Include reusable query and chart definitions from any directory. Library files describe queries and charts against named sources; reports supply the data paths.

For an existing report outside this folder:

uv run --project /path/to/querymd querymd /path/to/your/report.md

The HTML file goes beside the Markdown. Use -o or --output /path/to/output.html to change it. Paths inside reports resolve relative to the report file, regardless of the working directory. The Resolved definition download includes imported definitions with overrides applied.

The report format reference describes sources, parameters, charts, composition, and overrides. Python callers use querymd.render.build(report, output, overrides).

Reference from another project

QueryMD is published on PyPI as phlo-querymd. The import name and the command are still querymd:

uv add phlo-querymd
uv run querymd path/to/report.md

To work against a local checkout instead, point uv at it:

[project]
dependencies = ["phlo-querymd"]

[tool.uv.sources]
phlo-querymd = { path = "../querymd", editable = true }

The package contains the renderer and its assets. It contains no project data or query libraries.

Validate locally

uv run ruff check src tests
uv run python -m unittest discover -s tests -v
uv build --out-dir /tmp/querymd-dist

Or use make install, make test, make lint and make build.

Dependencies are declared in pyproject.toml. After installation, uv run --offline prevents package downloads. The default appearance uses locally bundled Inter Variable and Departure Mono fonts with their licenses. Vega renders the charts with an Interfere-inspired categorical palette. The same series colours appear in light and dark modes; backgrounds, labels, and grid lines follow the system colour scheme, including live changes. PNG and SVG downloads are drawn in the browser and match the displayed theme. Each query's rows are stored once, however many charts use them. A light static SVG of each chart is the fallback without JavaScript and the version used for printing.

Releasing

Versions come from git tags. To release from a clean main:

make release-check VERSION=0.1.0   # build locally at that version without tagging
make release VERSION=0.1.0         # tag v0.1.0 and push it

Pushing the tag runs the publish workflow. It reruns CI, builds the sdist and wheel, uploads them to PyPI as phlo-querymd through trusted publishing (the pypi environment), and creates a GitHub release with the built files attached.

Metadata

Release files for phlo-querymd 0.1.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 phlo-querymd 0.1.0
File Size Uploaded Provenance Actions
phlo_querymd-0.1.0.tar.gz 901.7 kB With provenance Details for phlo_querymd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for phlo-querymd 0.1.0
File Interpreter ABI Platform Actions
phlo_querymd-0.1.0-py3-none-any.whl Python 3 none any Details for phlo_querymd-0.1.0-py3-none-any.whl

Total release size: 1.8 MB

Release files / phlo_querymd-0.1.0.tar.gz

Download URL phlo_querymd-0.1.0.tar.gz
Size 901.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5e183a89d980a2a6d82f0a438e7b902306a30078441d1d7a9dd231b51cbd064b
BLAKE2b-256 checksum
How to use checksums
9546c014830e1f62e3f005416e8bb427e908aa20b9d7cd3b7aaece9bdb461f46
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 18, 2026.

Transparency log

Release files / phlo_querymd-0.1.0-py3-none-any.whl

Download URL phlo_querymd-0.1.0-py3-none-any.whl
Size 878.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f270cdc02146dcec3a9efbe69526b5ee243d2d7c10f5a42bc893194d918d1370
BLAKE2b-256 checksum
How to use checksums
96d2fd05d569e50e64489c92d1047bc977f12f175a1b480d850a09b7628f1722
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 18, 2026.

Transparency log

Security for phlo-querymd 0.1.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 phlo_querymd-0.1.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 18, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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