Skip to content

Commit bd0ef8a

Browse files
committed
Initial Sphinx Setup
1 parent 9fc01f8 commit bd0ef8a

12 files changed

+421
-0
lines changed

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
repos:
6+
- repo: https://github.com/python/black
7+
rev: 22.3.0
8+
hooks:
9+
- id: black
10+
# - repo: https://github.com/fsfe/reuse-tool
11+
# rev: v0.14.0
12+
# hooks:
13+
# - id: reuse
14+
# - repo: https://github.com/pre-commit/pre-commit-hooks
15+
# rev: v4.2.0
16+
# hooks:
17+
# - id: check-yaml
18+
# - id: end-of-file-fixer
19+
# - id: trailing-whitespace
20+
# - repo: https://github.com/pycqa/pylint
21+
# rev: v2.15.5
22+
# hooks:
23+
# - id: pylint
24+
# name: pylint (library code)
25+
# types: [python]
26+
# args:
27+
# - --disable=consider-using-f-string
28+
# exclude: "^(docs/|examples/|tests/|setup.py$)"
29+
# - id: pylint
30+
# name: pylint (example code)
31+
# description: Run pylint rules on "examples/*.py" files
32+
# types: [python]
33+
# files: "^examples/"
34+
# args:
35+
# - --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
36+
# - id: pylint
37+
# name: pylint (test code)
38+
# description: Run pylint rules on "tests/*.py" files
39+
# types: [python]
40+
# files: "^tests/"
41+
# args:
42+
# - --disable=missing-docstring,consider-using-f-string,duplicate-code

.readthedocs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
# Read the Docs configuration file
6+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
7+
8+
# Required
9+
version: 2
10+
11+
build:
12+
os: ubuntu-20.04
13+
tools:
14+
python: "3"
15+
16+
python:
17+
install:
18+
- requirements: docs/requirements.txt
19+
- requirements: requirements.txt

docs/_static/favicon.ico

4.31 KB
Binary file not shown.

docs/_static/favicon.ico.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
2+
3+
SPDX-License-Identifier: CC-BY-4.0

docs/api.rst

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
2+
.. If you created a package, create one automodule per module in the package.
3+
4+
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
5+
.. use this format as the module name: "adafruit_foo.foo"
6+
7+
Hardware
8+
-------
9+
10+
.. autoclass:: XRPLib.motor
11+
:members:
12+
:undoc-members:
13+
14+
.. autoclass:: XRPLib.encoded_motor
15+
:members:
16+
:undoc-members:
17+
18+
.. autoclass:: XRPLib.motor_group
19+
:members:
20+
:undoc-members:
21+
22+
.. autoclass:: XRPLib.differential_drive
23+
:members:
24+
:undoc-members:
25+
26+
.. autoclass:: XRPLib.servo
27+
:members:
28+
:undoc-members:
29+
30+
Sensors
31+
-------
32+
33+
.. autoclass:: XRPLib.encoder
34+
:members:
35+
:undoc-members:
36+
37+
.. autoclass:: XRPLib.imu
38+
:members:
39+
:undoc-members:
40+
41+
.. autoclass:: XRPLib.rangefinder
42+
:members:
43+
:undoc-members:
44+
45+
.. autoclass:: XRPLib.reflectance
46+
:members:
47+
:undoc-members:
48+
49+
Miscellaneous
50+
-------
51+
52+
.. autoclass:: XRPLib.board
53+
:members:
54+
:undoc-members:
55+
56+
.. autoclass:: XRPLib.controller
57+
:members:
58+
:undoc-members:
59+
60+
.. autoclass:: XRPLib.defaults
61+
:members:
62+
:undoc-members:
63+
64+
.. autoclass:: XRPLib.pid
65+
:members:
66+
:undoc-members:
67+
68+
.. autoclass:: XRPLib.resetbot
69+
:members:
70+
:undoc-members:
71+
72+
.. autoclass:: XRPLib.version
73+
:members:
74+
:undoc-members:
75+
76+
.. autoclass:: XRPLib.webserver
77+
:members:
78+
:undoc-members:

docs/api.rst.license

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SPDX-FileCopyrightText: 2023 Kevin Siegall, written for OpenSTEM @ WPI
2+
SPDX-FileCopyrightText: Copyright (c) 2023 Open STEM Authors for WPI
3+
4+
SPDX-License-Identifier: MIT

