Skip to main content

Sphinx Mintlify Extension

A Sphinx extension that generates Mintlify-compatible MDX documentation from Python docstrings, creating organized documentation with a folder per class and a file per method.

Features

  • Generates Mintlify-compatible MDX documentation
  • Creates a folder per class with individual method documentation
  • Supports class inheritance documentation
  • Preserves type hints and parameter descriptions
  • Supports async methods and properties
  • Generates proper frontmatter
  • Customizable templates and metadata
  • Method grouping and ordering options

Installation

pip install sphinx-mintlify

Usage

  1. Add the extension to your Sphinx project's conf.py:
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon',
    'sphinx_mintlify',
]

# Configure the extension
classmd_output_dir = 'docs/api'  # Output directory for generated MDX files

# List classes to document
classmd_classes = [
    'myproject.models.User',
    {
        'path': 'myproject.utils.Helper',
        'name': 'HelperClass'
    }
]

# Optional: Configure method documentation
classmd_method_options = {
    'include_source': True,
    'include_examples': True,
    'group_by_type': True
}

# Optional: Configure method ordering
classmd_method_order = [
    '__init__',
    'public_methods',
    'private_methods',
    'static_methods',
    'class_methods'
]

# Optional: Custom templates
classmd_templates = {
    'class_index': '_templates/class_index.mdx',
    'method': '_templates/method.mdx'
}

# Optional: Additional metadata
classmd_metadata = {
    'api_version': '1.0.0',
    'api_status': 'stable',
    'sidebar_label': 'API Reference',
    'sidebar_position': 2
}
  1. Run Sphinx to generate the documentation:
sphinx-build -b dirhtml source/ _build/dirhtml

The extension will automatically create a folder structure in your classmd_output_dir like this:

docs/api/
├── User/
│   ├── index.mdx
│   ├── __init__.mdx
│   ├── authenticate.mdx
│   └── update_profile.mdx
└── HelperClass/
    ├── index.mdx
    ├── utility_method1.mdx
    └── utility_method2.mdx
  1. Copy the generated MDX files to your Mintlify documentation folder:
cp -r docs/api/* docs/

Example Output

For a class like this:

class User:
    def authenticate(self, password: str) -> bool:
        """Authenticate the user with the given password.
        
        Args:
            password: The password to verify
            
        Returns:
            bool: True if authentication successful, False otherwise
            
        Raises:
            ValueError: If password is empty
        """
        pass

The extension will generate an MDX file (authenticate.mdx) like this:

---
title: "User.authenticate"
description: "Authenticate the user with the given password"
---

# authenticate

Authenticate the user with the given password.

## Signature

```python
def authenticate(self, password: str) -> bool

Parameters

The password to verify

Returns

True if authentication successful, False otherwise

Raises

  • ValueError: If password is empty

Example

user = User()
is_authenticated = user.authenticate("my_password")

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License. 

Metadata

Release files for sphinx-mintlify 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-mintlify 0.1.1
File Size Uploaded Provenance
sphinx_mintlify-0.1.1.tar.gz 20.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-mintlify 0.1.1
File Interpreter ABI Platform
sphinx_mintlify-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 41.4 kB

Release files / sphinx_mintlify-0.1.1.tar.gz

Download URL sphinx_mintlify-0.1.1.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e04fd6bba69c198c2965992664f2808830070839afdfa539d885fbe73d1c20e0
BLAKE2b-256 checksum
How to use checksums
e8a16eb6cfbd41e520f746c762bdc0373bf6b4853b4db4a2dd635c54daf32ae5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / sphinx_mintlify-0.1.1-py3-none-any.whl

Download URL sphinx_mintlify-0.1.1-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
618bc2ee32deb350169d6310d9b4dca6533de3dec438943368de4f9762a958cb
BLAKE2b-256 checksum
How to use checksums
9bb430f62774e9f9bd2c63b97c5834173f612970a8a56389f605f3d6c15b85fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for sphinx-mintlify 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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