Skip to main content

Generate MDX API documentation from Python modules

Project description

mdxify

Generate API documentation from Python modules with automatic navigation and source links. MDX is the default output and Markdown is also supported via --format md.

Projects Using mdxify

mdxify powers the API docs for:

Usage

Run without installing using uvx:

uvx mdxify --all --root-module mypackage --output-dir docs/python-sdk

Quick Start

Basic commands

Generate docs for all modules in a package:

uvx mdxify --all --root-module mypackage --output-dir docs/python-sdk

Generate docs for specific modules:

uvx mdxify mypackage.core mypackage.utils --output-dir docs/python-sdk

Exclude internal modules:

uvx mdxify --all --root-module mypackage \
  --exclude mypackage.internal --exclude mypackage.tests
GitHub Actions example

Create .github/workflows/docs.yml:

name: Generate API Docs

on:
  push:
    branches: [main]
    paths:
      - 'src/**/*.py'
      - 'pyproject.toml'

jobs:
  generate-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install uv
        uses: astral-sh/setup-uv@v5
      - name: Generate API documentation
        run: uvx mdxify --all --root-module mypackage --output-dir docs/python-sdk
      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: 'docs: update API reference [skip ci]'
          file_pattern: 'docs/python-sdk/**/*.mdx'

CLI Options

  • modules: Modules to document
  • --all: Generate docs for all modules under the root module
  • --root-module: Root module (required with --all)
  • --output-dir: Output directory (default: docs/python-sdk)
  • --update-nav/--no-update-nav: Update Mintlify docs.json (default: True)
  • --skip-empty-parents: Skip boilerplate parents in nav (default: False)
  • --anchor-name / --navigation-key: Anchor/group name to update (default: SDK Reference)
  • --exclude: Module(s) to exclude (repeatable, excludes submodules too)
  • --repo-url: GitHub repo for source links (auto-detected if omitted)
  • --branch: Git branch for source links (default: main)

Navigation Updates (Mintlify)

mdxify can update docs/docs.json by finding either anchors or groups. Add a placeholder for the first run:

Anchor format:

{
  "navigation": [
    { "anchor": "SDK Reference", "pages": [{ "$mdxify": "generated" }] }
  ]
}

Group format:

{
  "navigation": [
    { "group": "SDK Reference", "pages": [{ "$mdxify": "generated" }] }
  ]
}

Subsequent runs will update the existing anchor/group automatically. Configure the target with --anchor-name (alias --navigation-key).

Source Code Links

Add GitHub source links to functions/classes/methods:

# Auto-detect repository from git remote
uvx mdxify --all --root-module mypackage

# Or specify repository explicitly
uvx mdxify --all --root-module mypackage \
  --repo-url https://github.com/owner/repo --branch develop

Customize link text via MDXIFY_SOURCE_LINK_TEXT if desired.

To generate Markdown instead of MDX, pass --format md (navigation updates are disabled in Markdown mode):

uvx mdxify --all --root-module mypackage --format md --no-update-nav

Features

  • Fast AST-based parsing (no imports)
  • MDX output with safe escaping
  • Automatic hierarchical navigation (Mintlify)
  • Google-style docstrings via Griffe
  • Smart filtering of private modules

Development

See CONTRIBUTING.md for local setup, testing, linting, and release guidance.

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

mdxify-0.2.33.tar.gz (59.5 kB view details)

Uploaded Source

Built Distribution

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

mdxify-0.2.33-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file mdxify-0.2.33.tar.gz.

File metadata

  • Download URL: mdxify-0.2.33.tar.gz
  • Upload date:
  • Size: 59.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mdxify-0.2.33.tar.gz
Algorithm Hash digest
SHA256 a700644682484af00ffd5423337591ff580b755ead2b81fc52d55ca7d8f8d3ea
MD5 c08ccd314aff96e1c2e6d18b689db356
BLAKE2b-256 8e7baf4793596a4bbe3ce5277fa9c01dc916dbbd7cb7121b4eb04e45b56cf0bc

See more details on using hashes here.

File details

Details for the file mdxify-0.2.33-py3-none-any.whl.

File metadata

  • Download URL: mdxify-0.2.33-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mdxify-0.2.33-py3-none-any.whl
Algorithm Hash digest
SHA256 e11c9a68a519e0462f2af32e85aab4fb519582eb53f8e3aa2e8eb16a2f9701ff
MD5 abef246632350a9652904faeb2458ecc
BLAKE2b-256 8a491176d01a4981def939df0a5338a894b581110ccab33338ee7f1682ecf839

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