From 64211231be02edca60f05e250150c827a55cb019 Mon Sep 17 00:00:00 2001 From: Paul Michali Date: Fri, 4 Dec 2015 19:22:37 +0000 Subject: [PATCH] Setup for devref documentation Setup the docs target for producing documentation, create the needed index files for documentation and devref, and include references to the existing .rst docs. Change-Id: Id2a23058ee5aa557fb52b65f044bac4528ef86bc Implements: blueprint neutron-lib --- doc/source/conf.py | 215 +++++++++++++++++++++++++++++++----- doc/source/devref/index.rst | 55 +++++++++ doc/source/index.rst | 71 ++++++++---- neutron_lib/version.py | 17 +++ tox.ini | 2 +- 5 files changed, 310 insertions(+), 50 deletions(-) create mode 100644 doc/source/devref/index.rst create mode 100644 neutron_lib/version.py diff --git a/doc/source/conf.py b/doc/source/conf.py index 18a1d0509..694c4b945 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,64 +12,223 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Build configuration file that is execfile()'d with the current directory +# set to it's containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + import os import sys -sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +ROOT_DIR = os.path.abspath(os.path.join(BASE_DIR, "..", "..")) +sys.path.insert(0, ROOT_DIR) + +# -- 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.intersphinx', - 'oslosphinx' -] +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.coverage', + 'sphinx.ext.ifconfig', + 'sphinx.ext.pngmath', + 'sphinx.ext.graphviz', + 'sphinx.ext.todo', + 'oslosphinx'] -# 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 +todo_include_todos = True + +# Add any paths that contain templates here, relative to this directory. +templates_path = [] +if os.getenv('HUDSON_PUBLISH_DOCS'): + templates_path = ['_ga', '_templates'] +else: + templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' -# The master toctree document. +# The encoding of source files. +#source_encoding = 'utf-8' + +# The master doctree document. master_doc = 'index' # General information about the project. -project = u'neutron-lib' -copyright = u'2013, OpenStack Foundation' +project = u'Neutron Library' +copyright = u'2015-present, 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. +# +# Version info +from neutron_lib.version import version_info as neutron_lib_version +release = neutron_lib_version.release_string() +# The short X.Y version. +version = neutron_lib_version.version_string() + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +# unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = [] + +# The reST default role (for this markup: `text`) to use for all documents. +#default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True +#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 +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' -# -- Options for HTML output -------------------------------------------------- +# A list of ignored prefixes for module index sorting. +modindex_common_prefix = ['neutron_lib.'] + +# -- Options for man page output -------------------------------------------- + +# Grouping the document tree for man pages. +# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' + +# man_pages = [ +# ('man/neutron-lib', 'neutron-lib', u'Neutron Library', +# [u'OpenStack'], 1) +# ] + + +# -- 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'] + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = ['_theme'] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' +git_cmd = "git log --pretty=format:'%ad, commit %h' --date=local -n1" +html_last_updated_fmt = os.popen(git_cmd).read() + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' # Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +#htmlhelp_basename = 'neutronlibdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' # 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'), -] +# (source start file, target name, title, author, +# documentclass [howto/manual]). +# latex_documents = [ +# ('index', 'NeutronLib.tex', u'Neutron Library Documentation', +# u'Neutron development team', 'manual'), +# ] -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True diff --git a/doc/source/devref/index.rst b/doc/source/devref/index.rst new file mode 100644 index 000000000..a5044fff2 --- /dev/null +++ b/doc/source/devref/index.rst @@ -0,0 +1,55 @@ +.. + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations + under the License. + + Convention for heading levels in Neutron lib devref: + ======= Heading 0 (reserved for the title in a document) + ------- Heading 1 + ~~~~~~~ Heading 2 + +++++++ Heading 3 + ''''''' Heading 4 + (Avoid deeper levels because they do not render well.) + + +Developer Guide +=============== + +In the Developer Guide, you will find information on the Neutron Library +components and in how to use them, from a development standpoint. + + +Neutron Lib Internals +--------------------- +.. toctree:: + :maxdepth: 3 + +.. todo:: + + Add callbacks + + +Module Reference +---------------- +.. toctree:: + :maxdepth: 3 + +.. todo:: + + Add in all the big modules as automodule indexes. + + +Indices and tables +------------------ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/source/index.rst b/doc/source/index.rst index 9b128661d..a28a48767 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,26 +1,55 @@ -.. neutron-lib documentation master file, created by - sphinx-quickstart on Tue Jul 9 22:26:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +.. + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at -Welcome to neutron-lib's documentation! -======================================================== + http://www.apache.org/licenses/LICENSE-2.0 -Contents: + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations + under the License. + +Welcome to Neutron Lib developer documentation! +=============================================== + +Neutron-lib is an OpenStack library project used by Neutron, Advanced Services, +and third-party projects to provide common functionality and remove duplication. + +This document describes the library for contributors of the project, and assumes +that you are already familiar with Neutron from an `end-user perspective`_. + +.. _`end-user perspective`: http://docs.openstack.org/trunk/openstack-network/admin/content/index.html + +This documentation is generated by the Sphinx toolkit and lives in the source +tree. Additional documentation on Neutron and other components of OpenStack +can be found on the `OpenStack wiki`_ and the `Neutron section of the wiki`. +The `Neutron Development wiki`_ is also a good resource for new contributors. + +.. _`OpenStack wiki`: http://wiki.openstack.org +.. _`Neutron section of the wiki`: http://wiki.openstack.org/Neutron +.. _`Neutron Development wiki`: http://wiki.openstack.org/NeutronDevelopment + +Enjoy! + + +Programming HowTos and Tutorials +-------------------------------- +.. toctree:: + :maxdepth: 3 + + readme + installation + usage + review-guidelines + contributing + + +Developer Docs +============== .. toctree:: - :maxdepth: 2 - - readme - installation - usage - contributing - review-guidelines - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + :maxdepth: 1 + devref/index diff --git a/neutron_lib/version.py b/neutron_lib/version.py new file mode 100644 index 000000000..0bd7dfc3c --- /dev/null +++ b/neutron_lib/version.py @@ -0,0 +1,17 @@ +# Copyright 2011 OpenStack Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import pbr.version + +version_info = pbr.version.VersionInfo('neutron-lib') diff --git a/tox.ini b/tox.ini index 8b4e2d51a..1d3ff2bef 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,7 @@ commands = {posargs} commands = python setup.py test --coverage --testr-args='{posargs}' [testenv:docs] -commands = python setup.py build_sphinx +commands = sphinx-build -W -b html doc/source doc/build/html [testenv:debug] commands = oslo_debug_helper {posargs}