Added API reference document

The API reference document is missing so addded it and enabled pep8
check for conf.py.

Change-Id: I04236c5427d7ac624781fbfc920a79f855d8cd75
This commit is contained in:
JUN JIE NAN 2013-12-23 11:16:17 +08:00
parent b6f81d5124
commit 276b1e4ed5
5 changed files with 81 additions and 1 deletions

1
doc/.gitignore vendored
View File

@ -1 +1,2 @@
build/ build/
source/ref/

View File

@ -1,4 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# 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.
# #
# python-heatclient documentation build configuration file, created by # python-heatclient documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 6 14:19:25 2009. # sphinx-quickstart on Sun Dec 6 14:19:25 2009.
@ -19,6 +30,7 @@ import os
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.')) #sys.path.append(os.path.abspath('.'))
execfile(os.path.join("ext", "gen_ref.py"))
# -- General configuration ---------------------------------------------------- # -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be

58
doc/source/ext/gen_ref.py Normal file
View File

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
# 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 os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", "..", ".."))
sys.path.insert(0, ROOT)
sys.path.insert(0, BASE_DIR)
def gen_ref(ver, title, names):
refdir = os.path.join(BASE_DIR, "ref")
pkg = "heatclient"
if ver:
pkg = "%s.%s" % (pkg, ver)
refdir = os.path.join(refdir, ver)
if not os.path.exists(refdir):
os.makedirs(refdir)
idxpath = os.path.join(refdir, "index.rst")
with open(idxpath, "w") as idx:
idx.write(("%(title)s\n"
"%(signs)s\n"
"\n"
".. toctree::\n"
" :maxdepth: 1\n"
"\n") % {"title": title, "signs": "=" * len(title)})
for name in names:
idx.write(" %s\n" % name)
rstpath = os.path.join(refdir, "%s.rst" % name)
with open(rstpath, "w") as rst:
rst.write(("%(title)s\n"
"%(signs)s\n"
"\n"
".. automodule:: %(pkg)s.%(name)s\n"
" :members:\n"
" :undoc-members:\n"
" :show-inheritance:\n"
" :noindex:\n")
% {"title": name.capitalize(),
"signs": "=" * len(name),
"pkg": pkg, "name": name})
gen_ref("", "Client Reference", ["client", "exc"])
gen_ref("v1", "Version 1 API Reference",
["stacks", "resources", "events", "actions"])

View File

@ -20,6 +20,15 @@ Once you have done so, you can use the API like so::
>>> from heatclient.client import Client >>> from heatclient.client import Client
>>> heat = Client('1', endpoint=heat_url, token=auth_token) >>> heat = Client('1', endpoint=heat_url, token=auth_token)
Reference
---------
.. toctree::
:maxdepth: 1
ref/index
ref/v1/index
Command-line Tool Command-line Tool
================= =================

View File

@ -28,4 +28,4 @@ downloadcache = ~/cache/pip
show-source = True show-source = True
ignore = H233,H302 ignore = H233,H302
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build