Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Mock imports for build docs without install packages in environment.

This extension add :mockimport: and :mocktype: for standard automodule derictive from autodoc.

Main goal of extension is to solve task defined on question.

Install

pip install sphinxcontrib-mockautodoc

Usage

Add mockautodoc to extensions list:

extenstion = ['sphinxcontrib.mockautodoc', ]

The extension add two options to standard automodule:

  • :mockimport: list of name spaces to mock separated by ‘,’.

  • :mocktype: list of objects which must be mock as type object

    for right way subclass them in sources, separated by ‘,’.

If you have module for documenting:

from twisted.internet import protocol, defer

@defer.inlineCallbacks
def my_func():
    """my function"""
    pass

class MyProtocol(protocol.Protocol):
    """my protocol"""
    pass

And twisted not installed you can document module like that:

.. automodule:: package
    :mockimport: twisted
    :mocktype: protocol.Protocol

Where on :mockimport: will be mocked all twisted.* imports in automodule building context. And :mocktype: means which instances must be object types to successful subclass them without loss target documentation.

mockatudoc settings may be defined on conf.py and all automodule directives with present :mockimport: will be mocked. Where data on mockatodoc settings will be summed with :mockimport: and :mocktype: options:

mockautodoc = {
    'mockimport': ['twisted',],
    'mocktype': ['protocol.Protocol'],
}

Metadata

Release files for sphinxcontrib-mockautodoc 0.0.1dev-20130331

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

Source distribution (sdist)

Source distribution for sphinxcontrib-mockautodoc 0.0.1dev-20130331
File Size Uploaded
sphinxcontrib-mockautodoc-0.0.1dev-20130331.tar.gz 7.5 kB Details

Release files / sphinxcontrib-mockautodoc-0.0.1dev-20130331.tar.gz

Download URL sphinxcontrib-mockautodoc-0.0.1dev-20130331.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a138b4d8c4a45fae1be1ff25ec95f979e7f31b10c66d4ee9352acc81db25e40e
BLAKE2b-256 checksum
How to use checksums
3e190b6d757ecfef5544a763373a76ee5e839303cbb7000c361f5451b03f3620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
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