Skip to content

Commit 1ba346c

Browse files
automatic documentation
1 parent 8ddd91e commit 1ba346c

File tree

14 files changed

+197
-586
lines changed

14 files changed

+197
-586
lines changed

.travis.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
language: python
2+
sudo: false
3+
notifications:
4+
email: false
25
python:
36
- '2.7'
47
- '3.2'
58
- '3.3'
69
- '3.4'
710
- '3.5'
811
- 3.5-dev
12+
before_install:
13+
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_c3e85137836d_key
14+
-iv $encrypted_c3e85137836d_iv -in .env.enc -out .env -d || true'
915
install:
1016
- pip install -r requirements-dev.txt
1117
- pip install pylint
18+
- pip install codecov
1219
- pip install git+git://github.com/watson-developer-cloud/python-sdk.git#egg=watson-developer-cloud
20+
1321
script:
14-
- sh pylint.sh
15-
- coverage run --source=watson_developer_cloud setup.py test
16-
after_success: coveralls
17-
before_install:
18-
- openssl aes-256-cbc -K $encrypted_c3e85137836d_key -iv $encrypted_c3e85137836d_iv
19-
-in .env.enc -out .env -d
22+
- sh pylint.sh
23+
- py.test test --cov=test
24+
after_success:
25+
- codecov
26+
- docs/publish.sh
27+

docs/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
7+
SPHINXAPIDOC = sphinx-apidoc
78
PAPER =
89
BUILDDIR = _build
910

@@ -23,6 +24,7 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
2324

