From 163ddec6cd36a94e99635bc8b5ef5512e07789cc Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Mon, 12 Sep 2016 12:03:41 +0200 Subject: [PATCH] Add simple Sphinx documentation Also fix syntax in get_status call and enforce doc8. Change-Id: I9033c6264bd1ec2755e7d3efaf83e44f96c64e9c --- doc/source/conf.py | 79 +++++++++++++++++++++++++++++++ doc/source/index.rst | 20 ++++++++ ironic_inspector_client/client.py | 1 + setup.cfg | 12 +++++ tox.ini | 9 +++- 5 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 doc/source/conf.py create mode 100644 doc/source/index.rst diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000..f2b5779 --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,79 @@ +# -*- 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.autodoc', + 'sphinx.ext.viewcode', + 'oslosphinx', + ] + +wsme_protocols = ['restjson'] + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Ironic Inspector Client' +copyright = u'OpenStack Foundation' + +# 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. +from ironic_inspector_client import version as il_version +# The full version, including alpha/beta/rc tags. +release = il_version.version_info.release_string() +# The short X.Y version. +version = il_version.version_info.version_string() + +# A list of ignored prefixes for module index sorting. +modindex_common_prefix = ['ironic_inspector_client'] + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = True + +# 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. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +#html_theme_path = ["."] +#html_theme = '_theme' +#html_static_path = ['_static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ( + 'index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', + 'manual' + ), +] diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000..79de035 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,20 @@ +================================== +Welcome to Ironic Inspector Client +================================== + +.. include:: ../../README.rst + +Generated Developer Documentation +================================= + +.. toctree:: + :maxdepth: 1 + + api/autoindex + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/ironic_inspector_client/client.py b/ironic_inspector_client/client.py index 1c0f295..0d9323c 100644 --- a/ironic_inspector_client/client.py +++ b/ironic_inspector_client/client.py @@ -70,6 +70,7 @@ def get_status(uuid, base_url=None, auth_token=None, This function is deprecated. Please use ClientV1.get_status. New in Ironic Inspector version 1.0.0. + :param uuid: node uuid. :param base_url: *Ironic Inspector* URL in form: http://host:port[/ver], defaults to ``http://:5050/v1``. diff --git a/setup.cfg b/setup.cfg index 69ddbc6..707dc73 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,3 +34,15 @@ openstack.baremetal_introspection.v1 = baremetal_introspection_rule_show = ironic_inspector_client.shell:RuleShowCommand baremetal_introspection_rule_delete = ironic_inspector_client.shell:RuleDeleteCommand baremetal_introspection_rule_purge = ironic_inspector_client.shell:RulePurgeCommand + +[pbr] +autodoc_index_modules = True +autodoc_exclude_modules = + ironic_inspector_client.test.* + ironic_inspector_client.common.i18n +warnerrors = True + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source diff --git a/tox.ini b/tox.ini index 57d97ba..63c39fb 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,7 @@ setenv = PYTHONDONTWRITEBYTECODE=1 basepython = python2.7 commands = flake8 ironic_inspector_client - doc8 README.rst + doc8 README.rst doc/source [testenv:func] basepython = python2.7 @@ -34,6 +34,13 @@ commands = {posargs} envdir = {toxworkdir}/venv commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html +[testenv:docs] +setenv = PYTHONHASHSEED=0 +sitepackages = False +envdir = {toxworkdir}/venv +commands = + python setup.py build_sphinx + [flake8] max-complexity=15