Set up Sphinx autodoc

This will automatically generate API documentation from docstrings.
stix2.1
Chris Lenk 2017-09-21 17:27:13 -04:00
parent d54ac6e231
commit d7efd1f752
24 changed files with 113 additions and 10 deletions

View File

@ -0,0 +1,5 @@
{{ name }}
{{ underline }}
.. automodule:: {{ fullname }}
:members:

5
docs/api/stix2.base.rst Normal file
View File

@ -0,0 +1,5 @@
base
==========
.. automodule:: stix2.base
:members:

View File

@ -0,0 +1,5 @@
common
============
.. automodule:: stix2.common
:members:

5
docs/api/stix2.core.rst Normal file
View File

@ -0,0 +1,5 @@
core
==========
.. automodule:: stix2.core
:members:

View File

@ -0,0 +1,5 @@
environment
=================
.. automodule:: stix2.environment
:members:

View File

@ -0,0 +1,5 @@
exceptions
================
.. automodule:: stix2.exceptions
:members:

View File

@ -0,0 +1,5 @@
observables
=================
.. automodule:: stix2.observables
:members:

View File

@ -0,0 +1,5 @@
patterns
==============
.. automodule:: stix2.patterns
:members:

View File

@ -0,0 +1,5 @@
properties
================
.. automodule:: stix2.properties
:members:

5
docs/api/stix2.sdo.rst Normal file
View File

@ -0,0 +1,5 @@
sdo
=========
.. automodule:: stix2.sdo
:members:

5
docs/api/stix2.sro.rst Normal file
View File

@ -0,0 +1,5 @@
sro
=========
.. automodule:: stix2.sro
:members:

5
docs/api/stix2.utils.rst Normal file
View File

@ -0,0 +1,5 @@
utils
===========
.. automodule:: stix2.utils
:members:

7
docs/api_ref.rst Normal file
View File

@ -0,0 +1,7 @@
API Reference
=============
This section of documentation contains information on all of the classes and
functions in the ``stix2`` API, as given by the package's docstrings.
.. automodule:: stix2

View File

@ -1,7 +1,24 @@
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
extensions = [ extensions = [
'sphinx-prompt', 'sphinx-prompt',
'nbsphinx', 'nbsphinx',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
] ]
autodoc_default_flags = [
'show-inheritance',
'undoc-members',
]
autodoc_member_order = 'groupwise'
autosummary_generate = True
napoleon_numpy_docstring = False # Force consistency, leave only Google
napoleon_use_rtype = False
templates_path = ['_templates'] templates_path = ['_templates']
source_suffix = '.rst' source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
@ -14,7 +31,7 @@ version = '0.2.0'
release = '0.2.0' release = '0.2.0'
language = None language = None
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] exclude_patterns = ['_build', '_templates', 'Thumbs.db', '.DS_Store', '.ipynb_checkpoints']
pygments_style = 'sphinx' pygments_style = 'sphinx'
todo_include_todos = False todo_include_todos = False

7
docs/guide.rst Normal file
View File

@ -0,0 +1,7 @@
User's Guide
============
.. toctree::
:glob:
guide/*

View File

@ -7,16 +7,12 @@ Welcome to stix2's documentation!
================================= =================================
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 3
:caption: Contents: :caption: Contents:
overview overview
creating guide
serializing api_ref
parsing
versioning
markings
custom
datastore_api datastore_api
roadmap roadmap
contributing contributing

View File

@ -1,4 +1,20 @@
"""Python APIs for STIX 2.""" """Python APIs for STIX 2.
.. autosummary::
:toctree: api
base
common
core
environment
exceptions
observables
patterns
properties
sdo
sro
utils
"""
# flake8: noqa # flake8: noqa

View File

@ -1,4 +1,4 @@
"""Base class for type definitions in the stix2 library.""" """Base classes for type definitions in the stix2 library."""
import collections import collections
import copy import copy