2425
help:
2526
@echo "Please use \`make <target>' where <target> is one of"
27+
@echo " document to make documentation"
2628
@echo " html to make standalone HTML files"
2729
@echo " dirhtml to make HTML files named index.html in directories"
2830
@echo " singlehtml to make a single large HTML file"
@@ -51,6 +53,13 @@ help:
5153
clean:
5254
rm -rf $(BUILDDIR)/*
5355

56+
document:
57+
rm -rf apis
58+
$(SPHINXAPIDOC) -o apis ../watson_developer_cloud -f -e -T
59+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
60+
@echo
61+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
62+
5463
html:
5564
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5665
@echo

docs/_static/favicon.ico

183 Bytes
Binary file not shown.

docs/_templates/sidebarintro.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h3>Useful Links</h3>
2+
<ul>
3+
<li><a href="https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/">Watson APIs</a></li>
4+
<li><a href="http://github.com/watson-developer-cloud/python-sdk">GitHub</a></li>
5+
<li><a href="http://github.com/watson-developer-cloud/python-sdk/issues">Issue Tracker</a></li>
6+
<li><a href="http://stackoverflow.com/questions/ask?tags=ibm-watson">StackOverflow</a></li>
7+
</ul>

docs/conf.py

Lines changed: 47 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,15 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Watson Developer Cloud Python SDK documentation build configuration file, created by
4-
# sphinx-quickstart on Fri Oct 9 00:12:27 2015.
5-
#
6-
# This file is execfile()d with the current directory set to its
7-
# containing dir.
8-
#
9-
# Note that not all possible configuration values are present in this
10-
# autogenerated file.
11-
#
12-
# All configuration values have a default; values that are commented out
13-
# serve to show the default.
142

153
import sys
164
import os
17-
import shlex
18-
19-
sys.path.insert(0, os.path.abspath('..'))
205
import watson_developer_cloud
21-
import os, shutil, glob
22-
23-
import shutil
24-
shutil.copy2('../README.md', './index.md')
25-
266

7+
sys.path.insert(0, os.path.abspath('../watson_developer_cloud/'))
278

289
from recommonmark.parser import CommonMarkParser
2910
source_parsers = {
3011
'.md': CommonMarkParser
3112
}
32-
source_suffix = ['.rst', '.md']
33-
34-
# If extensions (or modules to document with autodoc) are in another directory,
35-
# add these directories to sys.path here. If the directory is relative to the
36-
# documentation root, use os.path.abspath to make it absolute, like shown here.
37-
#sys.path.insert(0, os.path.abspath('.'))
3813

3914
# -- General configuration ------------------------------------------------
4015

@@ -46,22 +21,21 @@
4621
# ones.
4722
extensions = [
4823
'sphinx.ext.autodoc',
49-
'sphinx.ext.autosummary',
50-
'sphinx.ext.doctest',
51-
'sphinx.ext.mathjax',
24+
'sphinx.ext.intersphinx',
25+
'sphinx.ext.ifconfig',
5226
'sphinx.ext.viewcode',
27+
'sphinx.ext.napoleon'
5328
]
5429

30+
autodoc_default_flags = ['members', 'undoc-members', 'no-show-inheritance']
31+
autodoc_member_order = 'bysource'
32+
5533
# Add any paths that contain templates here, relative to this directory.
5634
templates_path = ['_templates']
5735

5836
# The suffix(es) of source filenames.
5937
# You can specify multiple suffix as a list of string:
60-
# source_suffix = ['.rst', '.md']
61-
source_suffix = '.md'
62-
63-
# The encoding of source files.
64-
#source_encoding = 'utf-8-sig'
38+
source_suffix = ['.rst', '.md']
6539

6640
# The master toctree document.
6741
master_doc = 'index'
@@ -71,42 +45,26 @@
7145
copyright = u'2015, IBM Corp'
7246
author = u'IBM Corp'
7347

74-
# The version info for the project you're documenting, acts as replacement for
75-
# |version| and |release|, also used in various other places throughout the
76-
# built documents.
77-
#
78-
# The short X.Y version.
7948
version = watson_developer_cloud.__version__
80-
# The full version, including alpha/beta/rc tags.
8149
release = watson_developer_cloud.__version__
8250

8351
# The language for content autogenerated by Sphinx. Refer to documentation
8452
# for a list of supported languages.
85-
#
86-
# This is also used if you do content translation via gettext catalogs.
87-
# Usually you set "language" from the command line for these cases.
8853
language = None
8954

90-
# There are two options for replacing |today|: either, you set today to some
91-
# non-false value, then it is used:
92-
#today = ''
93-
# Else, today_fmt is used as the format for a strftime call.
94-
#today_fmt = '%B %d, %Y'
95-
9655
# List of patterns, relative to source directory, that match files and
9756
# directories to ignore when looking for source files.
98-
exclude_patterns = ['_build']
99-
100-
# The reST default role (used for this markup: `text`) to use for all
101-
# documents.
102-
#default_role = None
57+
exclude_patterns = ['_build', '_templates',
58+
'apis/modules.rst','apis/watson_developer_cloud.rst',
59+
'apis/watson_developer_cloud.version.rst',
60+
'apis/watson_developer_cloud.watson_developer_cloud_service.rst']
10361

10462
# If true, '()' will be appended to :func: etc. cross-reference text.
105-
#add_function_parentheses = True
63+
add_function_parentheses = False
10664

10765
# If true, the current module name will be prepended to all description
10866
# unit titles (such as .. function::).
109-
#add_module_names = True
67+
add_module_names = False
11068

11169
# If true, sectionauthor and moduleauthor directives will be shown in the
11270
# output. They are ignored by default.
@@ -116,7 +74,7 @@
11674
pygments_style = 'sphinx'
11775

11876
# A list of ignored prefixes for module index sorting.
119-
#modindex_common_prefix = []
77+
modindex_common_prefix = ['watson_developer_cloud.']
12078

12179
# If true, keep warnings as "system message" paragraphs in the built documents.
12280
#keep_warnings = False
@@ -127,10 +85,20 @@
12785

12886
# -- Options for HTML output ----------------------------------------------
12987

88+
# The theme to use for HTML and HTML Help pages. See the documentation for
89+
# a list of builtin themes.
90+
html_theme = 'alabaster'
91+
13092
# Theme options are theme-specific and customize the look and feel of a theme
13193
# further. For a list of options available for each theme, see the
13294
# documentation.
133-
#html_theme_options = {}
95+
html_theme_options = {
96+
'show_powered_by': False,
97+
'github_user': 'watson-developer-cloud',
98+
'github_repo': 'python-sdk',
99+
'github_banner': False,
100+
'show_related': False
101+
}
134102

135103
# Add any paths that contain custom themes here, relative to this directory.
136104
#html_theme_path = []
@@ -146,10 +114,10 @@
146114
# of the sidebar.
147115
#html_logo = None
148116

149-
# The name of an image file (within the static path) to use as favicon of the
150-
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117+
# The name of an image file (relative to this directory) to use as a favicon of
118+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
151119
# pixels large.
152-
#html_favicon = None
120+
html_favicon = '_static/favicon.ico'
153121

154122
# Add any paths that contain custom static files (such as style sheets) here,
155123
# relative to this directory. They are copied after the builtin static files,
@@ -163,36 +131,38 @@
163131

164132
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
165133
# using the given strftime format.
166-
#html_last_updated_fmt = '%b %d, %Y'
134+
html_last_updated_fmt = '%b %d, %Y'
167135

168136
# If true, SmartyPants will be used to convert quotes and dashes to
169137
# typographically correct entities.
170138
#html_use_smartypants = True
171139

172140
# Custom sidebar templates, maps document names to template names.
173-
#html_sidebars = {}
141+
html_sidebars = {
142+
'**': ['localtoc.html','sidebarintro.html', 'relations.html', 'sourcelink.html', 'searchbox.html']
143+
}
174144

175145
# Additional templates that should be rendered to pages, maps page names to
176146
# template names.
177147
#html_additional_pages = {}
178148

179149
# If false, no module index is generated.
180-
#html_domain_indices = True
150+
html_domain_indices = True
181151

182152
# If false, no index is generated.
183-
#html_use_index = True
153+
html_use_index = True
184154

185155
# If true, the index is split into individual pages for each letter.
186156
#html_split_index = False
187157

188158
# If true, links to the reST sources are added to the pages.
189-
#html_show_sourcelink = True
159+
html_show_sourcelink = False
190160

191161
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
192-
#html_show_sphinx = True
162+
html_show_sphinx = False
193163

194164
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
195-
#html_show_copyright = True
165+
html_show_copyright = False
196166

197167
# If true, an OpenSearch description file will be output, and all pages will
198168
# contain a <link> tag referring to it. The value of this option must be the
@@ -239,8 +209,8 @@
239209
# (source start file, target name, title,
240210
# author, documentclass [howto, manual, or own class]).
241211
latex_documents = [
242-
(master_doc, 'WatsonDeveloperCloudPythonSDK.tex', u'Watson Developer Cloud Python SDK Documentation',
243-
u'Jeff Stylos', 'manual'),
212+
(master_doc, 'WatsonDeveloperCloudPythonSDK.tex', u'Watson Developer Cloud Python SDK Documentation',
213+
u'IBM Corp.', 'manual'),
244214
]
245215

246216
# The name of an image file (relative to this directory) to place at the top of
@@ -283,9 +253,9 @@
283253
# (source start file, target name, title, author,
284254
# dir menu entry, description, category)
285255
texinfo_documents = [
286-
(master_doc, 'WatsonDeveloperCloudPythonSDK', u'Watson Developer Cloud Python SDK Documentation',
287-
author, 'WatsonDeveloperCloudPythonSDK', 'One line description of project.',
288-
'Miscellaneous'),
256+
(master_doc, 'WatsonDeveloperCloudPythonSDK', u'Watson Developer Cloud Python SDK Documentation',
257+
author, 'WatsonDeveloperCloudPythonSDK', 'Python client library to quickly get started with the various Watson Developer Cloud services.',
258+
'Miscellaneous'),
289259
]
290260

291261
# Documents to append as an appendix to all manuals.
@@ -299,3 +269,7 @@
299269

300270
# If true, do not generate a @detailmenu in the "Top" node's menu.
301271
#texinfo_no_detailmenu = False
272+
273+
274+
# Example configuration for intersphinx: refer to the Python standard library.
275+
intersphinx_mapping = {'https://docs.python.org/': None}

docs/generate_index_html.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
# based on https://odoepner.wordpress.com/2012/02/17/shell-script-to-generate-simple-index-html/
4+
5+
echo '<!DOCTYPE html>
6+
<html>
7+
<head>
8+
<meta charset="utf-8">
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
<title>IBM Watson Developer Cloud</title>
12+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
13+
</head>
14+
<body>
15+
<div class="container">
16+
<div class="page-header">
17+
<h1>IBM Watson Developer Cloud Python SDK</h1>
18+
</div>
19+
20+
<p><a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/">Info</a>
21+
| <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/">Documentation</a>
22+
| <a href="https://github.com/watson-developer-cloud/python-sdk">GitHub</a>
23+
| <a href="https://pypi.python.org/pypi/watson-developer-cloud">pypi</a>
24+
</p>
25+
26+
<p>Documentation by branch/tag:</p>
27+
<ul>'
28+
ls | grep --invert-match index.html | sed 's/^.*/<li><a href="&">&<\/a><\/li>/'
29+
echo ' </ul>
30+
</div>
31+
<script>
32+
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
33+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
34+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
35+
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
36+
ga("create", "UA-59827755-11", "auto");
37+
ga("send", "pageview");
38+
</script>
39+
</body>
40+
</html>'

0 commit comments

Comments
 (0)