sphinx-automodapi-0.12/ 0000755 0000770 0000024 00000000000 13525230465 015030 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/.coveragerc 0000644 0000770 0000024 00000000302 13523222665 017145 0 ustar tom staff 0000000 0000000 [run]
source = sphinx_automodapi
omit = */tests/*
[paths]
source =
sphinx_automodapi/
*/site-packages/sphinx_automodapi
*\site-packages\sphinx_automodapi
[report]
omit = */tests/*
sphinx-automodapi-0.12/.gitignore 0000644 0000770 0000024 00000001014 13233635533 017015 0 ustar tom staff 0000000 0000000 # Compiled files
*.py[cod]
*.a
*.o
*.so
*.pyd
__pycache__
# Ignore .c files by default to avoid including generated code. If you want to
# add a non-generated .c extension, use `git add -f filename.c`.
*.c
# Other generated files
MANIFEST
# Sphinx
_build
_generated
# Packages/installer info
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz
# Other
.cache
.tox
.*.swp
*~
.project
.pydevproject
.settings
.coverage
cover
htmlcov
# Mac OSX
.DS_Store
# PyCharm
.idea
sphinx-automodapi-0.12/CHANGES.rst 0000644 0000770 0000024 00000004741 13525230154 016633 0 ustar tom staff 0000000 0000000 Changes in sphinx-automodapi
============================
0.12 (2019-08-15)
-----------------
- Fixed compatibility with Sphinx 2.0 and later. [#86]
- Updated required version of Sphinx to 1.7 and later. [#88]
0.11 (2019-05-29)
-----------------
- Added a global configuration option ``automodapi_inheritance_diagram`` to
control whether inheritance diagrams are shown by default. [#75]
- Fix bug with smart_resolver when intersphinx inventory doesn't include
any py:class entries. [#76]
- Fixed compatibility with Sphinx 2.0 and later. [#79]
0.10 (2019-01-09)
-----------------
- Fixed compatibility with latest developer version of Sphinx. [#61]
0.9 (2018-11-07)
----------------
- Fix issue with ABC-derived classes (``abc`` and ``collections.abc`` modules)
having their members ignored in Python 3. This was only an issue when
``:inherited-members:`` was not in effect. [#53]
0.8 (2018-10-18)
----------------
- Fixed compatibility with Sphinx 1.8.x. [#51]
- Make all extensions parallel-friendly. [#44]
0.7 (2018-01-18)
----------------
- Fix compatibility with Sphinx 1.7.x. [#43]
0.6 (2017-07-05)
----------------
- Fix encoding issues on platforms that default to e.g. ASCII encoding. [#33]
0.5 (2017-05-29)
----------------
- Fix a bug that caused the :inherited-members: option to apply to all subsequent
automodapi directives. [#25]
0.4 (2017-05-24)
----------------
- Fix compatibility with Sphinx 1.6 and 1.7. [#22, #23]
- Introduce a new ``:include-all-objects:`` option to ``automodapi`` that will
include not just functions and classes in a module, but also all other
objects. To help this, introduce a new ``:variables-only:`` option for
``automodsumm``. [#24]
0.3 (2017-02-20)
----------------
- Fixed installation on Python 3.4. [#21]
0.2 (2016-12-28)
----------------
- Suppress warning about re-defining autoattribute in recent versions of
Sphinx. [#8]
- Avoid hard-coding sphinx_automodapi module name in case this extension is
bundled into another package. [#12]
- Fix use of automodapi when source files are inside a source directory. [#16]
- Make sure generated rst is tidy and doesn't include extraneous whitespace. [#18]
0.1 (2016-12-12)
----------------
- Fixed a bug that caused the automodapi directive to not work properly when
the main module docstring was not included. [#3]
- Fixed a bug that caused skipped classes in automodapi directives to still
be included in inheritance diagrams. [#3]
- Original code taken out of astropy-helpers
sphinx-automodapi-0.12/LICENSE.rst 0000644 0000770 0000024 00000002730 13233635533 016647 0 ustar tom staff 0000000 0000000 Copyright (c) 2014-2016, Astropy Developers
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the Astropy Team nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sphinx-automodapi-0.12/MANIFEST.in 0000644 0000770 0000024 00000000132 13233635533 016563 0 ustar tom staff 0000000 0000000 include README.rst
include CHANGES.rst
include LICENSE.rst
exclude *.pyc *.o
prune build
sphinx-automodapi-0.12/PKG-INFO 0000644 0000770 0000024 00000003717 13525230465 016135 0 ustar tom staff 0000000 0000000 Metadata-Version: 2.1
Name: sphinx-automodapi
Version: 0.12
Summary: Sphinx extension for auto-generating API documentation for entire modules
Home-page: http://astropy.org
Author: The Astropy Developers
Author-email: astropy.team@gmail.com
License: BSD 3-Clause License
Description: |Azure Status| |Coverage Status| |PyPI|
About
=====
This is a Sphinx extension to automatically generate API pages for whole
modules. It was originally developed for the Astropy project but is now
available as a standalone package since it can be used for any other
package. The documentation can be found on
`ReadTheDocs `_.
Running tests
-------------
To run the tests, you can either do::
pytest sphinx_automodapi
or if you have `tox `_ installed::
tox -e test
.. |Azure Status| image:: https://dev.azure.com/astropy-project/sphinx-automodapi/_apis/build/status/astropy.sphinx-automodapi?branchName=master
:target: https://dev.azure.com/astropy-project/sphinx-automodapi/_build/latest?definitionId=2&branchName=master
.. |Coverage Status| image:: https://codecov.io/gh/astropy/sphinx-automodapi/branch/master/graph/badge.svg
:target: https://codecov.io/gh/astropy/sphinx-automodapi
.. |PyPI| image:: https://img.shields.io/pypi/v/sphinx-automodapi.svg
:target: https://pypi.python.org/pypi/sphinx-automodapi
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: BSD License
Provides-Extra: test
sphinx-automodapi-0.12/README.rst 0000644 0000770 0000024 00000002146 13525230047 016516 0 ustar tom staff 0000000 0000000 |Azure Status| |Coverage Status| |PyPI|
About
=====
This is a Sphinx extension to automatically generate API pages for whole
modules. It was originally developed for the Astropy project but is now
available as a standalone package since it can be used for any other
package. The documentation can be found on
`ReadTheDocs `_.
Running tests
-------------
To run the tests, you can either do::
pytest sphinx_automodapi
or if you have `tox `_ installed::
tox -e test
.. |Azure Status| image:: https://dev.azure.com/astropy-project/sphinx-automodapi/_apis/build/status/astropy.sphinx-automodapi?branchName=master
:target: https://dev.azure.com/astropy-project/sphinx-automodapi/_build/latest?definitionId=2&branchName=master
.. |Coverage Status| image:: https://codecov.io/gh/astropy/sphinx-automodapi/branch/master/graph/badge.svg
:target: https://codecov.io/gh/astropy/sphinx-automodapi
.. |PyPI| image:: https://img.shields.io/pypi/v/sphinx-automodapi.svg
:target: https://pypi.python.org/pypi/sphinx-automodapi
sphinx-automodapi-0.12/azure-pipelines.yml 0000644 0000770 0000024 00000000545 13523507262 020673 0 ustar tom staff 0000000 0000000 schedules:
- cron: '0 8 1 * *'
displayName: 'Monthly cron'
branches:
include:
- master
always: 'true'
jobs:
- template: azure-template.yml
parameters:
name: Linux
os: linux
- template: azure-template.yml
parameters:
name: MacOSX
os: macosx
- template: azure-template.yml
parameters:
name: Windows
os: windows
sphinx-automodapi-0.12/azure-template.yml 0000644 0000770 0000024 00000003321 13523222665 020512 0 ustar tom staff 0000000 0000000 jobs:
- job: ${{ format(parameters.name) }}
pool:
${{ if eq(parameters.os, 'macosx') }}:
vmImage: macOS 10.13
${{ if eq(parameters.os, 'linux') }}:
vmImage: Ubuntu 16.04
${{ if eq(parameters.os, 'windows') }}:
vmImage: vs2017-win2016
steps:
- ${{ if eq(parameters.os, 'macosx') }}:
- script: brew install graphviz
displayName: Installing graphviz
- ${{ if eq(parameters.os, 'linux') }}:
- script: sudo apt-get install -y graphviz
displayName: Installing graphviz
- ${{ if eq(parameters.os, 'windows') }}:
- script: choco install graphviz vcpython27 curl codecov --no-progress
displayName: Installing graphviz, vcpython27, curl, and codecov
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7'
architecture: 'x64'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.5'
architecture: 'x64'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: pip install tox coverage
displayName: Installing tox and coverage
- script: tox
displayName: Running tests with tox
- bash: coverage combine .tmp/*/.coverage
displayName: Combining coverage results
- bash: coverage report
displayName: Show coverage
# As described in https://github.com/codecov/codecov-bash/issues/189, the
# official bash script doesn't use the correct variable names for pull
# requests, so we use a fork of the bash script for now.
- bash: bash <(curl https://raw.githubusercontent.com/astrofrog/codecov-bash/fixed-azure/codecov) -t $(codecov.token)
displayName: Uploading results to codecov
sphinx-automodapi-0.12/docs/ 0000755 0000770 0000024 00000000000 13525230464 015757 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/docs/Makefile 0000644 0000770 0000024 00000016742 13233635533 017433 0 ustar tom staff 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " epub3 to make an epub3"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
@echo " dummy to check syntax errors of document sources"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/sphinx-automodapi.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/sphinx-automodapi.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/sphinx-automodapi"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/sphinx-automodapi"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: epub3
epub3:
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
@echo
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
.PHONY: dummy
dummy:
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
@echo
@echo "Build finished. Dummy builder generates no files."
sphinx-automodapi-0.12/docs/automodapi.rst 0000644 0000770 0000024 00000001774 13233635533 020666 0 ustar tom staff 0000000 0000000 Automatically generating module documentation with automodapi
=============================================================
.. _automodapi:
Overview
--------
The main Sphinx directive provided by the sphinx-automodapi package is the
``automodapi`` directive. As described in the :ref:`quickstart` guide,
before you use the directive, you will need to make sure the following
extension is included in the ``extensions`` entry of your documentation's
``conf.py`` file::
extensions = ['sphinx_automodapi.automodapi']
You can then add an ``automodapi`` block anywhere that you want to generate
documentation for a module::
.. automodapi:: mypackage.mymodule
This will add a section with the docstring of the module, followed by a list of
functions, and by a list of classes. For each function and class, a full API
page will be generated.
The automodapi directive and allowed options are described in more detail below.
In detail
---------
.. automodule:: sphinx_automodapi.automodapi
sphinx-automodapi-0.12/docs/automodsumm.rst 0000644 0000770 0000024 00000001544 13233635533 021071 0 ustar tom staff 0000000 0000000 Generating tables of module objects with automodsumm
====================================================
.. _automodsumm:
Overview
--------
The ``automodsumm`` directive takes all objects in a
module and generates a table of these objects and associated API pages. The
:ref:`automodapi ` directive then calls ``automodsumm`` once for
functions and once for classes, and adds the module docstring - but effectively,
the bulk of the work in creating the API tables and pages is done by
``automodsumm``.
Nevertheless, in most cases, users should not need to call ``automodsumm``
directly, except if finer control is desired. The syntax of the directive is::
.. automodsumm:: mypackage.mymodule
The automodsumm directive is described in more detail below.
In detail
---------
.. automodule:: sphinx_automodapi.automodsumm
sphinx-automodapi-0.12/docs/conf.py 0000644 0000770 0000024 00000003650 13525230216 017255 0 ustar tom staff 0000000 0000000 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autosummary']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'sphinx-automodapi'
copyright = '2016, The Astropy Developers'
author = 'The Astropy Developers'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.12'
# The full version, including alpha/beta/rc tags.
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
# Output file base name for HTML help builder.
htmlhelp_basename = 'sphinx-automodapidoc'
nitpicky = True
sphinx-automodapi-0.12/docs/index.rst 0000644 0000770 0000024 00000005401 13525230047 017615 0 ustar tom staff 0000000 0000000 Documentation for sphinx-automodapi
===================================
The sphinx-automodapi package provides Sphinx directives that help faciliate
the automatic generation of API documentation pages for Python package modules.
It was originally developped for the Astropy project, but is now developed as a
standalone package that can be used for any project.
Installation
------------
This extension requires Sphinx 1.7 or later, and can be installed with::
pip install sphinx-automodapi
The extension is also available through conda package management system. It can be installed with::
conda install -c astropy sphinx-automodapi
.. _quickstart:
Quick start
-----------
To use this extension, you will need to add the following entry to the
``extensions`` list in your Sphinx ``conf.py`` file::
extensions = ['sphinx_automodapi.automodapi']
numpydoc_show_class_members = False
You can then add an ``automodapi`` block anywhere that you want to generate
documentation for a module::
.. automodapi:: mypackage.mymodule
This will add a section with the docstring of the module, followed by a list of
functions, and by a list of classes. For each function and class, a full API
page will be generated. The ``numpydoc_show_class_members=False`` option is needed
to avoid having methods and attributes of classes being shown multiple times.
By default, sphinx_automodapi will try and make a diagram showing an
inheritance graph of all the classes in the module. This requires graphviz to
be installed. To disable the inheritance diagram, you can do::
.. automodapi:: mypackage.mymodule
:no-inheritance-diagram:
The ``automodapi`` directive takes other options that are described in more
detail in the `User guide`_ below.
If you are documenting a module which imports classes from other files, and you
want to include an inheritance diagram for the classes, you may run into Sphinx
warnings, because the class may be documented as e.g. ``astropy.table.Table``
but the class really lives at ``astropy.table.core.Table``. To fix this you can
make use of the ``'sphinx_automodapi.smart_resolver'`` Sphinx extension, which
will automatically try and resolve such differences. In this, case, be sure to
include::
extensions = ['sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver']
in your ``conf.py`` file.
User guide
----------
.. toctree::
:maxdepth: 1
automodapi.rst
automodsumm.rst
Dependency Version Guidelines
-----------------------------
As a general guideline, automodapi dependencies (at the time of writing, just
Sphinx) aim to maintain compatibility with versions <= 2 years old. Dependencies
may be newer, however, if specific features become important to help automodapi
work better or be more maintainable.
sphinx-automodapi-0.12/setup.cfg 0000644 0000770 0000024 00000001656 13525230465 016661 0 ustar tom staff 0000000 0000000 [metadata]
name = sphinx-automodapi
version = attr:sphinx_automodapi.__version__
description = Sphinx extension for auto-generating API documentation for entire modules
long_description = file:README.rst
author = The Astropy Developers
author_email = astropy.team@gmail.com
license = BSD 3-Clause License
url = http://astropy.org
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Operating System :: OS Independent
License :: OSI Approved :: BSD License
[options]
zip_safe = False
packages = find:
install_requires =
sphinx>=1.7
[options.extras_require]
test =
pytest
pytest-cov
cython
codecov
coverage
[options.package_data]
sphinx_automodapi = templates/*/*.rst
sphinx_automodapi.tests = cases/*/*.*, cases/*/*/*.*, cases/*/*/*/*.*, cases/*/*/*/*/*.*
[egg_info]
tag_build =
tag_date = 0
sphinx-automodapi-0.12/setup.py 0000644 0000770 0000024 00000000670 13433476531 016551 0 ustar tom staff 0000000 0000000 #!/usr/bin/env python
import sys
import setuptools
from distutils.version import LooseVersion
from setuptools import setup
# Setuptools 30.3.0 or later is needed for setup.cfg options to be used
if LooseVersion(setuptools.__version__) < LooseVersion('30.3.0'):
sys.stderr.write("ERROR: sphinx-automodapi requires setuptools 30.3.0 or "
"later (found {0})".format(setuptools.__version__))
sys.exit(1)
setup()
sphinx-automodapi-0.12/sphinx_automodapi/ 0000755 0000770 0000024 00000000000 13525230464 020562 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/__init__.py 0000644 0000770 0000024 00000000025 13525230223 022661 0 ustar tom staff 0000000 0000000 __version__ = '0.12'
sphinx-automodapi-0.12/sphinx_automodapi/autodoc_enhancements.py 0000644 0000770 0000024 00000005540 13525230047 025323 0 ustar tom staff 0000000 0000000 """
Miscellaneous enhancements to help autodoc along.
"""
import inspect
import sys
import types
from sphinx.ext.autodoc import AttributeDocumenter, ModuleDocumenter
from sphinx.util.inspect import isdescriptor
__all__ = []
if sys.version_info[0] == 3:
class_types = (type,)
else:
class_types = (type, types.ClassType)
MethodDescriptorType = type(type.__subclasses__)
# See
# https://github.com/astropy/astropy-helpers/issues/116#issuecomment-71254836
# for further background on this.
def type_object_attrgetter(obj, attr, *defargs):
"""
This implements an improved attrgetter for type objects (i.e. classes)
that can handle class attributes that are implemented as properties on
a metaclass.
Normally `getattr` on a class with a `property` (say, "foo"), would return
the `property` object itself. However, if the class has a metaclass which
*also* defines a `property` named "foo", ``getattr(cls, 'foo')`` will find
the "foo" property on the metaclass and resolve it. For the purposes of
autodoc we just want to document the "foo" property defined on the class,
not on the metaclass.
For example::
>>> class Meta(type):
... @property
... def foo(cls):
... return 'foo'
...
>>> class MyClass(metaclass=Meta):
... @property
... def foo(self):
... \"\"\"Docstring for MyClass.foo property.\"\"\"
... return 'myfoo'
...
>>> getattr(MyClass, 'foo')
'foo'
>>> type_object_attrgetter(MyClass, 'foo')
>>> type_object_attrgetter(MyClass, 'foo').__doc__
'Docstring for MyClass.foo property.'
The last line of the example shows the desired behavior for the purposes
of autodoc.
"""
for base in obj.__mro__:
if attr in base.__dict__:
if isinstance(base.__dict__[attr], property):
# Note, this should only be used for properties--for any other
# type of descriptor (classmethod, for example) this can mess
# up existing expectations of what getattr(cls, ...) returns
return base.__dict__[attr]
break
return getattr(obj, attr, *defargs)
def setup(app):
# Must have the autodoc extension set up first so we can override it
app.setup_extension('sphinx.ext.autodoc')
app.add_autodoc_attrgetter(type, type_object_attrgetter)
suppress_warnings_orig = app.config.suppress_warnings[:]
if 'app.add_directive' not in app.config.suppress_warnings:
app.config.suppress_warnings.append('app.add_directive')
try:
app.add_autodocumenter(AttributeDocumenter)
finally:
app.config.suppress_warnings = suppress_warnings_orig
return {'parallel_read_safe': True,
'parallel_write_safe': True}
sphinx-automodapi-0.12/sphinx_automodapi/automodapi.py 0000644 0000770 0000024 00000040362 13525230047 023300 0 ustar tom staff 0000000 0000000 # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This directive takes a single argument that must be a module or package. It
will produce a block of documentation that includes the docstring for the
package, an :ref:`automodsumm` directive, and an :ref:`automod-diagram` if
there are any classes in the module. If only the main docstring of the
module/package is desired in the documentation, use `automodule`_ instead of
`automodapi`_.
It accepts the following options:
* ``:include-all-objects:``
If present, include not just functions and classes, but all objects.
This includes variables, for which a possible docstring after the
variable definition will be shown.
* ``:inheritance-diagram:`` / ``:no-inheritance-diagram:``
Specify whether or not to show the inheritance diagram for classes. This
overrides the default global configuration set in
``automodapi_inheritance_diagram``.
* ``:skip: str``
This option results in the
specified object being skipped, that is the object will *not* be
included in the generated documentation. This option may appear
any number of times to skip multiple objects.
* ``:no-main-docstr:``
If present, the docstring for the module/package will not be generated.
The function and class tables will still be used, however.
* ``:headings: str``
Specifies the characters (in one string) used as the heading
levels used for the generated section. This must have at least 2
characters (any after 2 will be ignored). This also *must* match
the rest of the documentation on this page for sphinx to be
happy. Defaults to "-^", which matches the convention used for
Python's documentation, assuming the automodapi call is inside a
top-level section (which usually uses '=').
* ``:no-heading:``
If specified do not create a top level heading for the section.
That is, do not create a title heading with text like "packagename
Package". The actual docstring for the package/module will still be
shown, though, unless ``:no-main-docstr:`` is given.
* ``:allowed-package-names: str``
Specifies the packages that functions/classes documented here are
allowed to be from, as comma-separated list of package names. If not
given, only objects that are actually in a subpackage of the package
currently being documented are included.
* ``:inherited-members:`` / ``:no-inherited-members:``
The global sphinx configuration option
``automodsumm_inherited_members`` decides if members that a class
inherits from a base class are included in the generated
documentation. The option ``:inherited-members:`` or ``:no-inherited-members:``
allows the user to overrride the global setting.
This extension also adds four sphinx configuration options:
* ``automodapi_inheritance_diagram``
Should be a boolean that indicates whether to show inheritance diagrams
by default. This can be overriden on a case by case basis with
``:inheritance-diagram:`` and ``:no-inheritance-diagram:``. Defaults to
``True``.
* ``automodapi_toctreedirnm``
This must be a string that specifies the name of the directory the
automodsumm generated documentation ends up in. This directory path should
be relative to the documentation root (e.g., same place as ``index.rst``).
Defaults to ``'api'``.
* ``automodapi_writereprocessed``
Should be a bool, and if `True`, will cause `automodapi`_ to write files
with any `automodapi`_ sections replaced with the content Sphinx
processes after `automodapi`_ has run. The output files are not
actually used by sphinx, so this option is only for figuring out the
cause of sphinx warnings or other debugging. Defaults to `False`.
* ``automodsumm_inherited_members``
Should be a bool and if ``True`` members that a class inherits from a base
class are included in the generated documentation. Defaults to ``False``.
.. _automodule: http://sphinx-doc.org/latest/ext/autodoc.html?highlight=automodule#directive-automodule
"""
# Implementation note:
# The 'automodapi' directive is not actually implemented as a docutils
# directive. Instead, this extension searches for the 'automodapi' text in
# all sphinx documents, and replaces it where necessary from a template built
# into this extension. This is necessary because automodsumm (and autosummary)
# use the "builder-inited" event, which comes before the directives are
# actually built.
import inspect
import io
import os
import re
import sys
from sphinx.util import logging
from .utils import find_mod_objs
__all__ = []
if sys.version_info[0] == 3:
text_type = str
else:
text_type = unicode # noqa
automod_templ_modheader = """
{modname} {pkgormod}
{modhds}{pkgormodhds}
{automoduleline}
"""
automod_templ_classes = """
Classes
{clshds}
.. automodsumm:: {modname}
:classes-only:
{clsfuncoptions}
"""
automod_templ_funcs = """
Functions
{funchds}
.. automodsumm:: {modname}
:functions-only:
{clsfuncoptions}
"""
automod_templ_vars = """
Variables
{otherhds}
.. automodsumm:: {modname}
:variables-only:
{clsfuncoptions}
"""
automod_templ_inh = """
Class Inheritance Diagram
{clsinhsechds}
.. automod-diagram:: {modname}
:private-bases:
:parts: 1
{allowedpkgnms}
{skip}
"""
_automodapirex = re.compile(r'^(?:\.\.\s+automodapi::\s*)([A-Za-z0-9_.]+)'
r'\s*$((?:\n\s+:[a-zA-Z_\-]+:.*$)*)',
flags=re.MULTILINE)
# the last group of the above regex is intended to go into finall with the below
_automodapiargsrex = re.compile(r':([a-zA-Z_\-]+):(.*)$', flags=re.MULTILINE)
def automodapi_replace(sourcestr, app, dotoctree=True, docname=None,
warnings=True):
"""
Replaces `sourcestr`'s entries of ".. automdapi::" with the
automodapi template form based on provided options.
This is used with the sphinx event 'source-read' to replace
`automodapi`_ entries before sphinx actually processes them, as
automodsumm needs the code to be present to generate stub
documentation.
Parameters
----------
sourcestr : str
The string with sphinx source to be checked for automodapi
replacement.
app : `sphinx.application.Application`
The sphinx application.
dotoctree : bool
If `True`, a ":toctree:" option will be added in the "..
automodsumm::" sections of the template, pointing to the
appropriate "generated" directory based on the Astropy convention
(e.g. in ``docs/api``)
docname : str
The name of the file for this `sourcestr` (if known - if not, it
can be `None`). If not provided and `dotoctree` is `True`, the
generated files may end up in the wrong place.
warnings : bool
If `False`, all warnings that would normally be issued are
silenced.
Returns
-------
newstr :str
The string with automodapi entries replaced with the correct
sphinx markup.
"""
logger = logging.getLogger(__name__)
spl = _automodapirex.split(sourcestr)
if len(spl) > 1: # automodsumm is in this document
# Use app.srcdir because api folder should be inside source folder not
# at folder where sphinx is run.
if dotoctree:
toctreestr = ':toctree: '
api_dir = os.path.join(app.srcdir, app.config.automodapi_toctreedirnm)
if docname is None:
doc_path = app.srcdir
else:
doc_path = os.path.dirname(os.path.join(app.srcdir, docname))
toctreestr += os.path.relpath(api_dir, doc_path).replace(os.sep, '/')
else:
toctreestr = ''
newstrs = [spl[0]]
for grp in range(len(spl) // 3):
modnm = spl[grp * 3 + 1]
# find where this is in the document for warnings
if docname is None:
location = None
else:
location = (docname, spl[0].count('\n'))
# initialize default options
toskip = []
inhdiag = app.config.automodapi_inheritance_diagram
maindocstr = True
top_head = True
hds = '-^'
allowedpkgnms = []
allowothers = False
# look for actual options
unknownops = []
inherited_members = None
for opname, args in _automodapiargsrex.findall(spl[grp * 3 + 2]):
if opname == 'skip':
toskip.append(args.strip())
elif opname == 'inheritance-diagram':
inhdiag = True
elif opname == 'no-inheritance-diagram':
inhdiag = False
elif opname == 'no-main-docstr':
maindocstr = False
elif opname == 'headings':
hds = args
elif opname == 'no-heading':
top_head = False
elif opname == 'allowed-package-names':
allowedpkgnms.append(args.strip())
elif opname == 'inherited-members':
inherited_members = True
elif opname == 'no-inherited-members':
inherited_members = False
elif opname == 'include-all-objects':
allowothers = True
else:
unknownops.append(opname)
# join all the allowedpkgnms
if len(allowedpkgnms) == 0:
allowedpkgnms = ''
onlylocals = True
else:
allowedpkgnms = ':allowed-package-names: ' + ','.join(allowedpkgnms)
onlylocals = allowedpkgnms
# get the two heading chars
hds = hds.strip()
if len(hds) < 2:
msg = 'Not enough headings (got {0}, need 2), using default -^'
if warnings:
logger.warning(msg.format(len(hds)), location)
hds = '-^'
h1, h2 = hds[:2]
# tell sphinx that the remaining args are invalid.
if len(unknownops) > 0 and app is not None:
opsstrs = ','.join(unknownops)
msg = 'Found additional options ' + opsstrs + ' in automodapi.'
if warnings:
logger.warning(msg, location)
ispkg, hascls, hasfuncs, hasother = _mod_info(
modnm, toskip, onlylocals=onlylocals)
# add automodule directive only if no-main-docstr isn't present
if maindocstr:
automodline = '.. automodule:: {modname}'.format(modname=modnm)
else:
automodline = ''
if top_head:
newstrs.append(automod_templ_modheader.format(
modname=modnm,
modhds=h1 * len(modnm),
pkgormod='Package' if ispkg else 'Module',
pkgormodhds=h1 * (8 if ispkg else 7),
automoduleline=automodline)) # noqa
else:
newstrs.append(automod_templ_modheader.format(
modname='',
modhds='',
pkgormod='',
pkgormodhds='',
automoduleline=automodline))
# construct the options for the class/function sections
# start out indented at 4 spaces, but need to keep the indentation.
clsfuncoptions = []
if toctreestr:
clsfuncoptions.append(toctreestr)
if toskip:
clsfuncoptions.append(':skip: ' + ','.join(toskip))
if allowedpkgnms:
clsfuncoptions.append(allowedpkgnms)
if hascls: # This makes no sense unless there are classes.
if inherited_members is True:
clsfuncoptions.append(':inherited-members:')
if inherited_members is False:
clsfuncoptions.append(':no-inherited-members:')
clsfuncoptionstr = '\n '.join(clsfuncoptions)
if hasfuncs:
newstrs.append(automod_templ_funcs.format(
modname=modnm,
funchds=h2 * 9,
clsfuncoptions=clsfuncoptionstr))
if hascls:
newstrs.append(automod_templ_classes.format(
modname=modnm,
clshds=h2 * 7,
clsfuncoptions=clsfuncoptionstr))
if allowothers and hasother:
newstrs.append(automod_templ_vars.format(
modname=modnm,
otherhds=h2 * 9,
clsfuncoptions=clsfuncoptionstr))
if inhdiag and hascls:
# add inheritance diagram if any classes are in the module
if toskip:
clsskip = ':skip: ' + ','.join(toskip)
else:
clsskip = ''
diagram_entry = automod_templ_inh.format(
modname=modnm,
clsinhsechds=h2 * 25,
allowedpkgnms=allowedpkgnms,
skip=clsskip)
diagram_entry = diagram_entry.replace(' \n', '')
newstrs.append(diagram_entry)
newstrs.append(spl[grp * 3 + 3])
newsourcestr = ''.join(newstrs)
if app.config.automodapi_writereprocessed:
# sometimes they are unicode, sometimes not, depending on how
# sphinx has processed things
if isinstance(newsourcestr, text_type):
ustr = newsourcestr
else:
ustr = newsourcestr.decode(app.config.source_encoding)
if docname is None:
with io.open(os.path.join(app.srcdir, 'unknown.automodapi'),
'a', encoding='utf8') as f:
f.write(u'\n**NEW DOC**\n\n')
f.write(ustr)
else:
env = app.builder.env
# Determine the filename associated with this doc (specifically
# the extension)
filename = docname + os.path.splitext(env.doc2path(docname))[1]
filename += '.automodapi'
with io.open(os.path.join(app.srcdir, filename), 'w',
encoding='utf8') as f:
f.write(ustr)
return newsourcestr
else:
return sourcestr
def _mod_info(modname, toskip=[], onlylocals=True):
"""
Determines if a module is a module or a package and whether or not
it has classes or functions.
"""
hascls = hasfunc = hasother = False
for localnm, fqnm, obj in zip(*find_mod_objs(modname, onlylocals=onlylocals)):
if localnm not in toskip:
hascls = hascls or inspect.isclass(obj)
hasfunc = hasfunc or inspect.isroutine(obj)
hasother = hasother or (not inspect.isclass(obj) and
not inspect.isroutine(obj))
if hascls and hasfunc and hasother:
break
# find_mod_objs has already imported modname
# TODO: There is probably a cleaner way to do this, though this is pretty
# reliable for all Python versions for most cases that we care about.
pkg = sys.modules[modname]
ispkg = (hasattr(pkg, '__file__') and isinstance(pkg.__file__, str) and
os.path.split(pkg.__file__)[1].startswith('__init__.py'))
return ispkg, hascls, hasfunc, hasother
def process_automodapi(app, docname, source):
source[0] = automodapi_replace(source[0], app, True, docname)
def setup(app):
app.setup_extension('sphinx.ext.autosummary')
# Note: we use __name__ here instead of just writing the module name in
# case this extension is bundled into another package
from . import automodsumm
app.setup_extension(automodsumm.__name__)
app.connect('source-read', process_automodapi)
app.add_config_value('automodapi_inheritance_diagram', True, True)
app.add_config_value('automodapi_toctreedirnm', 'api', True)
app.add_config_value('automodapi_writereprocessed', False, True)
return {'parallel_read_safe': True,
'parallel_write_safe': True}
sphinx-automodapi-0.12/sphinx_automodapi/automodsumm.py 0000644 0000770 0000024 00000064477 13525230047 023525 0 ustar tom staff 0000000 0000000 # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This directive will produce an "autosummary"-style table for public
attributes of a specified module. See the `sphinx.ext.autosummary`_ extension
for details on this process. The main difference from the `autosummary`_
directive is that `autosummary`_ requires manually inputting all attributes
that appear in the table, while this captures the entries automatically.
This directive requires a single argument that must be a module or
package.
It also accepts any options supported by the `autosummary`_ directive-
see `sphinx.ext.autosummary`_ for details. It also accepts some additional
options:
* ``:classes-only:``
If present, the autosummary table will only contain entries for
classes. This cannot be used at the same time with
``:functions-only:`` or ``:variables-only:``.
* ``:functions-only:``
If present, the autosummary table will only contain entries for
functions. This cannot be used at the same time with
``:classes-only:`` or ``:variables-only:``.
* ``:variables-only:``
If present, the autosummary table will only contain entries for
variables (everything except functions and classes). This cannot
be used at the same time with ``:classes-only:`` or
``:functions-only:``.
* ``:skip: obj1, [obj2, obj3, ...]``
If present, specifies that the listed objects should be skipped
and not have their documentation generated, nor be included in
the summary table.
* ``:allowed-package-names: pkgormod1, [pkgormod2, pkgormod3, ...]``
Specifies the packages that functions/classes documented here are
allowed to be from, as comma-separated list of package names. If not
given, only objects that are actually in a subpackage of the package
currently being documented are included.
* ``:inherited-members:`` or ``:no-inherited-members:``
The global sphinx configuration option ``automodsumm_inherited_members``
decides if members that a class inherits from a base class are included
in the generated documentation. The flags ``:inherited-members:`` or
``:no-inherited-members:`` allows overrriding this global setting.
This extension also adds two sphinx configuration options:
* ``automodsumm_writereprocessed``
Should be a bool, and if ``True``, will cause `automodsumm`_ to write files
with any ``automodsumm`` sections replaced with the content Sphinx
processes after ``automodsumm`` has run. The output files are not
actually used by sphinx, so this option is only for figuring out the
cause of sphinx warnings or other debugging. Defaults to ``False``.
* ``automodsumm_inherited_members``
Should be a bool and if ``True``, will cause `automodsumm`_ to document
class members that are inherited from a base class. This value can be
overriden for any particular automodsumm directive by including the
``:inherited-members:`` or ``:no-inherited-members:`` options. Defaults to
``False``.
.. _sphinx.ext.autosummary: http://sphinx-doc.org/latest/ext/autosummary.html
.. _autosummary: http://sphinx-doc.org/latest/ext/autosummary.html#directive-autosummary
.. _automod-diagram:
automod-diagram directive
=========================
This directive will produce an inheritance diagram like that of the
`sphinx.ext.inheritance_diagram`_ extension.
This directive requires a single argument that must be a module or
package. It accepts no options.
.. note::
Like 'inheritance-diagram', 'automod-diagram' requires
`graphviz `_ to generate the inheritance diagram.
.. _sphinx.ext.inheritance_diagram: http://sphinx-doc.org/latest/ext/inheritance.html
"""
import abc
import inspect
import os
import re
import io
from sphinx.util import logging
from sphinx.ext.autosummary import Autosummary
from sphinx.ext.inheritance_diagram import InheritanceDiagram
from docutils.parsers.rst.directives import flag
from .utils import find_mod_objs, cleanup_whitespace
__all__ = ['Automoddiagram', 'Automodsumm', 'automodsumm_to_autosummary_lines',
'generate_automodsumm_docs', 'process_automodsumm_generation']
def _str_list_converter(argument):
"""
A directive option conversion function that converts the option into a list
of strings. Used for 'skip' option.
"""
if argument is None:
return []
else:
return [s.strip() for s in argument.split(',')]
class Automodsumm(Autosummary):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
has_content = False
option_spec = dict(Autosummary.option_spec)
option_spec['functions-only'] = flag
option_spec['classes-only'] = flag
option_spec['variables-only'] = flag
option_spec['skip'] = _str_list_converter
option_spec['allowed-package-names'] = _str_list_converter
option_spec['inherited-members'] = flag
option_spec['no-inherited-members'] = flag
def run(self):
env = self.state.document.settings.env
modname = self.arguments[0]
nodelist = []
try:
localnames, fqns, objs = find_mod_objs(modname)
except ImportError:
self.warn("Couldn't import module " + modname)
return []
try:
# set self.content to trick the autosummary internals.
# Be sure to respect functions-only and classes-only.
funconly = 'functions-only' in self.options
clsonly = 'classes-only' in self.options
varonly = 'variables-only' in self.options
if [clsonly, funconly, varonly].count(True) > 1:
self.warn('more than one of "functions-only", "classes-only", '
'or "variables-only" defined. Ignoring.')
clsonly = funconly = varonly = False
skipnames = []
if 'skip' in self.options:
option_skipnames = set(self.options['skip'])
for lnm in localnames:
if lnm in option_skipnames:
option_skipnames.remove(lnm)
skipnames.append(lnm)
if len(option_skipnames) > 0:
self.warn('Tried to skip objects {objs} in module {mod}, '
'but they were not present. Ignoring.'
.format(objs=option_skipnames, mod=modname))
if funconly:
cont = []
for nm, obj in zip(localnames, objs):
if nm not in skipnames and inspect.isroutine(obj):
cont.append(nm)
elif clsonly:
cont = []
for nm, obj in zip(localnames, objs):
if nm not in skipnames and inspect.isclass(obj):
cont.append(nm)
elif varonly:
cont = []
for nm, obj in zip(localnames, objs):
if nm not in skipnames and not (inspect.isclass(obj) or
inspect.isroutine(obj)):
cont.append(nm)
else:
cont = [nm for nm in localnames if nm not in skipnames]
self.content = cont
# for some reason, even though ``currentmodule`` is substituted in,
# sphinx doesn't necessarily recognize this fact. So we just force
# it internally, and that seems to fix things
env.temp_data['py:module'] = modname
env.ref_context['py:module'] = modname
# can't use super because Sphinx/docutils has trouble return
# super(Autosummary,self).run()
nodelist.extend(Autosummary.run(self))
return nodelist
finally: # has_content = False for the Automodsumm
self.content = []
def get_items(self, names):
try:
self.bridge.genopt['imported-members'] = True
except AttributeError: # Sphinx < 4.0
self.genopt['imported-members'] = True
return Autosummary.get_items(self, names)
# <-------------------automod-diagram stuff----------------------------------->
class Automoddiagram(InheritanceDiagram):
option_spec = dict(InheritanceDiagram.option_spec)
option_spec['allowed-package-names'] = _str_list_converter
option_spec['skip'] = _str_list_converter
def run(self):
try:
ols = self.options.get('allowed-package-names', [])
ols = True if len(ols) == 0 else ols # if none are given, assume only local
nms, objs = find_mod_objs(self.arguments[0], onlylocals=ols)[1:]
except ImportError:
self.warn("Couldn't import module " + self.arguments[0])
return []
# Check if some classes should be skipped
skip = self.options.get('skip', [])
clsnms = []
for n, o in zip(nms, objs):
if n.split('.')[-1] in skip:
continue
if inspect.isclass(o):
clsnms.append(n)
oldargs = self.arguments
try:
if len(clsnms) > 0:
self.arguments = [' '.join(clsnms)]
return InheritanceDiagram.run(self)
finally:
self.arguments = oldargs
# <---------------------automodsumm generation stuff-------------------------->
def process_automodsumm_generation(app):
env = app.builder.env
filestosearch = []
for docname in env.found_docs:
filename = env.doc2path(docname)
if os.path.isfile(filename):
filestosearch.append(docname + os.path.splitext(filename)[1])
liness = []
for sfn in filestosearch:
lines = automodsumm_to_autosummary_lines(sfn, app)
liness.append(lines)
if app.config.automodsumm_writereprocessed:
if lines: # empty list means no automodsumm entry is in the file
outfn = os.path.join(app.srcdir, sfn) + '.automodsumm'
with open(outfn, 'w') as f:
for l in lines:
f.write(l)
f.write('\n')
for sfn, lines in zip(filestosearch, liness):
suffix = os.path.splitext(sfn)[1]
if len(lines) > 0:
generate_automodsumm_docs(
lines, sfn, app=app, builder=app.builder,
suffix=suffix, base_path=app.srcdir,
inherited_members=app.config.automodsumm_inherited_members)
# _automodsummrex = re.compile(r'^(\s*)\.\. automodsumm::\s*([A-Za-z0-9_.]+)\s*'
# r'\n\1(\s*)(\S|$)', re.MULTILINE)
_lineendrex = r'(?:\n|$)'
_hdrex = r'^\n?(\s*)\.\. automodsumm::\s*(\S+)\s*' + _lineendrex
_oprex1 = r'(?:\1(\s+)\S.*' + _lineendrex + ')'
_oprex2 = r'(?:\1\4\S.*' + _lineendrex + ')'
_automodsummrex = re.compile(_hdrex + '(' + _oprex1 + '?' + _oprex2 + '*)',
re.MULTILINE)
def automodsumm_to_autosummary_lines(fn, app):
"""
Generates lines from a file with an "automodsumm" entry suitable for
feeding into "autosummary".
Searches the provided file for `automodsumm` directives and returns
a list of lines specifying the `autosummary` commands for the modules
requested. This does *not* return the whole file contents - just an
autosummary section in place of any :automodsumm: entries. Note that
any options given for `automodsumm` are also included in the
generated `autosummary` section.
Parameters
----------
fn : str
The name of the file to search for `automodsumm` entries.
app : sphinx.application.Application
The sphinx Application object
Returns
-------
lines : list of str
Lines for all `automodsumm` entries with the entries replaced by
`autosummary` and the module's members added.
"""
logger = logging.getLogger(__name__)
fullfn = os.path.join(app.builder.env.srcdir, fn)
with io.open(fullfn, encoding='utf8') as fr:
# Note: we use __name__ here instead of just writing the module name in
# case this extension is bundled into another package
from . import automodapi
try:
extensions = app.extensions
except AttributeError: # Sphinx <1.6
extensions = app._extensions
if automodapi.__name__ in extensions:
# Must do the automodapi on the source to get the automodsumm
# that might be in there
docname = os.path.splitext(fn)[0]
filestr = automodapi.automodapi_replace(fr.read(), app, True, docname, False)
else:
filestr = fr.read()
spl = _automodsummrex.split(filestr)
# 0th entry is the stuff before the first automodsumm line
indent1s = spl[1::5]
mods = spl[2::5]
opssecs = spl[3::5]
indent2s = spl[4::5]
remainders = spl[5::5]
# only grab automodsumm sections and convert them to autosummary with the
# entries for all the public objects
newlines = []
# loop over all automodsumms in this document
for i, (i1, i2, modnm, ops, rem) in enumerate(zip(indent1s, indent2s, mods,
opssecs, remainders)):
allindent = i1 + (' ' if i2 is None else i2)
# filter out functions-only, classes-only, and ariables-only
# options if present.
oplines = ops.split('\n')
toskip = []
allowedpkgnms = []
funcsonly = clssonly = varsonly = False
for i, ln in reversed(list(enumerate(oplines))):
if ':functions-only:' in ln:
funcsonly = True
del oplines[i]
if ':classes-only:' in ln:
clssonly = True
del oplines[i]
if ':variables-only:' in ln:
varsonly = True
del oplines[i]
if ':skip:' in ln:
toskip.extend(_str_list_converter(ln.replace(':skip:', '')))
del oplines[i]
if ':allowed-package-names:' in ln:
allowedpkgnms.extend(_str_list_converter(ln.replace(':allowed-package-names:', '')))
del oplines[i]
if [funcsonly, clssonly, varsonly].count(True) > 1:
msg = ('Defined more than one of functions-only, classes-only, '
'and variables-only. Skipping this directive.')
lnnum = sum([spl[j].count('\n') for j in range(i * 5 + 1)])
logger.warning('[automodsumm] ' + msg, (fn, lnnum))
continue
# Use the currentmodule directive so we can just put the local names
# in the autosummary table. Note that this doesn't always seem to
# actually "take" in Sphinx's eyes, so in `Automodsumm.run`, we have to
# force it internally, as well.
newlines.extend([i1 + '.. currentmodule:: ' + modnm,
'',
'.. autosummary::'])
newlines.extend(oplines)
ols = True if len(allowedpkgnms) == 0 else allowedpkgnms
for nm, fqn, obj in zip(*find_mod_objs(modnm, onlylocals=ols)):
if nm in toskip:
continue
if funcsonly and not inspect.isroutine(obj):
continue
if clssonly and not inspect.isclass(obj):
continue
if varsonly and (inspect.isclass(obj) or inspect.isroutine(obj)):
continue
newlines.append(allindent + nm)
# add one newline at the end of the autosummary block
newlines.append('')
return newlines
def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst',
base_path=None, builder=None,
template_dir=None,
inherited_members=False):
"""
This function is adapted from
`sphinx.ext.autosummary.generate.generate_autosummmary_docs` to
generate source for the automodsumm directives that should be
autosummarized. Unlike generate_autosummary_docs, this function is
called one file at a time.
"""
from sphinx.jinja2glue import BuiltinTemplateLoader
from sphinx.ext.autosummary import import_by_name, get_documenter
from sphinx.util.osutil import ensuredir
from sphinx.util.inspect import safe_getattr
from jinja2 import FileSystemLoader, TemplateNotFound
from jinja2.sandbox import SandboxedEnvironment
from .utils import find_autosummary_in_lines_for_automodsumm as find_autosummary_in_lines
logger = logging.getLogger(__name__)
# Create our own templating environment - here we use Astropy's
# templates rather than the default autosummary templates, in order to
# allow docstrings to be shown for methods.
template_dirs = [os.path.join(os.path.dirname(__file__), 'templates'),
os.path.join(base_path, '_templates')]
if builder is not None:
# allow the user to override the templates
template_loader = BuiltinTemplateLoader()
template_loader.init(builder, dirs=template_dirs)
else:
if template_dir:
template_dirs.insert(0, template_dir)
template_loader = FileSystemLoader(template_dirs)
template_env = SandboxedEnvironment(loader=template_loader)
# read
# items = find_autosummary_in_files(sources)
items = find_autosummary_in_lines(lines, filename=srcfn)
if len(items) > 0:
msg = '[automodsumm] {1}: found {0} automodsumm entries to generate'
logger.info(msg.format(len(items), srcfn))
# gennms = [item[0] for item in items]
# if len(gennms) > 20:
# gennms = gennms[:10] + ['...'] + gennms[-10:]
# logger.info('[automodsumm] generating autosummary for: ' + ', '.join(gennms))
# remove possible duplicates
items = list(set(items))
# keep track of new files
new_files = []
# write
for name, path, template_name, inherited_mem in sorted(items):
if path is None:
# The corresponding autosummary:: directive did not have
# a :toctree: option
continue
path = os.path.abspath(os.path.join(base_path, path))
ensuredir(path)
try:
import_by_name_values = import_by_name(name)
except ImportError as e:
logger.warning('[automodsumm] failed to import %r: %s' % (name, e))
continue
# if block to accommodate Sphinx's v1.2.2 and v1.2.3 respectively
if len(import_by_name_values) == 3:
name, obj, parent = import_by_name_values
elif len(import_by_name_values) == 4:
name, obj, parent, module_name = import_by_name_values
fn = os.path.join(path, name + suffix)
# skip it if it exists
if os.path.isfile(fn):
continue
new_files.append(fn)
f = open(fn, 'w')
try:
doc = get_documenter(app, obj, parent)
if template_name is not None:
template = template_env.get_template(template_name)
else:
tmplstr = 'autosummary_core/%s.rst'
try:
template = template_env.get_template(tmplstr % doc.objtype)
except TemplateNotFound:
template = template_env.get_template(tmplstr % 'base')
def get_members_mod(obj, typ, include_public=[]):
"""
typ = None -> all
"""
items = []
for name in dir(obj):
try:
documenter = get_documenter(app, safe_getattr(obj, name), obj)
except AttributeError:
continue
if typ is None or documenter.objtype == typ:
items.append(name)
public = [x for x in items
if x in include_public or not x.startswith('_')]
return public, items
def get_members_class(obj, typ, include_public=[],
include_base=False):
"""
typ = None -> all
include_base -> include attrs that are from a base class
"""
items = []
# using dir gets all of the attributes, including the elements
# from the base class, otherwise use __slots__ or __dict__
if include_base:
names = dir(obj)
else:
# Classes deriving from an ABC using the `abc` module will
# have an empty `__slots__` attribute in Python 3, unless
# other slots were declared along the inheritance chain. If
# the ABC-derived class has empty slots, we'll use the
# class `__dict__` instead.
declares_slots = (
hasattr(obj, '__slots__') and
not (type(obj) is abc.ABCMeta and
len(obj.__slots__) == 0)
)
if declares_slots:
names = tuple(getattr(obj, '__slots__'))
else:
names = getattr(obj, '__dict__').keys()
for name in names:
try:
documenter = get_documenter(app, safe_getattr(obj, name), obj)
except AttributeError:
continue
if typ is None or documenter.objtype == typ:
items.append(name)
elif typ == 'attribute' and documenter.objtype == 'property':
# In Sphinx 2.0 and above, properties have a separate
# objtype, but we treat them the same here.
items.append(name)
public = [x for x in items
if x in include_public or not x.startswith('_')]
return public, items
ns = {}
if doc.objtype == 'module':
ns['members'] = get_members_mod(obj, None)
ns['functions'], ns['all_functions'] = \
get_members_mod(obj, 'function')
ns['classes'], ns['all_classes'] = \
get_members_mod(obj, 'class')
ns['exceptions'], ns['all_exceptions'] = \
get_members_mod(obj, 'exception')
elif doc.objtype == 'class':
if inherited_mem is not None:
# option set in this specifc directive
include_base = inherited_mem
else:
# use default value
include_base = inherited_members
api_class_methods = ['__init__', '__call__']
ns['members'] = get_members_class(obj, None,
include_base=include_base)
ns['methods'], ns['all_methods'] = \
get_members_class(obj, 'method', api_class_methods,
include_base=include_base)
ns['attributes'], ns['all_attributes'] = \
get_members_class(obj, 'attribute',
include_base=include_base)
ns['methods'].sort()
ns['attributes'].sort()
parts = name.split('.')
if doc.objtype in ('method', 'attribute'):
mod_name = '.'.join(parts[:-2])
cls_name = parts[-2]
obj_name = '.'.join(parts[-2:])
ns['class'] = cls_name
else:
mod_name, obj_name = '.'.join(parts[:-1]), parts[-1]
ns['fullname'] = name
ns['module'] = mod_name
ns['objname'] = obj_name
ns['name'] = parts[-1]
ns['objtype'] = doc.objtype
ns['underline'] = len(obj_name) * '='
# We now check whether a file for reference footnotes exists for
# the module being documented. We first check if the
# current module is a file or a directory, as this will give a
# different path for the reference file. For example, if
# documenting astropy.wcs then the reference file is at
# ../wcs/references.txt, while if we are documenting
# astropy.config.logging_helper (which is at
# astropy/config/logging_helper.py) then the reference file is set
# to ../config/references.txt
if '.' in mod_name:
mod_name_dir = mod_name.split('.', 1)[1].replace('.', os.sep)
else:
mod_name_dir = mod_name
if (not os.path.isdir(os.path.join(base_path, mod_name_dir))
and os.path.isdir(os.path.join(base_path, mod_name_dir.rsplit(os.sep, 1)[0]))):
mod_name_dir = mod_name_dir.rsplit(os.sep, 1)[0]
# We then have to check whether it exists, and if so, we pass it
# to the template.
if os.path.exists(os.path.join(base_path, mod_name_dir, 'references.txt')):
# An important subtlety here is that the path we pass in has
# to be relative to the file being generated, so we have to
# figure out the right number of '..'s
ndirsback = path.replace(base_path, '').count(os.sep)
ref_file_rel_segments = ['..'] * ndirsback
ref_file_rel_segments.append(mod_name_dir)
ref_file_rel_segments.append('references.txt')
ns['referencefile'] = os.path.join(*ref_file_rel_segments).replace(os.sep, '/')
rendered = template.render(**ns)
f.write(cleanup_whitespace(rendered))
finally:
f.close()
def setup(app):
# need autodoc fixes
# Note: we use __name__ here instead of just writing the module name in
# case this extension is bundled into another package
from . import autodoc_enhancements
app.setup_extension(autodoc_enhancements.__name__)
# need inheritance-diagram for automod-diagram
app.setup_extension('sphinx.ext.inheritance_diagram')
app.add_directive('automod-diagram', Automoddiagram)
app.add_directive('automodsumm', Automodsumm)
app.connect('builder-inited', process_automodsumm_generation)
app.add_config_value('automodsumm_writereprocessed', False, True)
app.add_config_value('automodsumm_inherited_members', False, 'env')
return {'parallel_read_safe': True,
'parallel_write_safe': True}
sphinx-automodapi-0.12/sphinx_automodapi/smart_resolver.py 0000644 0000770 0000024 00000010064 13523222665 024206 0 ustar tom staff 0000000 0000000 # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The classes in the astropy docs are documented by their API location,
which is not necessarily where they are defined in the source. This
causes a problem when certain automated features of the doc build,
such as the inheritance diagrams or the `Bases` list of a class
reference a class by its canonical location rather than its "user"
location.
In the `autodoc-process-docstring` event, a mapping from the actual
name to the API name is maintained. Later, in the `missing-reference`
event, unresolved references are looked up in this dictionary and
corrected if possible.
"""
from docutils.nodes import literal, reference
def process_docstring(app, what, name, obj, options, lines):
if isinstance(obj, type):
env = app.env
if not hasattr(env, 'class_name_mapping'):
env.class_name_mapping = {}
mapping = env.class_name_mapping
mapping[obj.__module__ + '.' + obj.__name__] = name
def merge_mapping(app, env, docnames, env_other):
if not hasattr(env_other, 'class_name_mapping'):
return
if not hasattr(env, 'class_name_mapping'):
env.class_name_mapping = {}
env.class_name_mapping.update(env_other.class_name_mapping)
def missing_reference_handler(app, env, node, contnode):
if not hasattr(env, 'class_name_mapping'):
env.class_name_mapping = {}
mapping = env.class_name_mapping
reftype = node['reftype']
reftarget = node['reftarget']
if reftype in ('obj', 'class', 'exc', 'meth'):
reftarget = node['reftarget']
suffix = ''
if reftarget not in mapping:
if '.' in reftarget:
front, suffix = reftarget.rsplit('.', 1)
else:
suffix = reftarget
if suffix.startswith('_') and not suffix.startswith('__'):
# If this is a reference to a hidden class or method,
# we can't link to it, but we don't want to have a
# nitpick warning.
return node[0].deepcopy()
if reftype in ('obj', 'meth') and '.' in reftarget:
if front in mapping:
reftarget = front
suffix = '.' + suffix
if (reftype in ('class', ) and '.' in reftarget and
reftarget not in mapping):
if '.' in front:
reftarget, _ = front.rsplit('.', 1)
suffix = '.' + suffix
reftarget = reftarget + suffix
prefix = reftarget.rsplit('.')[0]
inventory = env.intersphinx_named_inventory
if (reftarget not in mapping and
prefix in inventory):
if 'py:class' in inventory[prefix] and reftarget in inventory[prefix]['py:class']:
newtarget = inventory[prefix]['py:class'][reftarget][2]
if not node['refexplicit'] and \
'~' not in node.rawsource:
contnode = literal(text=reftarget)
newnode = reference('', '', internal=True)
newnode['reftitle'] = reftarget
newnode['refuri'] = newtarget
newnode.append(contnode)
return newnode
if reftarget in mapping:
newtarget = mapping[reftarget] + suffix
if not node['refexplicit'] and '~' not in node.rawsource:
contnode = literal(text=newtarget)
newnode = env.domains['py'].resolve_xref(
env, node['refdoc'], app.builder, 'class', newtarget,
node, contnode)
if newnode is not None:
newnode['reftitle'] = reftarget
return newnode
def setup(app):
app.connect('autodoc-process-docstring', process_docstring)
app.connect('missing-reference', missing_reference_handler)
app.connect('env-merge-info', merge_mapping)
return {'parallel_read_safe': True,
'parallel_write_safe': True}
sphinx-automodapi-0.12/sphinx_automodapi/templates/ 0000755 0000770 0000024 00000000000 13525230464 022560 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/templates/autosummary_core/ 0000755 0000770 0000024 00000000000 13525230464 026156 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/templates/autosummary_core/base.rst 0000644 0000770 0000024 00000000252 13416454725 027630 0 ustar tom staff 0000000 0000000 {% if referencefile %}
.. include:: {{ referencefile }}
{% endif %}
{{ objname }}
{{ underline }}
.. currentmodule:: {{ module }}
.. auto{{ objtype }}:: {{ objname }}
sphinx-automodapi-0.12/sphinx_automodapi/templates/autosummary_core/class.rst 0000644 0000770 0000024 00000002211 13233635533 030013 0 ustar tom staff 0000000 0000000 {% if referencefile %}
.. include:: {{ referencefile }}
{% endif %}
{{ objname }}
{{ underline }}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:show-inheritance:
{% if '__init__' in methods %}
{% set caught_result = methods.remove('__init__') %}
{% endif %}
{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes Summary
.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block methods_summary %}
{% if methods %}
.. rubric:: Methods Summary
.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes_documentation %}
{% if attributes %}
.. rubric:: Attributes Documentation
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block methods_documentation %}
{% if methods %}
.. rubric:: Methods Documentation
{% for item in methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
sphinx-automodapi-0.12/sphinx_automodapi/templates/autosummary_core/module.rst 0000644 0000770 0000024 00000001277 13233635533 030206 0 ustar tom staff 0000000 0000000 {% if referencefile %}
.. include:: {{ referencefile }}
{% endif %}
{{ objname }}
{{ underline }}
.. automodule:: {{ fullname }}
{% block functions %}
{% if functions %}
.. rubric:: Functions
.. autosummary::
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block classes %}
{% if classes %}
.. rubric:: Classes
.. autosummary::
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block exceptions %}
{% if exceptions %}
.. rubric:: Exceptions
.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
sphinx-automodapi-0.12/sphinx_automodapi/tests/ 0000755 0000770 0000024 00000000000 13525230464 021724 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/__init__.py 0000644 0000770 0000024 00000003214 13525230047 024032 0 ustar tom staff 0000000 0000000 import os
import sys
import subprocess as sp
from textwrap import dedent
import pytest
@pytest.fixture
def cython_testpackage(tmpdir, request):
"""
Creates a trivial Cython package for use with tests.
"""
test_pkg = tmpdir.mkdir('test_pkg')
test_pkg.mkdir('apyhtest_eva').ensure('__init__.py')
test_pkg.join('apyhtest_eva').join('unit02.pyx').write(dedent("""\
def pilot():
\"\"\"Returns the pilot of Eva Unit-02.\"\"\"
return True
"""))
import sphinx_automodapi # noqa
test_pkg.join('setup.py').write(dedent("""\
import sys
sys.path.insert(0, {0!r})
from os.path import join
from setuptools import setup, Extension
NAME = 'apyhtest_eva'
VERSION = 0.1
RELEASE = True
setup(
name=NAME,
version=VERSION,
ext_modules=[Extension('apyhtest_eva.unit02',
[join('apyhtest_eva', 'unit02.pyx')])]
)
""".format(os.path.dirname(sphinx_automodapi.__path__[0]))))
# Build the Cython module in a subprocess; otherwise strange things can
# happen with Cython's global module state
sp.call([sys.executable, 'setup.py', 'build_ext', '--inplace'], cwd=test_pkg.strpath)
sys.path.insert(0, str(test_pkg))
import apyhtest_eva.unit02 # noqa
def cleanup(test_pkg=test_pkg):
for modname in ['apyhtest_eva', 'apyhtest_eva.unit02']:
try:
del sys.modules[modname]
except KeyError:
pass
sys.path.remove(str(test_pkg))
request.addfinalizer(cleanup)
return test_pkg
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/ 0000755 0000770 0000024 00000000000 13525230464 023022 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/ 0000755 0000770 0000024 00000000000 13525230464 026342 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/README.md 0000644 0000770 0000024 00000000317 13370623057 027624 0 ustar tom staff 0000000 0000000 This example is to make sure that classes derived from the `abc` module will
have their members listed when ``:inherited-members:`` is not in effect
(https://github.com/astropy/sphinx-automodapi/issues/52).
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/input/ 0000755 0000770 0000024 00000000000 13525230464 027501 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/input/index.rst 0000644 0000770 0000024 00000000110 13370623057 031334 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.abstract_classes
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/output/ 0000755 0000770 0000024 00000000000 13525230464 027702 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/output/api/ 0000755 0000770 0000024 00000000000 13525230464 030453 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000236 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/output/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/output/api/sphinx_automodapi.t0000644 0000770 0000024 00000000752 13370623057 034401 0 ustar tom staff 0000000 0000000 SequenceSubclass
================
.. currentmodule:: sphinx_automodapi.tests.example_module.abstract_classes
.. autoclass:: SequenceSubclass
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~SequenceSubclass.my_property
.. rubric:: Methods Summary
.. autosummary::
~SequenceSubclass.my_method
.. rubric:: Attributes Documentation
.. autoattribute:: my_property
.. rubric:: Methods Documentation
.. automethod:: my_method
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodapi 0000644 0000770 0000024 00000000755 13370623057 033715 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.abstract_classes Module
--------------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.abstract_classes
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.abstract_classes
:classes-only:
:toctree: api
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module.abstract_classes
:private-bases:
:parts: 1
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodsumm 0000644 0000770 0000024 00000000205 13370623057 034113 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.abstract_classes
.. autosummary::
:toctree: api
SequenceSubclass
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/ 0000755 0000770 0000024 00000000000 13525230464 026675 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/README.md 0000644 0000770 0000024 00000000111 13233635533 030147 0 ustar tom staff 0000000 0000000 Documenting a module with classes but excluding a class with inheritance
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/input/ 0000755 0000770 0000024 00000000000 13525230464 030034 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/input/index.rst 0000644 0000770 0000024 00000000116 13233635533 031675 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.classes
:skip: Spam
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/output/ 0000755 0000770 0000024 00000000000 13525230464 030235 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/output/api/ 0000755 0000770 0000024 00000000000 13525230465 031007 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000212 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/output/api/sphinx_automodapi0000644 0000770 0000024 00000000660 13233635533 034470 0 ustar tom staff 0000000 0000000 Egg
===
.. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autoclass:: Egg
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~Egg.weight
.. rubric:: Methods Summary
.. autosummary::
~Egg.buy
~Egg.eat
.. rubric:: Attributes Documentation
.. autoattribute:: weight
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodapi 0000644 0000770 0000024 00000000740 13233635533 034242 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.classes Module
-----------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.classes
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.classes
:classes-only:
:toctree: api
:skip: Spam
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module.classes
:private-bases:
:parts: 1
:skip: Spam
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodsumm0000644 0000770 0000024 00000000157 13233635533 034454 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autosummary::
:toctree: api
Egg
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/ 0000755 0000770 0000024 00000000000 13525230465 027235 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/README.md 0000644 0000770 0000024 00000000151 13233635533 030512 0 ustar tom staff 0000000 0000000 Documenting a module with classes including one that inherits a base class
that isn't in the public API.
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/input/ 0000755 0000770 0000024 00000000000 13525230465 030374 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/input/index.rst 0000644 0000770 0000024 00000000077 13233635533 032242 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.classes
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/ 0000755 0000770 0000024 00000000000 13525230465 030575 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/ 0000755 0000770 0000024 00000000000 13525230465 031346 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000214 00000000000 011212 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automoda0000644 0000770 0000024 00000000660 13233635533 034476 0 ustar tom staff 0000000 0000000 Egg
===
.. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autoclass:: Egg
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~Egg.weight
.. rubric:: Methods Summary
.. autosummary::
~Egg.buy
~Egg.eat
.. rubric:: Attributes Documentation
.. autoattribute:: weight
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
././@LongLink 0000000 0000000 0000000 00000000215 00000000000 011213 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automoda0000644 0000770 0000024 00000000170 13233635533 034472 0 ustar tom staff 0000000 0000000 Spam
====
.. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autoclass:: Spam
:show-inheritance:
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodapi sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodap0000644 0000770 0000024 00000000700 13233635533 034424 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.classes Module
-----------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.classes
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.classes
:classes-only:
:toctree: api
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module.classes
:private-bases:
:parts: 1
././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011217 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodsumm sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodsu0000644 0000770 0000024 00000000170 13233635533 034454 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autosummary::
:toctree: api
Spam
Egg
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/ 0000755 0000770 0000024 00000000000 13525230465 025620 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/README.md 0000644 0000770 0000024 00000000111 13233635533 027071 0 ustar tom staff 0000000 0000000 Documenting a module with functions, and customizing the heading symbols
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/input/ 0000755 0000770 0000024 00000000000 13525230465 026757 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/input/index.rst 0000644 0000770 0000024 00000000123 13233635533 030615 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.functions
:headings: *&^
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/ 0000755 0000770 0000024 00000000000 13525230465 027160 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/api/ 0000755 0000770 0000024 00000000000 13525230465 027731 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000207 00000000000 011214 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/api/sphinx_automodapi.tests.example_module.functions.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/api/sphinx_automodapi.test0000644 0000770 0000024 00000000144 13233635533 034365 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000214 00000000000 011212 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/api/sphinx_automodapi.test0000644 0000770 0000024 00000000163 13233635533 034366 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/index.rst.automodapi 0000644 0000770 0000024 00000000462 13233635533 033165 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.functions Module
*******************************************************
.. automodule:: sphinx_automodapi.tests.example_module.functions
Functions
&&&&&&&&&
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_headings/output/index.rst.automodsumm 0000644 0000770 0000024 00000000213 13525230047 033362 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autosummary::
:toctree: api
add
subtract
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/ 0000755 0000770 0000024 00000000000 13525230465 025772 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/README.md 0000644 0000770 0000024 00000000112 13233635533 027244 0 ustar tom staff 0000000 0000000 Documenting a module with functions, and disabling the top-level headings
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/input/ 0000755 0000770 0000024 00000000000 13525230465 027131 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/input/index.rst 0000644 0000770 0000024 00000000121 13233635533 030765 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.functions
:no-heading:
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/ 0000755 0000770 0000024 00000000000 13525230465 027332 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/api/ 0000755 0000770 0000024 00000000000 13525230465 030103 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011206 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/api/sphinx_automodapi.tests.example_module.functions.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000144 13233635533 034353 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000215 00000000000 011213 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000163 13233635533 034354 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/index.rst.automodapi 0000644 0000770 0000024 00000000300 13233635533 033326 0 ustar tom staff 0000000 0000000 .. automodule:: sphinx_automodapi.tests.example_module.functions
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_noheading/output/index.rst.automodsumm 0000644 0000770 0000024 00000000213 13525230047 033534 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autosummary::
:toctree: api
add
subtract
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/ 0000755 0000770 0000024 00000000000 13525230465 027234 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/README.md 0000644 0000770 0000024 00000000104 13233635533 030507 0 ustar tom staff 0000000 0000000 Documenting a module with functions, excluding the module docstring
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/input/ 0000755 0000770 0000024 00000000000 13525230465 030373 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/input/index.rst 0000644 0000770 0000024 00000000125 13233635533 032233 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.functions
:no-main-docstr:
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/ 0000755 0000770 0000024 00000000000 13525230465 030574 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/ 0000755 0000770 0000024 00000000000 13525230465 031345 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000216 00000000000 011214 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/sphinx_automodapi.tests.example_module.functions.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/sphinx_automoda0000644 0000770 0000024 00000000144 13233635533 034472 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000223 00000000000 011212 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/sphinx_automoda0000644 0000770 0000024 00000000163 13233635533 034473 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: multiply
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/index.rst.automodapi sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/index.rst.automodap0000644 0000770 0000024 00000000362 13233635533 034427 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.functions Module
-------------------------------------------------------
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011217 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/index.rst.automodsumm sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_nomaindocstring/output/index.rst.automodsu0000644 0000770 0000024 00000000213 13525230047 034444 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autosummary::
:toctree: api
add
subtract
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/ 0000755 0000770 0000024 00000000000 13525230465 025327 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/README.md 0000644 0000770 0000024 00000000044 13233635533 026605 0 ustar tom staff 0000000 0000000 Documenting a module with functions
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/input/ 0000755 0000770 0000024 00000000000 13525230465 026466 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/input/index.rst 0000644 0000770 0000024 00000000101 13233635533 030320 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.functions
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/ 0000755 0000770 0000024 00000000000 13525230465 026667 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/api/ 0000755 0000770 0000024 00000000000 13525230465 027440 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000205 00000000000 011212 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/api/sphinx_automodapi.tests.example_module.functions.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/api/sphinx_automodapi.tests.0000644 0000770 0000024 00000000144 13233635533 034335 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000212 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/api/sphinx_automodapi.tests.0000644 0000770 0000024 00000000163 13233635533 034336 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/index.rst.automodapi 0000644 0000770 0000024 00000000462 13233635533 032674 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.functions Module
-------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.functions
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/func_simple/output/index.rst.automodsumm 0000644 0000770 0000024 00000000213 13525230047 033071 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autosummary::
:toctree: api
add
subtract
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/ 0000755 0000770 0000024 00000000000 13525230465 026510 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/README.md 0000644 0000770 0000024 00000000413 13233635533 027766 0 ustar tom staff 0000000 0000000 This example is to make sure that when there are multiple automodapi calls and
only one has inherited-members, it applies only to that one (this is a regression
test for a bug that causes a single inherited-members option to apply to all
subsequent automodapi calls)
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/input/ 0000755 0000770 0000024 00000000000 13525230465 027647 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/input/index.rst 0000644 0000770 0000024 00000000234 13233635533 031510 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.classes
:inherited-members:
.. automodapi:: sphinx_automodapi.tests.example_module.other_classes
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/ 0000755 0000770 0000024 00000000000 13525230465 030050 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/ 0000755 0000770 0000024 00000000000 13525230465 030621 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000211 00000000000 011207 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.0000644 0000770 0000024 00000000660 13233635533 034360 0 ustar tom staff 0000000 0000000 Egg
===
.. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autoclass:: Egg
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~Egg.weight
.. rubric:: Methods Summary
.. autosummary::
~Egg.buy
~Egg.eat
.. rubric:: Attributes Documentation
.. autoattribute:: weight
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
././@LongLink 0000000 0000000 0000000 00000000212 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.0000644 0000770 0000024 00000000443 13233635533 034357 0 ustar tom staff 0000000 0000000 Spam
====
.. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autoclass:: Spam
:show-inheritance:
.. rubric:: Methods Summary
.. autosummary::
~Spam.buy
~Spam.eat
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
././@LongLink 0000000 0000000 0000000 00000000217 00000000000 011215 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.0000644 0000770 0000024 00000000376 13233635533 034364 0 ustar tom staff 0000000 0000000 Foo
===
.. currentmodule:: sphinx_automodapi.tests.example_module.other_classes
.. autoclass:: Foo
:show-inheritance:
.. rubric:: Methods Summary
.. autosummary::
~Foo.hmm
.. rubric:: Methods Documentation
.. automethod:: hmm
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodapi 0000644 0000770 0000024 00000001670 13233635533 034057 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.classes Module
-----------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.classes
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.classes
:classes-only:
:toctree: api
:inherited-members:
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module.classes
:private-bases:
:parts: 1
sphinx_automodapi.tests.example_module.other_classes Module
-----------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.other_classes
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.other_classes
:classes-only:
:toctree: api
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module.other_classes
:private-bases:
:parts: 1
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodsumm 0000644 0000770 0000024 00000000405 13233635533 034262 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.classes
.. autosummary::
:toctree: api
:inherited-members:
Spam
Egg
.. currentmodule:: sphinx_automodapi.tests.example_module.other_classes
.. autosummary::
:toctree: api
Foo
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/ 0000755 0000770 0000024 00000000000 13525230465 026043 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/README.md 0000644 0000770 0000024 00000000235 13233635533 027323 0 ustar tom staff 0000000 0000000 Documenting a module with classes and functions that are imported from other
files, and with an inheritance diagram (which then requires the smart_resolver)
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/input/ 0000755 0000770 0000024 00000000000 13525230465 027202 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/input/index.rst 0000644 0000770 0000024 00000000067 13233635533 031047 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/ 0000755 0000770 0000024 00000000000 13525230465 027403 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/ 0000755 0000770 0000024 00000000000 13525230465 030154 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011221 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Egg.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000650 13233635533 034426 0 ustar tom staff 0000000 0000000 Egg
===
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autoclass:: Egg
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~Egg.weight
.. rubric:: Methods Summary
.. autosummary::
~Egg.buy
~Egg.eat
.. rubric:: Attributes Documentation
.. autoattribute:: weight
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
././@LongLink 0000000 0000000 0000000 00000000177 00000000000 011222 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Spam.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000160 13233635533 034422 0 ustar tom staff 0000000 0000000 Spam
====
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autoclass:: Spam
:show-inheritance:
././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011221 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000132 13233635533 034421 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000203 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000151 13233635533 034422 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodapi 0000644 0000770 0000024 00000001017 13233635533 033405 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module Package
----------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:functions-only:
:toctree: api
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:classes-only:
:toctree: api
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module
:private-bases:
:parts: 1
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodsumm 0000644 0000770 0000024 00000000361 13525230047 033611 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
add
multiply
subtract
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
Egg
Spam
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/ 0000755 0000770 0000024 00000000000 13525230465 030404 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/README.md 0000644 0000770 0000024 00000000252 13233635533 031663 0 ustar tom staff 0000000 0000000 Documenting a module with classes, functions, and variables that are
imported from other files, and with an inheritance diagram (which then
requires the smart_resolver).
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/input/ 0000755 0000770 0000024 00000000000 13525230465 031543 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/input/index.rst 0000644 0000770 0000024 00000000121 13233635533 033377 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module
:include-all-objects:
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/ 0000755 0000770 0000024 00000000000 13525230465 031744 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/ 0000755 0000770 0000024 00000000000 13525230465 032515 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000212 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Egg.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_au0000644 0000770 0000024 00000000650 13233635533 034440 0 ustar tom staff 0000000 0000000 Egg
===
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autoclass:: Egg
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~Egg.weight
.. rubric:: Methods Summary
.. autosummary::
~Egg.buy
~Egg.eat
.. rubric:: Attributes Documentation
.. autoattribute:: weight
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
././@LongLink 0000000 0000000 0000000 00000000227 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_au0000644 0000770 0000024 00000000175 13233635533 034442 0 ustar tom staff 0000000 0000000 FUNNY_WALK_STEPS
================
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autodata:: FUNNY_WALK_STEPS
././@LongLink 0000000 0000000 0000000 00000000223 00000000000 011212 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_au0000644 0000770 0000024 00000000161 13233635533 034435 0 ustar tom staff 0000000 0000000 PARROT_STATE
============
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autodata:: PARROT_STATE
././@LongLink 0000000 0000000 0000000 00000000213 00000000000 011211 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Spam.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_au0000644 0000770 0000024 00000000160 13233635533 034434 0 ustar tom staff 0000000 0000000 Spam
====
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autoclass:: Spam
:show-inheritance:
././@LongLink 0000000 0000000 0000000 00000000212 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_au0000644 0000770 0000024 00000000132 13233635533 034433 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000217 00000000000 011215 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_au0000644 0000770 0000024 00000000151 13233635533 034434 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autofunction:: multiply
././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011215 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodapi sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.aut0000644 0000770 0000024 00000001204 13233635533 034373 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module Package
----------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:functions-only:
:toctree: api
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:classes-only:
:toctree: api
Variables
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:variables-only:
:toctree: api
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module
:private-bases:
:parts: 1
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodsumm sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.aut0000644 0000770 0000024 00000000566 13525230047 034400 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
add
multiply
subtract
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
Egg
Spam
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
FUNNY_WALK_STEPS
PARROT_STATE
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/ 0000755 0000770 0000024 00000000000 13525230465 030064 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/README.md 0000644 0000770 0000024 00000000123 13233635533 031340 0 ustar tom staff 0000000 0000000 Documenting a module with classes and functions that are imported from
other files
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/input/ 0000755 0000770 0000024 00000000000 13525230465 031223 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/input/index.rst 0000644 0000770 0000024 00000000123 13233635533 033061 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module
:no-inheritance-diagram:
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/ 0000755 0000770 0000024 00000000000 13525230465 031424 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/ 0000755 0000770 0000024 00000000000 13525230465 032175 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011206 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Egg.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_auto0000644 0000770 0000024 00000000650 13233635533 034463 0 ustar tom staff 0000000 0000000 Egg
===
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autoclass:: Egg
:show-inheritance:
.. rubric:: Attributes Summary
.. autosummary::
~Egg.weight
.. rubric:: Methods Summary
.. autosummary::
~Egg.buy
~Egg.eat
.. rubric:: Attributes Documentation
.. autoattribute:: weight
.. rubric:: Methods Documentation
.. automethod:: buy
.. automethod:: eat
././@LongLink 0000000 0000000 0000000 00000000211 00000000000 011207 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Spam.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_auto0000644 0000770 0000024 00000000160 13233635533 034457 0 ustar tom staff 0000000 0000000 Spam
====
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autoclass:: Spam
:show-inheritance:
././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011206 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_auto0000644 0000770 0000024 00000000132 13233635533 034456 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000215 00000000000 011213 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_auto0000644 0000770 0000024 00000000151 13233635533 034457 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autofunction:: multiply
././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011213 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodapi sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.autom0000644 0000770 0000024 00000000573 13233635533 034417 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module Package
----------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:functions-only:
:toctree: api
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module
:classes-only:
:toctree: api
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011214 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodsumm sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.autom0000644 0000770 0000024 00000000361 13525230047 034405 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
add
multiply
subtract
.. currentmodule:: sphinx_automodapi.tests.example_module
.. autosummary::
:toctree: api
Egg
Spam
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/ 0000755 0000770 0000024 00000000000 13525230465 024305 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/README.md 0000644 0000770 0000024 00000000127 13433476531 025570 0 ustar tom staff 0000000 0000000 Documenting a sub-module which is at a different level in the docs than the API folder
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/ 0000755 0000770 0000024 00000000000 13525230465 025444 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/index.rst 0000644 0000770 0000024 00000000074 13433476531 027312 0 ustar tom staff 0000000 0000000 .. toctree::
:maxdepth: 1
tests/example_module/index
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/tests/ 0000755 0000770 0000024 00000000000 13525230464 026605 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/tests/example_module/ 0000755 0000770 0000024 00000000000 13525230465 031606 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/tests/example_module/index.rst 0000644 0000770 0000024 00000000112 13433476531 033445 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.functions_with_ref
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/tests/example_module/references.txt sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/input/tests/example_module/references.tx0000644 0000770 0000024 00000000044 13433476531 034306 0 ustar tom staff 0000000 0000000 .. _astropy: http://www.astropy.org
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/ 0000755 0000770 0000024 00000000000 13525230464 025644 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/api/ 0000755 0000770 0000024 00000000000 13525230465 026416 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000211 00000000000 011207 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/api/sphinx_automodapi.tests.example_module.functions_with_ref.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/api/sphinx_automodapi.tests.examp0000644 0000770 0000024 00000000242 13433476531 034350 0 ustar tom staff 0000000 0000000 .. include:: ../tests/example_module/references.txt
add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions_with_ref
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000216 00000000000 011214 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/api/sphinx_automodapi.tests.example_module.functions_with_ref.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/api/sphinx_automodapi.tests.examp0000644 0000770 0000024 00000000261 13433476531 034351 0 ustar tom staff 0000000 0000000 .. include:: ../tests/example_module/references.txt
multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions_with_ref
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/tests/ 0000755 0000770 0000024 00000000000 13525230464 027006 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/tests/example_module/ 0000755 0000770 0000024 00000000000 13525230465 032007 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011216 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/tests/example_module/index.rst.automodapi sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/tests/example_module/index.rst.au0000644 0000770 0000024 00000000534 13433476531 034262 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.functions_with_ref Module
----------------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.functions_with_ref
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions_with_ref
:functions-only:
:toctree: ../../api
././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011217 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/tests/example_module/index.rst.automodsumm sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/nested/output/tests/example_module/index.rst.au0000644 0000770 0000024 00000000215 13523261201 034240 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions_with_ref
.. autosummary::
:toctree: ../../api
add
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/ 0000755 0000770 0000024 00000000000 13525230465 024765 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/README.md 0000644 0000770 0000024 00000000025 13233635533 026242 0 ustar tom staff 0000000 0000000 Non-ASCII characters
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/input/ 0000755 0000770 0000024 00000000000 13525230465 026124 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/input/index.rst 0000644 0000770 0000024 00000000175 13233635533 027771 0 ustar tom staff 0000000 0000000 Ceçi est un exemple qui inclus des charactères non-ASCII
.. automodapi:: sphinx_automodapi.tests.example_module.functions
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/ 0000755 0000770 0000024 00000000000 13525230465 026325 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/api/ 0000755 0000770 0000024 00000000000 13525230465 027076 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000203 00000000000 011210 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.functions.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.ex0000644 0000770 0000024 00000000144 13233635533 034330 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011206 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.ex0000644 0000770 0000024 00000000163 13233635533 034331 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodapi 0000644 0000770 0000024 00000000556 13233635533 032336 0 ustar tom staff 0000000 0000000 Ceçi est un exemple qui inclus des charactères non-ASCII
sphinx_automodapi.tests.example_module.functions Module
-------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.functions
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm 0000644 0000770 0000024 00000000213 13525230047 032527 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autosummary::
:toctree: api
add
subtract
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/ 0000755 0000770 0000024 00000000000 13525230465 025161 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/README.md 0000644 0000770 0000024 00000000053 13233635533 026437 0 ustar tom staff 0000000 0000000 Documentation is inside a source directory
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/input/ 0000755 0000770 0000024 00000000000 13525230464 026317 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/input/src/ 0000755 0000770 0000024 00000000000 13525230465 027107 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/input/src/index.rst 0000644 0000770 0000024 00000000101 13233635533 030741 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.functions
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/ 0000755 0000770 0000024 00000000000 13525230464 026520 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/ 0000755 0000770 0000024 00000000000 13525230465 027310 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/api/ 0000755 0000770 0000024 00000000000 13525230465 030061 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011206 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/api/sphinx_automodapi.tests.example_module.functions.add.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000144 13233635533 034331 0 ustar tom staff 0000000 0000000 add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: add
././@LongLink 0000000 0000000 0000000 00000000215 00000000000 011213 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/api/sphinx_automodapi.tests.example_module.functions.multiply.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/api/sphinx_automodapi.tes0000644 0000770 0000024 00000000163 13233635533 034332 0 ustar tom staff 0000000 0000000 multiply
========
.. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autofunction:: multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/index.rst.automodapi 0000644 0000770 0000024 00000000462 13233635533 033315 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.functions Module
-------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.functions
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/source_dir/output/src/index.rst.automodsumm 0000644 0000770 0000024 00000000213 13525230047 033512 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.functions
.. autosummary::
:toctree: api
add
subtract
multiply
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/ 0000755 0000770 0000024 00000000000 13525230465 024773 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/README.md 0000644 0000770 0000024 00000000053 13233635533 026251 0 ustar tom staff 0000000 0000000 Documenting a module with global variables
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/input/ 0000755 0000770 0000024 00000000000 13525230465 026132 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/input/index.rst 0000644 0000770 0000024 00000000133 13233635533 027771 0 ustar tom staff 0000000 0000000 .. automodapi:: sphinx_automodapi.tests.example_module.variables
:include-all-objects:
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/ 0000755 0000770 0000024 00000000000 13525230465 026333 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/api/ 0000755 0000770 0000024 00000000000 13525230465 027104 5 ustar tom staff 0000000 0000000 ././@LongLink 0000000 0000000 0000000 00000000220 00000000000 011207 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/api/sphinx_automodapi.tests.example_module.variables.FUNNY_WALK_STEPS.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/api/sphinx_automodapi.tests.ex0000644 0000770 0000024 00000000207 13233635533 034336 0 ustar tom staff 0000000 0000000 FUNNY_WALK_STEPS
================
.. currentmodule:: sphinx_automodapi.tests.example_module.variables
.. autodata:: FUNNY_WALK_STEPS
././@LongLink 0000000 0000000 0000000 00000000214 00000000000 011212 L ustar 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/api/sphinx_automodapi.tests.example_module.variables.PARROT_STATE.rst sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/api/sphinx_automodapi.tests.ex0000644 0000770 0000024 00000000173 13233635533 034340 0 ustar tom staff 0000000 0000000 PARROT_STATE
============
.. currentmodule:: sphinx_automodapi.tests.example_module.variables
.. autodata:: PARROT_STATE
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/index.rst.automodapi 0000644 0000770 0000024 00000000462 13233635533 032340 0 ustar tom staff 0000000 0000000
sphinx_automodapi.tests.example_module.variables Module
-------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.variables
Variables
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.variables
:variables-only:
:toctree: api
sphinx-automodapi-0.12/sphinx_automodapi/tests/cases/variables/output/index.rst.automodsumm 0000644 0000770 0000024 00000000217 13233635533 032546 0 ustar tom staff 0000000 0000000 .. currentmodule:: sphinx_automodapi.tests.example_module.variables
.. autosummary::
:toctree: api
PARROT_STATE
FUNNY_WALK_STEPS
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/ 0000755 0000770 0000024 00000000000 13525230465 024725 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/__init__.py 0000644 0000770 0000024 00000000141 13525230047 027026 0 ustar tom staff 0000000 0000000 from .classes import * # noqa
from .functions import * # noqa
from .variables import * # noqa
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/abstract_classes.py 0000644 0000770 0000024 00000001601 13370623057 030616 0 ustar tom staff 0000000 0000000 try:
# Python 3
from collections.abc import Sequence
except ImportError:
# Python 2 (this import also works in Python <= 3.7, but will be removed in
# Python 3.8)
from collections import Sequence
__all__ = ['SequenceSubclass']
class SequenceSubclass(Sequence):
"""
Inherits from an ABC.
"""
def __init__(self):
self._items = []
def __len__(self):
"""
Must be defined for the collections.abc.Sequence base class.
"""
return len(self._items)
def __getitem__(self, key):
"""
Must be defined for the collections.abc.Sequence base class.
"""
return self._items[key]
def my_method(self, parameter):
"""
An example method.
"""
pass
@property
def my_property(self):
"""
An example property.
"""
return 42
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/classes.py 0000644 0000770 0000024 00000001327 13233635533 026740 0 ustar tom staff 0000000 0000000 __all__ = ['Spam', 'Egg']
class BaseSpam(object):
"""
Base class for Spam
"""
def eat(self, time):
"""
Eat some spam in the required time.
"""
pass
def buy(self, price):
"""
Buy some MOAR spam.
"""
pass
class Spam(BaseSpam):
"""
The main spam
"""
pass
class Egg(object):
"""
An egg (no inheritance)
"""
def eat(self, time):
"""
Eat some egg in the required time.
"""
pass
def buy(self, price):
"""
Buy some MOAR egg.
"""
pass
@property
def weight(self):
"""
The weight of an egg
"""
return 0
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/functions.py 0000644 0000770 0000024 00000000472 13525230047 027306 0 ustar tom staff 0000000 0000000 """
A collection of useful functions
"""
__all__ = ['add', 'subtract', 'multiply']
def add(a, b):
"""
Add two numbers
"""
return a + b
def subtract(a, b):
"""
Subtract two numbers
"""
return a - b
def multiply(c, d):
"""
Multiply two numbers
"""
return c * d
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/functions_with_ref.py 0000644 0000770 0000024 00000000466 13433476531 031210 0 ustar tom staff 0000000 0000000 """
A collection of useful functions
"""
__all__ = ['add', 'multiply']
def add(a, b):
"""
Add two numbers
Here is an example reference: astropy_
"""
return a + b
def multiply(c, d):
"""
Multiply two numbers
Here is an example reference: astropy_
"""
return c * d
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/mixed.py 0000644 0000770 0000024 00000000505 13525230047 026401 0 ustar tom staff 0000000 0000000 """
A collection of useful classes and functions
"""
__all__ = ['add', 'MixedSpam']
def add(a, b):
"""
Add two numbers
"""
return a + b
class MixedSpam(object):
"""
Special spam
"""
def eat(self, time):
"""
Eat special spam in the required time.
"""
pass
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/other_classes.py 0000644 0000770 0000024 00000000424 13233635533 030136 0 ustar tom staff 0000000 0000000 __all__ = ['Foo']
class BaseFoo(object):
"""
Base class for Foo
"""
def bar(self, time):
"""
Eat some spam in the required time.
"""
pass
class Foo(BaseFoo):
"""
The main foo
"""
def hmm(self):
pass
sphinx-automodapi-0.12/sphinx_automodapi/tests/example_module/variables.py 0000644 0000770 0000024 00000000764 13233635533 027257 0 ustar tom staff 0000000 0000000 """
A collection of useful variables.
"""
__all__ = ['PARROT_STATE', 'FUNNY_WALK_STEPS']
PARROT_STATE = 'dead'
"""The global state of the parrot."""
FUNNY_WALK_STEPS = [['left', 'right'],
['left', 'jump', 'right', 'jump'],
['swim']]
"""List of different possible walk.
Each item contains a list of steps.
"""
# A variable not in __all__ should not be propagated.
NOTHING_HAPPENS = 0
# Even if it has a docstring
REALLY_NOTHING = 1
"""Really nothing."""
sphinx-automodapi-0.12/sphinx_automodapi/tests/helpers.py 0000644 0000770 0000024 00000003107 13525230047 023736 0 ustar tom staff 0000000 0000000 # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import sys
from copy import deepcopy
from sphinx.cmd.build import build_main
from . import cython_testpackage # noqa
__all__ = ['write_conf', 'run_sphinx_in_tmpdir']
intersphinx_mapping = {
'python': ('https://docs.python.org/{0}/'.format(sys.version_info[0]), None)
}
DEFAULT_CONF = {'source_suffix': '.rst',
'master_doc': 'index',
'nitpicky': True,
'extensions': ['sphinx.ext.intersphinx', 'sphinx_automodapi.automodapi'],
'suppress_warnings': ['app.add_directive', 'app.add_node'],
'intersphinx_mapping': intersphinx_mapping,
'automodapi_toctreedirnm': 'api',
'automodapi_writereprocessed': True,
'automodapi_inheritance_diagram': True,
'automodsumm_writereprocessed': True}
def write_conf(filename, conf):
with open(filename, 'w') as f:
for key, value in conf.items():
f.write("{0} = {1}\n".format(key, repr(conf[key])))
def run_sphinx_in_tmpdir(tmpdir, additional_conf={}, expect_error=False):
start_dir = os.path.abspath('.')
conf = deepcopy(DEFAULT_CONF)
conf.update(additional_conf)
write_conf(tmpdir.join('conf.py').strpath, conf)
argv = ['-W', '-b', 'html', '.', '_build/html']
try:
os.chdir(tmpdir.strpath)
status = build_main(argv=argv)
finally:
os.chdir(start_dir)
if expect_error:
assert status != 0
else:
assert status == 0
sphinx-automodapi-0.12/sphinx_automodapi/tests/test_autodoc_enhancements.py 0000644 0000770 0000024 00000003244 13525230047 027523 0 ustar tom staff 0000000 0000000 import sys
from textwrap import dedent
import pytest
from ..autodoc_enhancements import type_object_attrgetter
# Define test classes outside the class; otherwise there is flakiness with the
# details of how exec works on different Python versions
class Meta(type):
@property
def foo(cls):
return 'foo'
if sys.version_info[0] < 3:
exec(dedent("""
class MyClass(object):
__metaclass__ = Meta
@property
def foo(self):
\"\"\"Docstring for MyClass.foo property.\"\"\"
return 'myfoo'
"""))
else:
exec(dedent("""
class MyClass(metaclass=Meta):
@property
def foo(self):
\"\"\"Docstring for MyClass.foo property.\"\"\"
return 'myfoo'
"""))
def test_type_attrgetter():
"""
This test essentially reproduces the docstring for
`type_object_attrgetter`.
Sphinx itself tests the custom attrgetter feature; see:
https://bitbucket.org/birkenfeld/sphinx/src/40bd03003ac6fe274ccf3c80d7727509e00a69ea/tests/test_autodoc.py?at=default#cl-502
so rather than a full end-to-end functional test it's simple enough to just
test that this function does what it needs to do.
"""
assert getattr(MyClass, 'foo') == 'foo'
obj = type_object_attrgetter(MyClass, 'foo')
assert isinstance(obj, property)
assert obj.__doc__ == 'Docstring for MyClass.foo property.'
with pytest.raises(AttributeError):
type_object_attrgetter(MyClass, 'susy')
assert type_object_attrgetter(MyClass, 'susy', 'default') == 'default'
assert type_object_attrgetter(MyClass, '__dict__') == MyClass.__dict__
sphinx-automodapi-0.12/sphinx_automodapi/tests/test_automodapi.py 0000644 0000770 0000024 00000020632 13525230047 025477 0 ustar tom staff 0000000 0000000 # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
from copy import copy
import pytest
from docutils.parsers.rst import directives, roles
from . import cython_testpackage # noqa
from .helpers import run_sphinx_in_tmpdir
if sys.version_info[0] == 2:
from io import open as io_open
else:
io_open = open
def setup_function(func):
# This can be replaced with the docutils_namespace context manager once
# it is in a stable release of Sphinx
func._directives = copy(directives._directives)
func._roles = copy(roles._roles)
def teardown_function(func):
directives._directives = func._directives
roles._roles = func._roles
am_replacer_str = """
This comes before
.. automodapi:: sphinx_automodapi.tests.example_module.mixed
{options}
This comes after
"""
am_replacer_basic_expected = """
This comes before
sphinx_automodapi.tests.example_module.mixed Module
---------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.mixed
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
:functions-only:
:toctree: api
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
:classes-only:
:toctree: api
Class Inheritance Diagram
^^^^^^^^^^^^^^^^^^^^^^^^^
.. automod-diagram:: sphinx_automodapi.tests.example_module.mixed
:private-bases:
:parts: 1
This comes after
"""
def test_am_replacer_basic(tmpdir):
"""
Tests replacing an ".. automodapi::" with the automodapi no-option
template
"""
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_str.format(options=''))
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodapi').strpath) as f:
result = f.read()
assert result == am_replacer_basic_expected
am_replacer_repr_str = u"""
This comes before with spéciàl çhars
.. automodapi:: sphinx_automodapi.tests.example_module.mixed
{options}
This comes after
"""
@pytest.mark.parametrize('writereprocessed', [False, True])
def test_am_replacer_writereprocessed(tmpdir, writereprocessed):
"""
Tests the automodapi_writereprocessed option
"""
with io_open(tmpdir.join('index.rst').strpath, 'w', encoding='utf-8') as f:
f.write(am_replacer_repr_str.format(options=''))
run_sphinx_in_tmpdir(tmpdir, additional_conf={'automodapi_writereprocessed': writereprocessed})
assert tmpdir.join('index.rst.automodapi').isfile() is writereprocessed
am_replacer_noinh_expected = """
This comes before
sphinx_automodapi.tests.example_module.mixed Module
---------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.mixed
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
:functions-only:
:toctree: api
Classes
^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
:classes-only:
:toctree: api
This comes after
""".format(empty='')
def test_am_replacer_noinh(tmpdir):
"""
Tests replacing an ".. automodapi::" with no-inheritance-diagram
option
"""
ops = ['', ':no-inheritance-diagram:']
ostr = '\n '.join(ops)
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_str.format(options=ostr))
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodapi').strpath) as f:
result = f.read()
assert result == am_replacer_noinh_expected
am_replacer_titleandhdrs_expected = """
This comes before
sphinx_automodapi.tests.example_module.mixed Module
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
.. automodule:: sphinx_automodapi.tests.example_module.mixed
Functions
*********
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
:functions-only:
:toctree: api
Classes
*******
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
:classes-only:
:toctree: api
Class Inheritance Diagram
*************************
.. automod-diagram:: sphinx_automodapi.tests.example_module.mixed
:private-bases:
:parts: 1
This comes after
"""
def test_am_replacer_titleandhdrs(tmpdir):
"""
Tests replacing an ".. automodapi::" entry with title-setting and header
character options.
"""
ops = ['', ':headings: &*']
ostr = '\n '.join(ops)
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_str.format(options=ostr))
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodapi').strpath) as f:
result = f.read()
assert result == am_replacer_titleandhdrs_expected
def test_am_replacer_titleandhdrs_invalid(tmpdir, capsys):
"""
Tests replacing an ".. automodapi::" entry with title-setting and header
character options.
"""
ops = ['', ':headings: &']
ostr = '\n '.join(ops)
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_str.format(options=ostr))
run_sphinx_in_tmpdir(tmpdir, expect_error=True)
stdout, stderr = capsys.readouterr()
assert "Not enough headings (got 1, need 2), using default -^" in stderr
am_replacer_nomain_str = """
This comes before
.. automodapi:: sphinx_automodapi.tests.example_module.functions
:no-main-docstr:
This comes after
"""
am_replacer_nomain_expected = """
This comes before
sphinx_automodapi.tests.example_module.functions Module
-------------------------------------------------------
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
This comes after
""".format(empty='')
def test_am_replacer_nomain(tmpdir):
"""
Tests replacing an ".. automodapi::" with "no-main-docstring" .
"""
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_nomain_str.format(options=''))
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodapi').strpath) as f:
result = f.read()
assert result == am_replacer_nomain_expected
am_replacer_skip_str = """
This comes before
.. automodapi:: sphinx_automodapi.tests.example_module.functions
:skip: add
:skip: subtract
This comes after
"""
am_replacer_skip_expected = """
This comes before
sphinx_automodapi.tests.example_module.functions Module
-------------------------------------------------------
.. automodule:: sphinx_automodapi.tests.example_module.functions
Functions
^^^^^^^^^
.. automodsumm:: sphinx_automodapi.tests.example_module.functions
:functions-only:
:toctree: api
:skip: add,subtract
This comes after
""".format(empty='')
def test_am_replacer_skip(tmpdir):
"""
Tests using the ":skip: option in an ".. automodapi::" .
"""
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_skip_str.format(options=''))
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodapi').strpath) as f:
result = f.read()
assert result == am_replacer_skip_expected
am_replacer_invalidop_str = """
This comes before
.. automodapi:: sphinx_automodapi.tests.example_module.functions
:invalid-option:
This comes after
"""
def test_am_replacer_invalidop(tmpdir, capsys):
"""
Tests that a sphinx warning is produced with an invalid option.
"""
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_invalidop_str.format(options=''))
run_sphinx_in_tmpdir(tmpdir, expect_error=True)
stdout, stderr = capsys.readouterr()
assert "Found additional options invalid-option in automodapi." in stderr
am_replacer_cython_str = """
This comes before
.. automodapi:: apyhtest_eva.unit02
{options}
This comes after
"""
am_replacer_cython_expected = """
This comes before
apyhtest_eva.unit02 Module
--------------------------
.. automodule:: apyhtest_eva.unit02
Functions
^^^^^^^^^
.. automodsumm:: apyhtest_eva.unit02
:functions-only:
:toctree: api
This comes after
""".format(empty='')
def test_am_replacer_cython(tmpdir, cython_testpackage): # noqa
"""
Tests replacing an ".. automodapi::" for a Cython module.
"""
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(am_replacer_cython_str.format(options=''))
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodapi').strpath) as f:
result = f.read()
assert result == am_replacer_cython_expected
sphinx-automodapi-0.12/sphinx_automodapi/tests/test_automodsumm.py 0000644 0000770 0000024 00000006162 13525230047 025711 0 ustar tom staff 0000000 0000000 # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import copy
from docutils.parsers.rst import directives, roles
from . import cython_testpackage # noqa
from .helpers import run_sphinx_in_tmpdir
def setup_function(func):
# This can be replaced with the docutils_namespace context manager once
# it is in a stable release of Sphinx
func._directives = copy(directives._directives)
func._roles = copy(roles._roles)
def teardown_function(func):
directives._directives = func._directives
roles._roles = func._roles
# nosignatures
ADD_RST = """
:orphan:
add
===
.. currentmodule:: sphinx_automodapi.tests.example_module.mixed
.. autofunction:: add
""".strip()
MIXEDSPAM_RST = """
:orphan:
MixedSpam
=========
.. currentmodule:: sphinx_automodapi.tests.example_module.mixed
.. autoclass:: MixedSpam
:show-inheritance:
""".strip()
def write_api_files_to_tmpdir(tmpdir):
apidir = tmpdir.mkdir('api')
with open(apidir.join('sphinx_automodapi.tests.example_module.mixed.add.rst').strpath, 'w') as f:
f.write(ADD_RST)
with open(apidir.join('sphinx_automodapi.tests.example_module.mixed.MixedSpam.rst').strpath, 'w') as f:
f.write(MIXEDSPAM_RST)
ams_to_asmry_str = """
Before
.. automodsumm:: sphinx_automodapi.tests.example_module.mixed
{options}
And After
"""
ams_to_asmry_expected = """\
.. currentmodule:: sphinx_automodapi.tests.example_module.mixed
.. autosummary::
add
MixedSpam
"""
def test_ams_to_asmry(tmpdir):
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(ams_to_asmry_str.format(options=''))
write_api_files_to_tmpdir(tmpdir)
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodsumm').strpath) as f:
result = f.read()
assert result == ams_to_asmry_expected
def test_too_many_options(tmpdir, capsys):
ops = ['', ':classes-only:', ':functions-only:']
ostr = '\n '.join(ops)
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(ams_to_asmry_str.format(options=ostr))
write_api_files_to_tmpdir(tmpdir)
run_sphinx_in_tmpdir(tmpdir, expect_error=True)
stdout, stderr = capsys.readouterr()
assert ("[automodsumm] Defined more than one of functions-only, "
"classes-only, and variables-only. Skipping this directive." in stderr)
PILOT_RST = """
:orphan:
pilot
=====
.. currentmodule:: apyhtest_eva.unit02
.. autofunction:: pilot
""".strip()
ams_cython_str = """
Before
.. automodsumm:: apyhtest_eva.unit02
:functions-only:
And After
"""
ams_cython_expected = """\
.. currentmodule:: apyhtest_eva.unit02
.. autosummary::
pilot
"""
def test_ams_cython(tmpdir, cython_testpackage): # noqa
with open(tmpdir.join('index.rst').strpath, 'w') as f:
f.write(ams_cython_str)
apidir = tmpdir.mkdir('api')
with open(apidir.join('apyhtest_eva.unit02.pilot.rst').strpath, 'w') as f:
f.write(PILOT_RST)
run_sphinx_in_tmpdir(tmpdir)
with open(tmpdir.join('index.rst.automodsumm').strpath) as f:
result = f.read()
assert result == ams_cython_expected
sphinx-automodapi-0.12/sphinx_automodapi/tests/test_cases.py 0000644 0000770 0000024 00000010454 13525230047 024434 0 ustar tom staff 0000000 0000000 # The following tests use a plain Python example module that is at
# sphinx_automodapi.tests.example_module.
# We store different cases in the cases sub-directory of the tests directory
import os
import io
import sys
import glob
import shutil
from itertools import product
import pytest
from copy import deepcopy, copy
from sphinx.util.osutil import ensuredir
from docutils.parsers.rst import directives, roles
from .helpers import build_main, write_conf
CASES_ROOT = os.path.join(os.path.dirname(__file__), 'cases')
CASES_DIRS = glob.glob(os.path.join(CASES_ROOT, '*'))
PARALLEL = {False, True}
intersphinx_mapping = {
'python': ('https://docs.python.org/{0}/'.format(sys.version_info[0]), None)
}
DEFAULT_CONF = {'source_suffix': '.rst',
'master_doc': 'index',
'nitpicky': True,
'extensions': ['sphinx.ext.intersphinx', 'sphinx_automodapi.automodapi'],
'suppress_warnings': ['app.add_directive', 'app.add_node'],
'intersphinx_mapping': intersphinx_mapping,
'nitpick_ignore': [('py:class', 'sphinx_automodapi.tests.example_module.classes.BaseSpam'),
('py:class', 'sphinx_automodapi.tests.example_module.other_classes.BaseFoo'),
# See the following links for why these classes need to be ignored.
# This only seems to be necessary for Python 2.7.
#
# https://trac.sagemath.org/ticket/19211
# https://stackoverflow.com/q/11417221/3776794
('py:class', '_abcoll.Sequence'),
('py:class', '_abcoll.Iterable'),
('py:class', '_abcoll.Container'),
('py:class', '_abcoll.Sized')]}
def setup_function(func):
# This can be replaced with the docutils_namespace context manager once
# it is in a stable release of Sphinx
func._directives = copy(directives._directives)
func._roles = copy(roles._roles)
def teardown_function(func):
directives._directives = func._directives
roles._roles = func._roles
@pytest.mark.parametrize(('case_dir', 'parallel'), product(CASES_DIRS, PARALLEL))
def test_run_full_case(tmpdir, case_dir, parallel):
input_dir = os.path.join(case_dir, 'input')
output_dir = os.path.join(case_dir, 'output')
docs_dir = tmpdir.mkdir('docs').strpath
conf = deepcopy(DEFAULT_CONF)
conf.update({'automodapi_toctreedirnm': 'api',
'automodapi_writereprocessed': True,
'automodsumm_writereprocessed': True})
if os.path.basename(case_dir) in ('mixed_toplevel',
'mixed_toplevel_all_objects'):
conf['extensions'].append('sphinx_automodapi.smart_resolver')
start_dir = os.path.abspath('.')
src_dir = 'src' if 'source_dir' in case_dir else '.'
ensuredir(os.path.join(docs_dir, src_dir))
write_conf(os.path.join(os.path.join(docs_dir, src_dir), 'conf.py'), conf)
for root, dirnames, filenames in os.walk(input_dir):
for filename in filenames:
root_dir = os.path.join(docs_dir, os.path.relpath(root, input_dir))
ensuredir(root_dir)
input_file = os.path.join(root, filename)
shutil.copy(input_file, root_dir)
argv = ['-W', '-b', 'html', src_dir, '_build/html']
if parallel:
argv.insert(0, '-j 4')
try:
os.chdir(docs_dir)
status = build_main(argv=argv)
finally:
os.chdir(start_dir)
assert status == 0
# Check that all expected output files are there and match the reference files
for root, dirnames, filenames in os.walk(output_dir):
for filename in filenames:
path_reference = os.path.join(root, filename)
path_relative = os.path.relpath(path_reference, output_dir)
path_actual = os.path.join(docs_dir, path_relative)
assert os.path.exists(path_actual)
with io.open(path_actual, encoding='utf8') as f:
actual = f.read()
with io.open(path_reference, encoding='utf8') as f:
reference = f.read()
assert actual.strip() == reference.strip()
sphinx-automodapi-0.12/sphinx_automodapi/tests/test_utils.py 0000644 0000770 0000024 00000001331 13233635533 024475 0 ustar tom staff 0000000 0000000 # namedtuple is needed for find_mod_objs so it can have a non-local module
from collections import namedtuple
from ..utils import find_mod_objs
def test_find_mod_objs():
lnms, fqns, objs = find_mod_objs('sphinx_automodapi')
# just check for astropy.test ... other things might be added, so we
# shouldn't check that it's the only thing
assert lnms == []
lnms, fqns, objs = find_mod_objs(
'sphinx_automodapi.tests.test_utils', onlylocals=False)
assert namedtuple in objs
lnms, fqns, objs = find_mod_objs(
'sphinx_automodapi.tests.test_utils', onlylocals=True)
assert 'namedtuple' not in lnms
assert 'collections.namedtuple' not in fqns
assert namedtuple not in objs
sphinx-automodapi-0.12/sphinx_automodapi/utils.py 0000644 0000770 0000024 00000016230 13525230047 022273 0 ustar tom staff 0000000 0000000 import inspect
import sys
import re
import os
from warnings import warn
from distutils.version import LooseVersion
from sphinx import __version__
from sphinx.ext.autosummary.generate import find_autosummary_in_docstring
__all__ = ['cleanup_whitespace',
'find_mod_objs', 'find_autosummary_in_lines_for_automodsumm']
if sys.version_info[0] >= 3:
def iteritems(dictionary):
return dictionary.items()
else:
def iteritems(dictionary):
return dictionary.iteritems()
# We use \n instead of os.linesep because even on Windows, the generated files
# use \n as the newline character.
SPACE_NEWLINE = ' \n'
SINGLE_NEWLINE = '\n'
DOUBLE_NEWLINE = '\n\n'
TRIPLE_NEWLINE = '\n\n\n'
def cleanup_whitespace(text):
"""
Make sure there are never more than two consecutive newlines, and that
there are no trailing whitespaces.
"""
# Get rid of overall leading/trailing whitespace
text = text.strip() + '\n'
# Get rid of trailing whitespace on each line
while SPACE_NEWLINE in text:
text = text.replace(SPACE_NEWLINE, SINGLE_NEWLINE)
# Avoid too many consecutive newlines
while TRIPLE_NEWLINE in text:
text = text.replace(TRIPLE_NEWLINE, DOUBLE_NEWLINE)
return text
def find_mod_objs(modname, onlylocals=False):
""" Returns all the public attributes of a module referenced by name.
.. note::
The returned list *not* include subpackages or modules of
`modname`,nor does it include private attributes (those that
beginwith '_' or are not in `__all__`).
Parameters
----------
modname : str
The name of the module to search.
onlylocals : bool
If True, only attributes that are either members of `modname` OR one of
its modules or subpackages will be included.
Returns
-------
localnames : list of str
A list of the names of the attributes as they are named in the
module `modname` .
fqnames : list of str
A list of the full qualified names of the attributes (e.g.,
``astropy.utils.misc.find_mod_objs``). For attributes that are
simple variables, this is based on the local name, but for
functions or classes it can be different if they are actually
defined elsewhere and just referenced in `modname`.
objs : list of objects
A list of the actual attributes themselves (in the same order as
the other arguments)
"""
__import__(modname)
mod = sys.modules[modname]
if hasattr(mod, '__all__'):
pkgitems = [(k, mod.__dict__[k]) for k in mod.__all__]
else:
pkgitems = [(k, mod.__dict__[k]) for k in dir(mod) if k[0] != '_']
# filter out modules and pull the names and objs out
ismodule = inspect.ismodule
localnames = [k for k, v in pkgitems if not ismodule(v)]
objs = [v for k, v in pkgitems if not ismodule(v)]
# fully qualified names can be determined from the object's module
fqnames = []
for obj, lnm in zip(objs, localnames):
if hasattr(obj, '__module__') and hasattr(obj, '__name__'):
fqnames.append(obj.__module__ + '.' + obj.__name__)
else:
fqnames.append(modname + '.' + lnm)
if onlylocals:
valids = [fqn.startswith(modname) for fqn in fqnames]
localnames = [e for i, e in enumerate(localnames) if valids[i]]
fqnames = [e for i, e in enumerate(fqnames) if valids[i]]
objs = [e for i, e in enumerate(objs) if valids[i]]
return localnames, fqnames, objs
def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None):
"""Find out what items appear in autosummary:: directives in the
given lines.
Returns a list of (name, toctree, template, inherited_members)
where *name* is a name
of an object and *toctree* the :toctree: path of the corresponding
autosummary directive (relative to the root of the file name),
*template* the value of the :template: option, and *inherited_members*
is the value of the :inherited-members: option.
*toctree*, *template*, and *inherited_members* are ``None`` if the
directive does not have the corresponding options set.
.. note::
This is a slightly modified version of
``sphinx.ext.autosummary.generate.find_autosummary_in_lines``
which recognizes the ``inherited-members`` option.
"""
autosummary_re = re.compile(r'^(\s*)\.\.\s+autosummary::\s*')
automodule_re = re.compile(
r'^\s*\.\.\s+automodule::\s*([A-Za-z0-9_.]+)\s*$')
module_re = re.compile(
r'^\s*\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$')
autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-Z][a-zA-Z0-9_.]*)\s*.*?')
toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$')
template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$')
inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$')
no_inherited_members_arg_re = re.compile(r'^\s+:no-inherited-members:\s*$')
documented = []
toctree = None
template = None
inherited_members = None
current_module = module
in_autosummary = False
base_indent = ""
for line in lines:
if in_autosummary:
m = toctree_arg_re.match(line)
if m:
toctree = m.group(1)
if filename:
toctree = os.path.join(os.path.dirname(filename),
toctree)
continue
m = template_arg_re.match(line)
if m:
template = m.group(1).strip()
continue
m = inherited_members_arg_re.match(line)
if m:
inherited_members = True
continue
m = no_inherited_members_arg_re.match(line)
if m:
inherited_members = False
continue
if line.strip().startswith(':'):
warn(line)
continue # skip options
m = autosummary_item_re.match(line)
if m:
name = m.group(1).strip()
if name.startswith('~'):
name = name[1:]
if current_module and \
not name.startswith(current_module + '.'):
name = "%s.%s" % (current_module, name)
documented.append((name, toctree, template,
inherited_members))
continue
if not line.strip() or line.startswith(base_indent + " "):
continue
in_autosummary = False
m = autosummary_re.match(line)
if m:
in_autosummary = True
base_indent = m.group(1)
toctree = None
template = None
inherited_members = None
continue
m = automodule_re.search(line)
if m:
current_module = m.group(1).strip()
# recurse into the automodule docstring
documented.extend(find_autosummary_in_docstring(
current_module, filename=filename))
continue
m = module_re.match(line)
if m:
current_module = m.group(2)
continue
return documented
sphinx-automodapi-0.12/sphinx_automodapi.egg-info/ 0000755 0000770 0000024 00000000000 13525230464 022254 5 ustar tom staff 0000000 0000000 sphinx-automodapi-0.12/sphinx_automodapi.egg-info/PKG-INFO 0000644 0000770 0000024 00000003717 13525230464 023361 0 ustar tom staff 0000000 0000000 Metadata-Version: 2.1
Name: sphinx-automodapi
Version: 0.12
Summary: Sphinx extension for auto-generating API documentation for entire modules
Home-page: http://astropy.org
Author: The Astropy Developers
Author-email: astropy.team@gmail.com
License: BSD 3-Clause License
Description: |Azure Status| |Coverage Status| |PyPI|
About
=====
This is a Sphinx extension to automatically generate API pages for whole
modules. It was originally developed for the Astropy project but is now
available as a standalone package since it can be used for any other
package. The documentation can be found on
`ReadTheDocs `_.
Running tests
-------------
To run the tests, you can either do::
pytest sphinx_automodapi
or if you have `tox `_ installed::
tox -e test
.. |Azure Status| image:: https://dev.azure.com/astropy-project/sphinx-automodapi/_apis/build/status/astropy.sphinx-automodapi?branchName=master
:target: https://dev.azure.com/astropy-project/sphinx-automodapi/_build/latest?definitionId=2&branchName=master
.. |Coverage Status| image:: https://codecov.io/gh/astropy/sphinx-automodapi/branch/master/graph/badge.svg
:target: https://codecov.io/gh/astropy/sphinx-automodapi
.. |PyPI| image:: https://img.shields.io/pypi/v/sphinx-automodapi.svg
:target: https://pypi.python.org/pypi/sphinx-automodapi
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: BSD License
Provides-Extra: test
sphinx-automodapi-0.12/sphinx_automodapi.egg-info/SOURCES.txt 0000644 0000770 0000024 00000023472 13525230464 024150 0 ustar tom staff 0000000 0000000 .coveragerc
.gitignore
CHANGES.rst
LICENSE.rst
MANIFEST.in
README.rst
azure-pipelines.yml
azure-template.yml
setup.cfg
setup.py
tox.ini
docs/Makefile
docs/automodapi.rst
docs/automodsumm.rst
docs/conf.py
docs/index.rst
sphinx_automodapi/__init__.py
sphinx_automodapi/autodoc_enhancements.py
sphinx_automodapi/automodapi.py
sphinx_automodapi/automodsumm.py
sphinx_automodapi/smart_resolver.py
sphinx_automodapi/utils.py
sphinx_automodapi.egg-info/PKG-INFO
sphinx_automodapi.egg-info/SOURCES.txt
sphinx_automodapi.egg-info/dependency_links.txt
sphinx_automodapi.egg-info/not-zip-safe
sphinx_automodapi.egg-info/requires.txt
sphinx_automodapi.egg-info/top_level.txt
sphinx_automodapi/templates/autosummary_core/base.rst
sphinx_automodapi/templates/autosummary_core/class.rst
sphinx_automodapi/templates/autosummary_core/module.rst
sphinx_automodapi/tests/__init__.py
sphinx_automodapi/tests/helpers.py
sphinx_automodapi/tests/test_autodoc_enhancements.py
sphinx_automodapi/tests/test_automodapi.py
sphinx_automodapi/tests/test_automodsumm.py
sphinx_automodapi/tests/test_cases.py
sphinx_automodapi/tests/test_utils.py
sphinx_automodapi/tests/cases/abstract_classes/README.md
sphinx_automodapi/tests/cases/abstract_classes/input/index.rst
sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodapi
sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/abstract_classes/output/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst
sphinx_automodapi/tests/cases/classes_no_inherit/README.md
sphinx_automodapi/tests/cases/classes_no_inherit/input/index.rst
sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodapi
sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/classes_no_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst
sphinx_automodapi/tests/cases/classes_with_inherit/README.md
sphinx_automodapi/tests/cases/classes_with_inherit/input/index.rst
sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodapi
sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst
sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst
sphinx_automodapi/tests/cases/func_headings/README.md
sphinx_automodapi/tests/cases/func_headings/input/index.rst
sphinx_automodapi/tests/cases/func_headings/output/index.rst.automodapi
sphinx_automodapi/tests/cases/func_headings/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/func_headings/output/api/sphinx_automodapi.tests.example_module.functions.add.rst
sphinx_automodapi/tests/cases/func_headings/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst
sphinx_automodapi/tests/cases/func_noheading/README.md
sphinx_automodapi/tests/cases/func_noheading/input/index.rst
sphinx_automodapi/tests/cases/func_noheading/output/index.rst.automodapi
sphinx_automodapi/tests/cases/func_noheading/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/func_noheading/output/api/sphinx_automodapi.tests.example_module.functions.add.rst
sphinx_automodapi/tests/cases/func_noheading/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst
sphinx_automodapi/tests/cases/func_nomaindocstring/README.md
sphinx_automodapi/tests/cases/func_nomaindocstring/input/index.rst
sphinx_automodapi/tests/cases/func_nomaindocstring/output/index.rst.automodapi
sphinx_automodapi/tests/cases/func_nomaindocstring/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/sphinx_automodapi.tests.example_module.functions.add.rst
sphinx_automodapi/tests/cases/func_nomaindocstring/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst
sphinx_automodapi/tests/cases/func_simple/README.md
sphinx_automodapi/tests/cases/func_simple/input/index.rst
sphinx_automodapi/tests/cases/func_simple/output/index.rst.automodapi
sphinx_automodapi/tests/cases/func_simple/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/func_simple/output/api/sphinx_automodapi.tests.example_module.functions.add.rst
sphinx_automodapi/tests/cases/func_simple/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst
sphinx_automodapi/tests/cases/inherited_members/README.md
sphinx_automodapi/tests/cases/inherited_members/input/index.rst
sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodapi
sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst
sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst
sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst
sphinx_automodapi/tests/cases/mixed_toplevel/README.md
sphinx_automodapi/tests/cases/mixed_toplevel/input/index.rst
sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodapi
sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Egg.rst
sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Spam.rst
sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.add.rst
sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.multiply.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/README.md
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/input/index.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodapi
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Egg.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Spam.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.add.rst
sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.multiply.rst
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/README.md
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/input/index.rst
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodapi
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Egg.rst
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Spam.rst
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.add.rst
sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.multiply.rst
sphinx_automodapi/tests/cases/nested/README.md
sphinx_automodapi/tests/cases/nested/input/index.rst
sphinx_automodapi/tests/cases/nested/input/tests/example_module/index.rst
sphinx_automodapi/tests/cases/nested/input/tests/example_module/references.txt
sphinx_automodapi/tests/cases/nested/output/api/sphinx_automodapi.tests.example_module.functions_with_ref.add.rst
sphinx_automodapi/tests/cases/nested/output/api/sphinx_automodapi.tests.example_module.functions_with_ref.multiply.rst
sphinx_automodapi/tests/cases/nested/output/tests/example_module/index.rst.automodapi
sphinx_automodapi/tests/cases/nested/output/tests/example_module/index.rst.automodsumm
sphinx_automodapi/tests/cases/non_ascii/README.md
sphinx_automodapi/tests/cases/non_ascii/input/index.rst
sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodapi
sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.functions.add.rst
sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.functions.multiply.rst
sphinx_automodapi/tests/cases/source_dir/README.md
sphinx_automodapi/tests/cases/source_dir/input/src/index.rst
sphinx_automodapi/tests/cases/source_dir/output/src/index.rst.automodapi
sphinx_automodapi/tests/cases/source_dir/output/src/index.rst.automodsumm
sphinx_automodapi/tests/cases/source_dir/output/src/api/sphinx_automodapi.tests.example_module.functions.add.rst
sphinx_automodapi/tests/cases/source_dir/output/src/api/sphinx_automodapi.tests.example_module.functions.multiply.rst
sphinx_automodapi/tests/cases/variables/README.md
sphinx_automodapi/tests/cases/variables/input/index.rst
sphinx_automodapi/tests/cases/variables/output/index.rst.automodapi
sphinx_automodapi/tests/cases/variables/output/index.rst.automodsumm
sphinx_automodapi/tests/cases/variables/output/api/sphinx_automodapi.tests.example_module.variables.FUNNY_WALK_STEPS.rst
sphinx_automodapi/tests/cases/variables/output/api/sphinx_automodapi.tests.example_module.variables.PARROT_STATE.rst
sphinx_automodapi/tests/example_module/__init__.py
sphinx_automodapi/tests/example_module/abstract_classes.py
sphinx_automodapi/tests/example_module/classes.py
sphinx_automodapi/tests/example_module/functions.py
sphinx_automodapi/tests/example_module/functions_with_ref.py
sphinx_automodapi/tests/example_module/mixed.py
sphinx_automodapi/tests/example_module/other_classes.py
sphinx_automodapi/tests/example_module/variables.py sphinx-automodapi-0.12/sphinx_automodapi.egg-info/dependency_links.txt 0000644 0000770 0000024 00000000001 13525230464 026322 0 ustar tom staff 0000000 0000000
sphinx-automodapi-0.12/sphinx_automodapi.egg-info/not-zip-safe 0000644 0000770 0000024 00000000001 13525230464 024502 0 ustar tom staff 0000000 0000000
sphinx-automodapi-0.12/sphinx_automodapi.egg-info/requires.txt 0000644 0000770 0000024 00000000076 13525230464 024657 0 ustar tom staff 0000000 0000000 sphinx>=1.7
[test]
pytest
pytest-cov
cython
codecov
coverage
sphinx-automodapi-0.12/sphinx_automodapi.egg-info/top_level.txt 0000644 0000770 0000024 00000000022 13525230464 025000 0 ustar tom staff 0000000 0000000 sphinx_automodapi
sphinx-automodapi-0.12/tox.ini 0000644 0000770 0000024 00000001316 13525230047 016340 0 ustar tom staff 0000000 0000000 [tox]
envlist =
py27-test
py37-test
py27-test-clocale
py37-test-clocale
py27-test-sphinx17
py36-test-sphinx17
py37-test-sphinx18
py37-test-sphinx20
py37-test-sphinxdev
requires = pip >= 18.0
setuptools >= 30.3.0
[testenv]
changedir = .tmp/{envname}
deps =
sphinx17: sphinx==1.7.9
sphinx18: sphinx==1.8.5
sphinx20: sphinx==2.0.1
sphinx21: sphinx==2.1.2
sphinxdev: git+https://github.com/sphinx-doc/sphinx.git
extras =
test: test
commands =
test: pytest --pyargs sphinx_automodapi --cov-append --cov sphinx_automodapi --cov-report=
setenv =
clocale: LC_CTYPE=C
clocale: LC_ALL=C
clocale: LANG=C
platform =
clocale: linux|darwin