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:
- FastMCP — live at https://gofastmcp.com/python-sdk
- Prefect — API ref at https://docs.prefect.io/v3/api-ref/python
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 Mintlifydocs.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
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 mdxify-0.2.32.tar.gz.
File metadata
- Download URL: mdxify-0.2.32.tar.gz
- Upload date:
- Size: 55.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a38155dc165fddeec87375f45de52882141f2c93f26cd8c8995616423a64c4fa
|
|
| MD5 |
817a8260acd039fe2d72d5680d6c287d
|
|
| BLAKE2b-256 |
b5594dc1773a57cd461eb9809b04b218bfcf5b42fba67b9d4859dabcf5ae28bd
|
File details
Details for the file mdxify-0.2.32-py3-none-any.whl.
File metadata
- Download URL: mdxify-0.2.32-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1288d100d666e864dc4debf1942ddf1e2303312c5ca0866e51de81f62439ebcb
|
|
| MD5 |
744616d4dfac00ec4241f276d39af876
|
|
| BLAKE2b-256 |
278139d284f73b49553ab301210dcfb8f42b90c03309a9509ca371980e5a927d
|