Skip to main content

AST-backed Python API documentation generator with Markdown and HTML output

Project description

ScribePy

AST-backed Python API documentation generator with Markdown and HTML output.

ScribePy parses Python modules, builds a structured model of classes and functions, and renders readable docs for READMEs, docs sites, CI artifacts, and internal references.

Table of Contents

Why ScribePy

  • Zero runtime introspection: built from source code using Python AST
  • Predictable output: ideal for CI pipelines and reproducible docs
  • Works as CLI and library: use it in local scripts or automated tooling
  • Two output formats: Markdown for docs repos and standalone HTML for sharing

Features

  • Parse Python modules from file paths or in-memory source strings
  • Extract module docstrings, imports, classes, methods, functions, decorators, and signatures
  • Render Markdown API docs
  • Render standalone HTML API docs
  • Override module name when needed (CLI or API)

Quick Start

Install:

pip install ScribePy

Generate Markdown to stdout:

scribepy path/to/module.py

Generate HTML and write to a file:

scribepy path/to/module.py --format html --output docs/module.html

Installation

From PyPI:

pip install ScribePy

From source:

git clone https://github.com/hipnologo/ScribePy.git
cd ScribePy
pip install -e .

CLI Usage

scribepy <path> [--format markdown|html] [--output FILE] [--module-name NAME]

Examples:

# Markdown to stdout
scribepy package/example.py

# HTML to file
scribepy package/example.py --format html --output docs/example.html

# Override detected module name
scribepy package/example.py --module-name my_public_api

Arguments:

  • path: path to the Python file to document
  • --format: output format (markdown or html), default is markdown
  • --output, -o: write output to file instead of stdout
  • --module-name: override module name used in generated docs

Python API

High-Level Wrapper

from scribepy import ScribePy

source_code = '''
"""Utilities for math helpers."""

def add(x: int, y: int) -> int:
    """Add two integers."""
    return x + y
'''

scribe = ScribePy(source_code=source_code, module_name="math_helpers")

markdown_docs = scribe.generate_markdown_docs()
html_docs = scribe.generate_html_docs()

Functional API

from scribepy import parse_file, render_markdown

module = parse_file("package/example.py")
docs = render_markdown(module)

Source String Helpers

from scribepy import generate_markdown_docs, generate_html_docs

source = "def ping() -> str:\n    return 'pong'\n"
md = generate_markdown_docs(source, module_name="health")
html = generate_html_docs(source, module_name="health")

Development

Set up a local dev environment:

python -m venv .venv
# Windows PowerShell
. .venv/Scripts/Activate.ps1
pip install -e .
pip install pytest build

Run tests:

pytest

Build distribution artifacts:

python -m build

Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create a feature branch
  3. Add or update tests for your changes
  4. Open a pull request with a clear description

For bug reports and feature requests, use GitHub Issues.

Roadmap

  • Recursive package documentation
  • Optional filtering for private members
  • Docstring style awareness for richer parameter descriptions
  • Static site output for multi-module projects

License

Apache License 2.0. See LICENSE for details.

Project details


Download files

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

Source Distribution

scribepy-0.2.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

scribepy-0.2.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scribepy-0.2.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for scribepy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5edb8f95656de2341360a3d1b514932a63f4e6bf3de95ef8a72733c5129d3189
MD5 8f4273554ddac3828444aec9efb63b57
BLAKE2b-256 0178e07534a53c619c7eac1fcd4edc5aaa9a3d9b1de3ad3adf62831363073b8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scribepy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for scribepy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63e835270f3b2474a671a57da964be087b36176558f8e32a763fc711a5b7be37
MD5 bb8393a1ad4762a0e34aaa13d206d215
BLAKE2b-256 3987e4babd17acaa3bf6ddcbf7669bfd299b708faab73aac5ea4ef87b77d42dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page