Manipulate, edit, and generate documents from Markdown files.
Project description
Scribpy
A Python toolkit and document compiler for engineering-grade Docs-as-Code workflows.
Overview
Scribpy is a Python package (≥ 3.12) designed to be the foundation of a Docs-as-Code approach for Markdown-based documentation.
It provides a structured framework to:
- write documentation as version-controlled Markdown files;
- lint and validate Markdown and documentation structure;
- manipulate Markdown programmatically;
- assemble multiple files into complete documents;
- generate tables of contents and section numbering;
- export documentation to Markdown, HTML, and PDF;
- apply CSS styling to HTML and PDF outputs;
- support reproducible documentation builds in local or CI/CD environments.
Docs-as-Code
Scribpy follows the Docs-as-Code principles:
- documentation is stored as plain text and versioned in Git;
- documentation quality is checked automatically before generation;
- builds are reproducible from sources and configuration;
- generated outputs are artifacts, not manually edited deliverables.
Markdown Sources
↓
Configuration (scribpy.toml)
↓
Linting & Validation
↓
Transformation (TOC, includes, numbering, links)
↓
Assembly
↓
Build Artifacts
├── Markdown
├── HTML
└── PDF
Installation
pip install scribpy
Requires Python ≥ 3.12.
Quick Start
from scribpy.core import load_markdown, get_headings, build_project
doc = load_markdown("docs/architecture.md")
for heading in get_headings(doc):
print(heading.level, heading.title)
result = build_project(".")
CLI
scribpy init # Initialize a project
scribpy lint # Validate documentation quality
scribpy build # Build all enabled outputs
scribpy build markdown # Build assembled Markdown
scribpy build html # Build HTML
scribpy build pdf # Build PDF
scribpy format docs/ # Format Markdown files
scribpy rewrite-links docs/ # Rewrite internal links
scribpy toc # Generate table of contents
scribpy index show # Display document index
scribpy index check # Validate document index
scribpy clean # Remove build artifacts
Configuration
Scribpy uses a scribpy.toml configuration file:
[project]
name = "System Engineering Handbook"
version = "1.0.0"
authors = ["Engineering Team"]
language = "en"
[paths]
source = "docs"
assets = "assets"
styles = "styles"
output = "build"
[document]
entrypoint = "index.md"
title = "System Engineering Handbook"
number_sections = true
include_toc = true
[lint]
enabled = true
fail_on_warning = false
[builders.html]
enabled = true
css = ["styles/html.css"]
[builders.pdf]
enabled = true
engine = "weasyprint"
css = ["styles/pdf.css"]
Package Architecture
src/scribpy/
├── cli/ — Command-line interface
├── core/ — Public Python API facade
├── config/ — scribpy.toml loading and validation
├── project/ — Project scanning and document index
├── model/ — Core data types (frozen dataclasses)
├── parser/ — Markdown parsing layer
├── lint/ — Documentation quality engine
├── transforms/ — Transformation pipeline (TOC, includes, numbering)
├── builders/ — Output generation (Markdown, HTML, PDF)
├── themes/ — Templates and CSS themes
├── assets/ — Images, diagrams, static files
├── extensions/ — Plugin registry
└── utils/ — Low-level path, string, I/O helpers
Project Layout
A typical Scribpy documentation project:
my-documentation/
├── scribpy.toml
├── docs/
│ ├── index.md
│ ├── introduction.md
│ └── architecture.md
├── assets/
│ └── images/
├── styles/
│ ├── html.css
│ └── pdf.css
└── build/
├── markdown/
├── html/
└── pdf/
Development
uv sync --dev # install package + dev dependencies
make check # format · lint · typecheck · test
Individual commands:
| Command | Description |
|---|---|
make format |
Auto-format with ruff |
make lint |
Lint with ruff |
make typecheck |
Type-check with mypy (strict mode) |
make test |
Run tests with coverage report |
Release to PyPI
Releases are tag-driven. The package version is derived from the Git tag by
hatch-vcs, so do not edit the version manually in pyproject.toml.
Run the local checks first:
make check
make check-dist
make check-dist builds both distribution artifacts into dist/ and validates
their metadata with Twine.
Local builds made away from an exact release tag will have a development
version; the published version is produced by the GitHub tag.
Create and push a version tag from main:
git switch main
git pull --ff-only
git tag v0.0.1b1
git push origin v0.0.1b1
Tags pushed from commits that are not on origin/main are rejected by the
publish workflow.
The GitHub Actions Publish workflow then:
- runs the checks;
- builds the source distribution and wheel;
- publishes to PyPI after the
pypienvironment approval, if configured.
Before the first release, configure Trusted Publishing on PyPI:
| Repository owner | Repository name | Workflow filename | Environment |
|---|---|---|---|
antoinebarre |
scribpy |
publish.yml |
pypi |
Install a beta build from PyPI:
python -m pip install --pre scribpy
PyPI package files are immutable: if a version has already been uploaded, bump
the tag before publishing again, for example v0.0.1b2.
Design
Scribpy favors a functional programming style:
- pure functions over mutable objects;
- frozen dataclasses for data containers;
- dependency injection over inheritance;
- protocols for injectable services;
- explicit pipeline stages with typed inputs and outputs.
See doc/SDD.md for the full Software Design Document.
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Commit following Conventional Commits
- Open a pull request
Code must comply with SOLID principles, Google Python Style Guide, full type hints, and cyclomatic complexity < 5 per function.
License
MIT © Antoine
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scribpy-0.0.6b0.tar.gz.
File metadata
- Download URL: scribpy-0.0.6b0.tar.gz
- Upload date:
- Size: 178.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc07205c17d68530b2a6ad89b43a58d534a04ff269b51adadb44337ca4564147
|
|
| MD5 |
84109271ff8cad7b6147b773d4377dda
|
|
| BLAKE2b-256 |
ac8dd043175facd1e91f12123eb19d50198cdec55d9968f1eccd5abd5ec452a2
|
Provenance
The following attestation bundles were made for scribpy-0.0.6b0.tar.gz:
Publisher:
publish.yml on antoinebarre/scribpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scribpy-0.0.6b0.tar.gz -
Subject digest:
cc07205c17d68530b2a6ad89b43a58d534a04ff269b51adadb44337ca4564147 - Sigstore transparency entry: 1560979532
- Sigstore integration time:
-
Permalink:
antoinebarre/scribpy@32b079ffe8330813292e78c871fdf820a273bbcd -
Branch / Tag:
refs/tags/v0.0.6b - Owner: https://github.com/antoinebarre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@32b079ffe8330813292e78c871fdf820a273bbcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file scribpy-0.0.6b0-py3-none-any.whl.
File metadata
- Download URL: scribpy-0.0.6b0-py3-none-any.whl
- Upload date:
- Size: 88.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5efa5b8dc693c2f3d93bd3cd1deb84f2b32144d7e9fa0b0b5f49fe494dc88dc
|
|
| MD5 |
2c1e3968158ee843304715e0de4ef848
|
|
| BLAKE2b-256 |
f3fb581c9d25d660bf824691354789ccd5a821b535d72847b390e7cc32a0271e
|
Provenance
The following attestation bundles were made for scribpy-0.0.6b0-py3-none-any.whl:
Publisher:
publish.yml on antoinebarre/scribpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scribpy-0.0.6b0-py3-none-any.whl -
Subject digest:
e5efa5b8dc693c2f3d93bd3cd1deb84f2b32144d7e9fa0b0b5f49fe494dc88dc - Sigstore transparency entry: 1560979617
- Sigstore integration time:
-
Permalink:
antoinebarre/scribpy@32b079ffe8330813292e78c871fdf820a273bbcd -
Branch / Tag:
refs/tags/v0.0.6b - Owner: https://github.com/antoinebarre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@32b079ffe8330813292e78c871fdf820a273bbcd -
Trigger Event:
push
-
Statement type: