Skip to main content

python-docstring-markdown

A Python module and CLI that walks a Python package/directory and outputs a Markdown file from all docstrings in the package.

Tools like mkdocs and readthedocs are overkill for many small Python projects. This project exists to provide a simple way to generate Markdown documentation that can be stored alongside your code in Github.

Features

  • Crawls the packages, modules, classes, functions, and methods using the ast module
  • Auto-detects ReST, Google, Numpydoc-style and Epydoc docstrings using docstring-parser-fork
  • Generates a table of contents with anchor links
  • Tracks and documents module exports (__all__)
  • Preserves module hierarchy in documentation
  • Handles nested classes and functions

Installation

pip install python-docstring-markdown

Usage

Command Line

python -m python_docstring_markdown <package_dir> <output_path>

Arguments:

  • package_dir: Path to your Python package directory.
  • output_path: Path where the Markdown documentation file will be saved. A path that ends in .md will result in a single file. A directory path will result in one .md per-module.

Example:

python -m python_docstring_markdown ./src/my_package docs/api.md

Python API

from python_docstring_markdown import crawl

# Generate documentation for a package
docs_content = crawl("./src/my_package")

# Save to a file
with open("docs/api.md", "w") as f:
    f.write(docs_content)

Documentation

See the DOCUMENTATION.md file for more information. It also serves as an example of how the documentation is generated.

Contributing

I welcome feedback and contributions!

License

CC-0 1.0 Universal. See the LICENSE file for more information.

Metadata

Release files for python-docstring-markdown 0.4.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 python-docstring-markdown 0.4.0
File Size Uploaded
python_docstring_markdown-0.4.0.tar.gz 17.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-docstring-markdown 0.4.0
File Interpreter ABI Platform
python_docstring_markdown-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.1 kB

Release files / python_docstring_markdown-0.4.0.tar.gz

Download URL python_docstring_markdown-0.4.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
99796187d1dd80cde4e370f30dcba5697f5dac0fcd7d06e56a91481b4b695cbc
BLAKE2b-256 checksum
How to use checksums
45113db44578271a53a4ed784917a6507e262574a28c896fbdf9729ee3524907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.11.0-1018-azure

Release files / python_docstring_markdown-0.4.0-py3-none-any.whl

Download URL python_docstring_markdown-0.4.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69ae4610f6feee2f28649210340dc715bfb0412639fb8db309bbfdd599edcc5b
BLAKE2b-256 checksum
How to use checksums
2307b46a725cd0bac304381cf39277c0bb26c454956cf15e5db2aae57e398a33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release 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