Skip to content

Commit 1e346c0

Browse files
committed
Trying to fix #210
1. Using if __name__ == "__main__" clause in example to avoid running them while generating docs 2. Trying to enforce PEP-8 compliant code + PYTHON2-3 compatibale code with examples as much as possible 3. Renaming examples with "-" to "_" for the ease of documentation generation 4. Minor changes with setup and setup commands 5. Support documentation creation from make file 6. Remove unnecessary html and pdf files from the doc folder
1 parent d0a1ff6 commit 1e346c0

File tree

128 files changed

+3597
-2498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3597
-2498
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ test/__pycache__/
2323
**/pymodbus.db
2424
/.eggs/
2525
/.cache/
26+
/doc/sphinx/doctrees/
27+
/doc_new/
28+
/doc/quality/
29+
/doc/pymodbus.pdf
30+
/doc/sphinx/

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ default:
1616
@echo ' make check check coding style (PEP-8, PEP-257)'
1717
@echo ' make test run the test suite, report coverage'
1818
@echo ' make tox run the tests on all Python versions'
19+
@echo ' make docs Creates sphinx documentation in html'
1920
@echo ' make clean cleanup all temporary files'
2021
@echo
2122

doc/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
SPHINXPROJ = PyModbus
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../CHANGELOG.rst

