Skip to content

Commit 30ad46c

Browse files
authored
documentation tool chain (codeaffen#27)
* fix nameserver test file * add docstrings to classes * Documentation tool chain * add sphinx configuration * add targets to makefile * add rst templates for module
1 parent db3d3ae commit 30ad46c

12 files changed

+459
-49
lines changed

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@ publish: check
3333
$(TWINE_CMD) upload $(TWINE_OPTIONS) dist/*
3434

3535
clean:
36-
rm -rf build/
37-
rm -rf dist/
38-
rm -rf *.egg-info
36+
rm -Rf docs/{build,_build} {build,dist} *.egg-info
3937
find . -name '*.pyc' -exec rm -f {} +
4038
find . -name '*.pyo' -exec rm -f {} +
4139
find . -name '*~' -exec rm -f {} +
4240
find . -name '__pycache__' -exec rm -rf {} +
4341

42+
doc-setup:
43+
pip install --upgrade -r docs/requirements.txt
44+
45+
doc:
46+
install -d -m 750 ./docs/plugins
47+
sphinx-apidoc -o docs/plugins/ phpypam
48+
make -C docs html
49+
4450
FORCE:
4551

4652
.PHONY: help dist lint publish FORCE

docs/Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SOURCEDIR = .
8+
BUILDDIR = build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md

docs/conf.py

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
import os
16+
import sys
17+
sys.path.insert(0, os.path.abspath('../'))
18+
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = u'phpypam'
23+
copyright = u'2020, codeaffen'
24+
author = u'codeaffen'
25+
26+
# The short X.Y version
27+
version = u''
28+
# The full version, including alpha/beta/rc tags
29+
release = u''
30+
31+
32+
# -- General configuration ---------------------------------------------------
33+
34+
# If your documentation needs a minimal Sphinx version, state it here.
35+
#
36+
# needs_sphinx = '1.0'
37+
38+
# Add any Sphinx extension module names here, as strings. They can be
39+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
40+
# ones.
41+
extensions = [
42+
'recommonmark',
43+
'sphinx.ext.autodoc',
44+
'sphinx.ext.viewcode',
45+
'sphinx.ext.intersphinx'
46+
]
47+
48+
# Add any paths that contain templates here, relative to this directory.
49+
templates_path = ['_templates']
50+
51+
# The suffix(es) of source filenames.
52+
# You can specify multiple suffix as a list of string:
53+
#
54+
# source_suffix = ['.rst', '.md']
55+
source_suffix = {
56+
'.rst': 'restructuredtext',
57+
'.md': 'markdown',
58+
}
59+
60+
# The master toctree document.
61+
master_doc = 'index'
62+
63+
# The language for content autogenerated by Sphinx. Refer to documentation
64+
# for a list of supported languages.
65+
#
66+
# This is also used if you do content translation via gettext catalogs.
67+
# Usually you set "language" from the command line for these cases.
68+
language = None
69+
70+
# List of patterns, relative to source directory, that match files and
71+
# directories to ignore when looking for source files.
72+
# This pattern also affects html_static_path and html_extra_path.
73+
exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
74+
75+
# The name of the Pygments (syntax highlighting) style to use.
76+
pygments_style = None
77+
78+
79+
# -- Options for HTML output -------------------------------------------------
80+
81+
# The theme to use for HTML and HTML Help pages. See the documentation for
82+
# a list of builtin themes.
83+
#
84+
html_theme = 'sphinx_rtd_theme'
85+
86+
# Theme options are theme-specific and customize the look and feel of a theme
87+
# further. For a list of options available for each theme, see the
88+
# documentation.
89+
#
90+
# html_theme_options = {}
91+
92+
# Add any paths that contain custom static files (such as style sheets) here,
93+
# relative to this directory. They are copied after the builtin static files,
94+
# so a file named "default.css" will overwrite the builtin "default.css".
95+
# html_static_path = ['_static']
96+
97+
# Custom sidebar templates, must be a dictionary that maps document names
98+
# to template names.
99+
#
100+
# The default sidebars (for documents that don't match any pattern) are
101+
# defined by theme itself. Builtin themes are using these templates by
102+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
103+
# 'searchbox.html']``.
104+
#
105+
# html_sidebars = {}
106+
107+
108+
# -- Options for HTMLHelp output ---------------------------------------------
109+
110+
# Output file base name for HTML help builder.
111+
htmlhelp_basename = 'phpypamdoc'
112+
113+
114+
# -- Options for LaTeX output ------------------------------------------------
115+
116+
latex_elements = {
117+
# The paper size ('letterpaper' or 'a4paper').
118+
#
119+
# 'papersize': 'letterpaper',
120+
121+
# The font size ('10pt', '11pt' or '12pt').
122+
#
123+
# 'pointsize': '10pt',
124+
125+
# Additional stuff for the LaTeX preamble.
126+
#
127+
# 'preamble': '',
128+
129+
# Latex figure (float) alignment
130+
#
131+
# 'figure_align': 'htbp',
132+
}
133+
134+
# Grouping the document tree into LaTeX files. List of tuples
135+
# (source start file, target name, title,
136+
# author, documentclass [howto, manual, or own class]).
137+
latex_documents = [
138+
(master_doc, 'phpypam.tex', u'phpypam Documentation',
139+
u'codeaffen', 'manual'),
140+
]
141+
142+
143+
# -- Options for manual page output ------------------------------------------
144+
145+
# One entry per manual page. List of tuples
146+
# (source start file, name, description, authors, manual section).
147+
man_pages = [
148+
(master_doc, 'phpypam', u'phpypam Documentation',
149+
[author], 1)
150+
]
151+
152+
153+
# -- Options for Texinfo output ----------------------------------------------
154+
155+
# Grouping the document tree into Texinfo files. List of tuples
156+
# (source start file, target name, title, author,
157+
# dir menu entry, description, category)
158+
texinfo_documents = [
159+
(master_doc, 'phpypam', u'phpypam Documentation',
160+
author, 'phpypam', 'One line description of project.',
161+
'Miscellaneous'),
162+
]
163+
164+
165+
# -- Options for Epub output -------------------------------------------------
166+
167+
# Bibliographic Dublin Core info.
168+
epub_title = project
169+
170+
# The unique identifier of the text. This can be a ISBN number
171+
# or the project homepage.
172+
#
173+
# epub_identifier = ''
174+
175+
# A unique identification for the text.
176+
#
177+
# epub_uid = ''
178+
179+
# A list of files that should not be packed into the epub file.
180+
epub_exclude_files = ['search.html']
181+
182+
183+
# -- Extension configuration -------------------------------------------------

docs/index.rst

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. phpypam documentation master file, created by
2+
sphinx-quickstart on Fri Oct 30 13:46:29 2020.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to phpypam's documentation!
7+
===================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
README
14+
plugins/phpypam
15+
plugins/modules
16+
17+
18+
19+
Indices and tables
20+
==================
21+
22+
* :ref:`genindex`
23+
* :ref:`modindex`
24+
* :ref:`search`

docs/plugins/modules.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
phpypam
2+
=======
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
phpypam

docs/plugins/phpypam.core.rst

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
phpypam.core package
2+
====================
3+
4+
Submodules
5+
----------
6+
7+
phpypam.core.api module
8+
-----------------------
9+
10+
.. automodule:: phpypam.core.api
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
phpypam.core.exceptions module
16+
------------------------------
17+
18+
.. automodule:: phpypam.core.exceptions
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
Module contents
24+
---------------
25+
26+
.. automodule:: phpypam.core
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:

docs/plugins/phpypam.rst

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
phpypam package
2+
===============
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
phpypam.core
11+
12+
Module contents
13+
---------------
14+
15+
.. automodule:: phpypam
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:

docs/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx-rtd-theme
2+
recommonmark

0 commit comments

Comments
 (0)