docs/conf.py

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
4+
#
5+
# SPDX-License-Identifier: MIT
6+
7+
import os
8+
import sys
9+
import datetime
10+
from XRPLib.version import __version__
11+
12+
sys.path.insert(0, os.path.abspath(".."))
13+
14+
# -- General configuration ------------------------------------------------
15+
16+
# Add any Sphinx extension module names here, as strings. They can be
17+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
18+
# ones.
19+
extensions = [
20+
"sphinx.ext.autodoc",
21+
"sphinx.ext.intersphinx",
22+
"sphinx.ext.napoleon",
23+
"sphinx.ext.todo",
24+
]
25+
26+
# TODO: Please Read!
27+
# Uncomment the below if you use native CircuitPython modules such as
28+
# digitalio, micropython and busio. List the modules you use. Without it, the
29+
# autodoc module docs will fail to generate with a warning.
30+
# autodoc_mock_imports = ["digitalio", "busio"]
31+
32+
autodoc_preserve_defaults = True
33+
34+
35+
intersphinx_mapping = {
36+
"python": ("https://docs.python.org/3", None),
37+
"MicroPython": ("https://docs.micropython.org/en/latest/", None),
38+
}
39+
40+
# Show the docstring from both the class and its __init__() method.
41+
autoclass_content = "both"
42+
43+
# Add any paths that contain templates here, relative to this directory.
44+
templates_path = ["_templates"]
45+
46+
source_suffix = ".rst"
47+
48+
# The master toctree document.
49+
master_doc = "index"
50+
51+
# General information about the project.
52+
project = "MicroPython XRP Library"
53+
creation_year = "2023"
54+
current_year = str(datetime.datetime.now().year)
55+
year_duration = (
56+
current_year
57+
if current_year == creation_year
58+
else creation_year + " - " + current_year
59+
)
60+
copyright = year_duration + " Open STEM Authors"
61+
author = "Open STEM Authors"
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 = __version__
69+
# The full version, including alpha/beta/rc tags.
70+
release = __version__
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 = "en"
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 = [
83+
"_build",
84+
"Thumbs.db",
85+
".DS_Store",
86+
".env",
87+
"CODE_OF_CONDUCT.md",
88+
]
89+
90+
# The reST default role (used for this markup: `text`) to use for all
91+
# documents.
92+
#
93+
default_role = "any"
94+
95+
# If true, '()' will be appended to :func: etc. cross-reference text.
96+
#
97+
add_function_parentheses = True
98+
99+
# The name of the Pygments (syntax highlighting) style to use.
100+
pygments_style = "sphinx"
101+
102+
# If true, `todo` and `todoList` produce output, else they produce nothing.
103+
todo_include_todos = False
104+
105+
# If this is True, todo emits a warning for each TODO entries. The default is False.
106+
todo_emit_warnings = True
107+
108+
napoleon_numpy_docstring = False
109+
110+
# -- Options for HTML output ----------------------------------------------
111+
112+
# The theme to use for HTML and HTML Help pages. See the documentation for
113+
# a list of builtin themes.
114+
#
115+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
116+
117+
if not on_rtd: # only import and set the theme if we're building docs locally
118+
try:
119+
import sphinx_rtd_theme
120+
121+
html_theme = "sphinx_rtd_theme"
122+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
123+
except:
124+
html_theme = "default"
125+
html_theme_path = ["."]
126+
else:
127+
html_theme_path = ["."]
128+
129+
# Add any paths that contain custom static files (such as style sheets) here,
130+
# relative to this directory. They are copied after the builtin static files,
131+
# so a file named "default.css" will overwrite the builtin "default.css".
132+
html_static_path = ["_static"]
133+
134+
# The name of an image file (relative to this directory) to use as a favicon of
135+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
136+
# pixels large.
137+
#
138+
html_favicon = "_static/favicon.ico"
139+
140+
# Output file base name for HTML help builder.
141+
htmlhelp_basename = "MicroPython_XRP_Library_Doc"
142+
143+
# -- Options for LaTeX output ---------------------------------------------
144+
145+
latex_elements = {
146+
# The paper size ('letterpaper' or 'a4paper').
147+
# 'papersize': 'letterpaper',
148+
# The font size ('10pt', '11pt' or '12pt').
149+
# 'pointsize': '10pt',
150+
# Additional stuff for the LaTeX preamble.
151+
# 'preamble': '',
152+
# Latex figure (float) alignment
153+
# 'figure_align': 'htbp',
154+
}
155+
156+
# Grouping the document tree into LaTeX files. List of tuples
157+
# (source start file, target name, title,
158+
# author, documentclass [howto, manual, or own class]).
159+
latex_documents = [
160+
(
161+
master_doc,
162+
"MicroPython_XRP_Library.tex",
163+
"MicroPython XRP Library Documentation",
164+
author,
165+
"manual",
166+
),
167+
]
168+
169+
# -- Options for manual page output ---------------------------------------
170+
171+
# One entry per manual page. List of tuples
172+
# (source start file, name, description, authors, manual section).
173+
man_pages = [
174+
(
175+
master_doc,
176+
"MicroPython_XRP_Library",
177+
"MicroPython XRP Library Documentation",
178+
[author],
179+
1,
180+
),
181+
]
182+
183+
# -- Options for Texinfo output -------------------------------------------
184+
185+
# Grouping the document tree into Texinfo files. List of tuples
186+
# (source start file, target name, title, author,
187+
# dir menu entry, description, category)
188+
texinfo_documents = [
189+
(
190+
master_doc,
191+
"MicroPython_XRP_Library",
192+
"MicroPython XRP Library Documentation",
193+
author,
194+
"MicroPython_XRP_Library",
195+
"One line description of project.",
196+
"Miscellaneous",
197+
),
198+
]

docs/examples.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../Examples/drive_examples.py
7+
:caption: Examples/drive_examples.py
8+
:linenos:
9+
10+
.. literalinclude:: ../Examples/sensor_examples.py
11+
:caption: Examples/sensor_examples.py
12+
:linenos:
13+
14+
.. literalinclude:: ../Examples/webserver_example.py
15+
:caption: Examples/sensor_examples.py
16+
:linenos:
17+
18+
.. literalinclude:: ../Examples/misc_examples.py
19+
:caption: Examples/sensor_examples.py
20+
:linenos:

docs/examples.rst.license

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SPDX-FileCopyrightText: 2023 Kevin Siegall, written for OpenSTEM @ WPI
2+
SPDX-FileCopyrightText: Copyright (c) 2023 Open STEM Authors for WPI
3+
4+
SPDX-License-Identifier: MIT

0 commit comments

Comments
 (0)