doc/conf.py

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# PyModbus documentation build configuration file, created by
4+
# sphinx-quickstart on Wed Dec 20 12:31:10 2017.
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.
14+
15+
# If extensions (or modules to document with autodoc) are in another directory,
16+
# add these directories to sys.path here. If the directory is relative to the
17+
# documentation root, use os.path.abspath to make it absolute, like shown here.
18+
#
19+
import os
20+
import sys
21+
parent_dir = os.path.abspath(os.pardir)
22+
# examples = os.path.join(parent_dir, "examples")
23+
example_contrib = os.path.join(parent_dir, "examples/contrib")
24+
example_common = os.path.join(parent_dir, "examples/common")
25+
example_gui = os.path.join(parent_dir, "examples/gui")
26+
27+
sys.path.insert(0, os.path.abspath(os.pardir))
28+
sys.path.append(example_common)
29+
sys.path.append(example_contrib)
30+
sys.path.append(example_gui)
31+
# sys.path.extend([examples, example_common, example_contrib, example_gui])
32+
# sys.path.insert(0, os.path.abspath('../'))
33+
34+
35+
# -- General configuration ------------------------------------------------
36+
37+
# If your documentation needs a minimal Sphinx version, state it here.
38+
#
39+
# needs_sphinx = '1.0'
40+
41+
# Add any Sphinx extension module names here, as strings. They can be
42+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
43+
# ones.
44+
extensions = ['sphinx.ext.autodoc']
45+
46+
# Add any paths that contain templates here, relative to this directory.
47+
templates_path = ['_templates']
48+
49+
# The suffix(es) of source filenames.
50+
# You can specify multiple suffix as a list of string:
51+
#
52+
# source_suffix = ['.rst', '.md']
53+
source_suffix = '.rst'
54+
55+
# The master toctree document.
56+
master_doc = 'index'
57+
58+
# General information about the project.
59+
project = u'PyModbus'
60+
copyright = u'2017, Sanjay'
61+
author = u'Sanjay'
62+
63+
# The version info for the project you're documenting, acts as replacement for
64+
# |version| and |release|, also used in various other places throughout the
65+
# built documents.
66+
#
67+
# The short X.Y version.
68+
version = u'1.4.0'
69+
# The full version, including alpha/beta/rc tags.
70+
release = u'1.4.0'
71+
72+
# The language for content autogenerated by Sphinx. Refer to documentation
73+
# for a list of supported languages.
74+
#
75+
# This is also used if you do content translation via gettext catalogs.
76+
# Usually you set "language" from the command line for these cases.
77+
language = None
78+
79+
# List of patterns, relative to source directory, that match files and
80+
# directories to ignore when looking for source files.
81+
# This patterns also effect to html_static_path and html_extra_path
82+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
83+
84+
# The name of the Pygments (syntax highlighting) style to use.
85+
pygments_style = 'sphinx'
86+
87+
# If true, `todo` and `todoList` produce output, else they produce nothing.
88+
todo_include_todos = False
89+
90+
91+
# -- Options for HTML output ----------------------------------------------
92+
93+
# The theme to use for HTML and HTML Help pages. See the documentation for
94+
# a list of builtin themes.
95+
#
96+
html_theme = 'sphinx_rtd_theme'
97+
98+
# Theme options are theme-specific and customize the look and feel of a theme
99+
# further. For a list of options available for each theme, see the
100+
# documentation.
101+
#
102+
# html_theme_options = {}
103+
104+
# Add any paths that contain custom static files (such as style sheets) here,
105+
# relative to this directory. They are copied after the builtin static files,
106+
# so a file named "default.css" will overwrite the builtin "default.css".
107+
html_static_path = ['_static']
108+
109+
# Custom sidebar templates, must be a dictionary that maps document names
110+
# to template names.
111+
#
112+
# This is required for the alabaster theme
113+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
114+
html_sidebars = {
115+
'**': [
116+
'relations.html', # needs 'show_related': True theme option to display
117+
'searchbox.html',
118+
]
119+
}
120+
121+
122+
# -- Options for HTMLHelp output ------------------------------------------
123+
124+
# Output file base name for HTML help builder.
125+
htmlhelp_basename = 'PyModbusdoc'
126+
127+
128+
# -- Options for LaTeX output ---------------------------------------------
129+
130+
latex_elements = {
131+
# The paper size ('letterpaper' or 'a4paper').
132+
#
133+
# 'papersize': 'letterpaper',
134+
135+
# The font size ('10pt', '11pt' or '12pt').
136+
#
137+
# 'pointsize': '10pt',
138+
139+
# Additional stuff for the LaTeX preamble.
140+
#
141+
# 'preamble': '',
142+
143+
# Latex figure (float) alignment
144+
#
145+
# 'figure_align': 'htbp',
146+
}
147+
148+
# Grouping the document tree into LaTeX files. List of tuples
149+
# (source start file, target name, title,
150+
# author, documentclass [howto, manual, or own class]).
151+
latex_documents = [
152+
(master_doc, 'PyModbus.tex', u'PyModbus Documentation',
153+
u'Sanjay', 'manual'),
154+
]
155+
156+
157+
# -- Options for manual page output ---------------------------------------
158+
159+
# One entry per manual page. List of tuples
160+
# (source start file, name, description, authors, manual section).
161+
man_pages = [
162+
(master_doc, 'pymodbus', u'PyModbus Documentation',
163+
[author], 1)
164+
]
165+
166+
167+
# -- Options for Texinfo output -------------------------------------------
168+
169+
# Grouping the document tree into Texinfo files. List of tuples
170+
# (source start file, target name, title, author,
171+
# dir menu entry, description, category)
172+
texinfo_documents = [
173+
(master_doc, 'PyModbus', u'PyModbus Documentation',
174+
author, 'PyModbus', 'One line description of project.',
175+
'Miscellaneous'),
176+
]
177+
178+
179+

doc/index.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. PyModbus documentation master file, created by
2+
sphinx-quickstart on Wed Dec 20 12:31:10 2017.
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 PyModbus's documentation!
7+
====================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
readme.rst
14+
changelog.rst
15+
source/example/modules.rst
16+
source/library/modules.rst
17+
18+
19+
Indices and tables
20+
==================
21+
22+
* :ref:`genindex`
23+
* :ref:`modindex`
24+
* :ref:`search`

doc/readme.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../README.rst
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
==================================================
2+
Asynchronous Client Example
3+
==================================================
4+
.. literalinclude:: ../../../examples/common/asynchronous_client.py
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
==================================================
2+
Asynchronous Processor Example
3+
==================================================
4+
.. literalinclude:: ../../../examples/common/asynchronous_processor.py
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
==================================================
2+
Asynchronous Server Example
3+
==================================================
4+
.. literalinclude:: ../../../examples/common/asynchronous_server.py

0 commit comments

Comments
 (0)