autodoc

Overriding Sphinx autodoc “Alias of” for import of private class?

泪湿孤枕 提交于 2020-01-14 07:24:14
问题 I have a Python package that I am attempting to document with sphinx-autodoc. My python package has an __init__.py file that imports a class out from a submodule to make it accessible at the package level. from a.b.c.d import _Foo as Foo __all__ = ["Foo"] If I do this, my (html) documentation is as follows: a.b.c package Submodules a.b.c.d module [snip documentation of irrelevant public classes within the a.b.c.d module] Module contents The c module. a.b.c. Foo alias of _Foo Not super useful

Sphinx: how to exclude imports in automodule?

余生颓废 提交于 2019-12-28 06:00:13
问题 I have a Raspberry Pi project written in Python that uses RPi.GPIO module. All the work on the code is done on a Windows box where RPi.GPIO will not install and every time I try to run autodoc it crashes saying it cannot import RPi.GPIO. D:\cube\docs\ledcube.rst:4: WARNING: autodoc: failed to import module u'ledcube' ; the following exception was raised: Traceback (most recent call last): File "C:\Python27\lib\site-packages\sphinx-1.2b1-py2.7.egg\sphinx\ext\autodoc. py", line 326, in import

Execute code in autodoc docstring

会有一股神秘感。 提交于 2019-12-25 04:05:22
问题 When using Sphinx and autodoc to document a Python project, you can use :Example: to include a code sample in your module/class/function docstring, which Sphinx will kindly syntax highlight for you. Something like so. >>> rng = Range(0, 1000) >>> rng [0, 1000) >>> len(rng) 1000 >>> rng.start = 500 >>> rng.start 500 >>> rng.end 1000 >>> I copied and pasted this from the Python interpreter. Is there any way to have Sphinx or autodoc execute the code and capture the output automatically for the

Check if Java Class is commented in SVN Precommit hook

可紊 提交于 2019-12-23 19:33:30
问题 I want to ensure that a Java class is commented, before someone commits something into the SVN repository. So I want to realize the following workflow: User changes something in a class User wants to commit class Before executing the commit to the repository, SVN or something else checks if there are comments before the class and before public methods (for Java AutoDoc). If there are comments => Commit, Otherwise return Error message How can I realize this? I found a lot about pre-commit

What's the proper way to document callbacks with jsdoc?

橙三吉。 提交于 2019-12-20 08:35:46
问题 I've spent quite a while scouring the internet looking for the best way to properly document callbacks with jsdoc, but unfortunately, I haven't found a great one yet. Here's my question: I'm writing a Node.js library for developers. This library provides multiple classes, functions, and methods that developers will be working with. In order to make my code clear and understandable, as well as to (hopefully) auto-generate some API documentation in the future, I've started using jsdoc in my

What's the proper way to document callbacks with jsdoc?

对着背影说爱祢 提交于 2019-12-20 08:32:15
问题 I've spent quite a while scouring the internet looking for the best way to properly document callbacks with jsdoc, but unfortunately, I haven't found a great one yet. Here's my question: I'm writing a Node.js library for developers. This library provides multiple classes, functions, and methods that developers will be working with. In order to make my code clear and understandable, as well as to (hopefully) auto-generate some API documentation in the future, I've started using jsdoc in my

Is it possible to override Sphinx autodoc for specific functions?

佐手、 提交于 2019-12-17 19:15:47
问题 I'm using Sphinx's autodoc plugin to automatically document a set of modules. I have a function that accepts *args , and I'd like to override the documentation to show the slightly nicer funcname(arg1[, arg2[, ...]]) style that the Python stdlib docs use. Is it possible to override the autodoc output for a specific function? 回答1: It is possible to override a signature by using autofunction : .. automodule:: yourmodule :members: :exclude-members: funcname .. autofunction:: funcname(arg1[, arg2

Sphinx autodoc incorrectly assigning value 'None' to class attributes, when Traits are used

强颜欢笑 提交于 2019-12-13 01:06:18
问题 I'm seeing Python class attributes incorrectly assigned the value, None , in Sphinx autodoc generated documentation, when Traits are used. I have a simple test case with instructions for observing the error, here: https://github.com/capn-freako/SphinxTest It shows that: When object is used as the superclass, and int is the class attribute's type, the generated documentation is as expected. When HasTraits is used as the superclass and Int is the class attribute's type, the generated

Getting sphinx to display function parameters when wrapped with decorator

时光毁灭记忆、已成空白 提交于 2019-12-11 11:40:01
问题 I am using sphinx to document a project and am having problems with functions wrapped in decorators. I have seen similar questions asked but no solution seems to fit my problem I have hundreds of functions all wrapped in a custom decorator that itself can accept parameters from functools import wraps def CustomFunctionDecorator(id, name): """Custom decorator""" def outer(f): @wraps(f) def inner(*args, **kwargs): ...do stuff.... f(*args, **kwargs) return inner return outer My function will

Sphinx autodoc with Django 1.4

佐手、 提交于 2019-12-11 10:38:56
问题 I'm having issues building the module autodocs for a Django 1.4.1 project. make html seems to be failing to read my docstrings because it's running into trouble importing my settings. All of the online guides I've seen suggest using import settings from django.core.management import setup_environ setup_environ(settings) but this is deprecated in 1.4, and the settings.configure() method doesn't seem appropriate. I haven't found nearly as much information for how to make things work in 1.4. I