Skip to main content

MkForge

Programmatic Markdown report generation for Python.

MkForge is a small Python toolkit for building structured, reproducible Markdown reports from code.

It provides composable report primitives such as sections, paragraphs, tables, figures, metadata, checksums, and renderers so automation scripts can produce readable Markdown artifacts without hand-written string assembly.

Use Cases

  • Quality gate reports
  • CI and release summaries
  • Code metrics reports
  • Dependency audit reports
  • Generated technical appendices
  • Reproducible Markdown artifacts for documentation pipelines

Scope

MkForge focuses on generating Markdown documents from structured Python data.

It is not:

  • a Markdown project compiler;
  • a static site generator;
  • a CI runner;
  • a replacement for documentation tools such as MkDocs.

Those tools can use MkForge as their reporting layer.

Installation

uv sync

Development

make check

make check runs formatting, Ruff, Flake8, docstring checks, Mypy, code metrics, security checks, tests, and 100% coverage validation.

For CI-style non-mutating checks:

make ci

For package validation before publishing:

make check-dist

Temporary quality reports are written under work/reports/. Packaging checks build distributions under work/dist/. The work/ directory is kept in the repository with work/.gitkeep.

Example

from mkforge import Chapter, Paragraph, Report, Section, Table

report = Report(
    title="Quality Report",
    metadata={"title": "Quality Report", "tags": ["quality", "ci"]},
    toc=True,
).add(
    Chapter("Summary").add(
        Section("Checks").add(
            Paragraph("All checks passed."),
            Table.from_columns(
                {
                    "Check": ("format", "lint", "tests"),
                    "Status": ("pass", "pass", "pass"),
                },
            ),
        ),
    ),
)

markdown = report.render()

Markdown Verification

from mkforge import verify_markdown

report = verify_markdown("# Title\n\n| A | B |\n| --- | --- |\n")

Verification covers pure Markdown and GitHub Flavored Markdown conformance in a single pass. Custom rule callables can be appended for one verification call without mutating the built-in policy.

Markdown Validation

from mkforge import (
    validate_markdown_chapters,
    validate_markdown_headings,
    validate_markdown_images,
    validate_markdown_yaml,
)

ok = (
    validate_markdown_yaml(markdown, {"draft": False})
    and validate_markdown_chapters(markdown, ("Summary", "Details"))
    and validate_markdown_headings(markdown, ((2, "Summary"), (3, "Checks")))
    and validate_markdown_images(markdown, base_path="docs/report.md")
)

Validation answers project-specific boolean questions: expected YAML frontmatter, required H2 chapters in order, heading level/title sequences, and local or HTTP(S) image existence. Use strict=True for exact YAML keys or exact heading and chapter sequences.

Runnable demos:

uv run python demo_report.py
uv run python demo_verif.py
uv run python demo_validation.py

Heading Slugification

from mkforge import slugify_heading

slugify_heading("Analyse des Risques")  # "analyse-des-risques"
slugify_heading("`code` inline")        # "code-inline"

slugify_heading converts a raw heading title into a GitHub-style anchor slug: lowercase, inline Markdown markers removed, non-alphanumeric runs collapsed to a single hyphen, leading/trailing hyphens trimmed. Unicode letters are preserved (case-folded, not transliterated), which keeps slugs consistent with the anchors GitHub generates for the same heading.

Relationship With Scribpy

MkForge is intended to be independent from Scribpy.

  • mkforge generates Markdown reports from Python data.
  • scribpy assembles and builds Markdown documentation projects.
  • yggtools initializes and runs quality gates for Python packages using uv.

Scribpy and yggtools may depend on MkForge for generated reports, but MkForge should not depend on either of them.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkforge-0.2.0.tar.gz (195.9 kB view details)

Uploaded Source

Built Distribution

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

mkforge-0.2.0-py3-none-any.whl (76.3 kB view details)

Uploaded Python 3

File details

Details for the file mkforge-0.2.0.tar.gz.

File metadata

  • Download URL: mkforge-0.2.0.tar.gz
  • Upload date:
  • Size: 195.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkforge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 40b8ad4d3159762872aca81d13458cd79b757f65b1afb2b001fa32d601690ba7
MD5 f734cf3b818ec314df0a3221e029e8ca
BLAKE2b-256 304ed550269f86aa69228765d9f48760db75aeaeec6fabbbe722346b51f34910

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkforge-0.2.0.tar.gz:

Publisher: publish.yml on antoinebarre/mkforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkforge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mkforge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 76.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkforge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 617c4a529bbd70abad8adaed0e53ba47e599bfb27ca05676192e8aac61af18f5
MD5 545532f2bc438a614f6216fd72d6a675
BLAKE2b-256 0ac87d538c211bf5935747f3023a3a8b901ace7ff61e5905c3510e923ab7be1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkforge-0.2.0-py3-none-any.whl:

Publisher: publish.yml on antoinebarre/mkforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

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