Skip to content

Commit 00f4ebc

Browse files
authored
Merge pull request #4 from sommersoft/new_docs
Improve Ref Docs
2 parents 6a0c123 + f6ca7e3 commit 00f4ebc

10 files changed

+126
-12
lines changed
File renamed without changes.

.travis.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ deploy:
1616
provider: releases
1717
api_key: $GITHUB_TOKEN
1818
file_glob: true
19-
file: bundles/*
19+
file: $TRAVIS_BUILD_DIR/bundles/*
2020
skip_cleanup: true
21+
overwrite: true
2122
on:
2223
tags: true
2324

2425
install:
25-
- pip install pylint circuitpython-build-tools
26+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
2627

2728
script:
2829
- pylint adafruit_thermistor.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-thermistor --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

+48-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Introduction
1010
:target: https://discord.gg/nBQh6qu
1111
:alt: Discord
1212
13+
.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_Thermistor.svg?branch=master
14+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_Thermistor
15+
:alt: Build Status
16+
1317
Thermistors are resistors that predictably change resistance with temperature.
1418
This driver uses an analog reading and math to determine the temperature. They
1519
are commonly used as a low cost way to measure temperature.
@@ -46,10 +50,49 @@ Contributions are welcome! Please read our `Code of Conduct
4650
<https://github.com/adafruit/Adafruit_CircuitPython_thermistor/blob/master/CODE_OF_CONDUCT.md>`_
4751
before contributing to help this project stay welcoming.
4852

49-
API Reference
50-
=============
53+
Building locally
54+
================
55+
56+
To build this library locally you'll need to install the
57+
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.
58+
59+
.. code-block:: shell
60+
61+
python3 -m venv .env
62+
source .env/bin/activate
63+
pip install circuitpython-build-tools
64+
65+
Once installed, make sure you are in the virtual environment:
66+
67+
.. code-block:: shell
68+
69+
source .env/bin/activate
70+
71+
Then run the build:
72+
73+
.. code-block:: shell
74+
75+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-thermistor --library_location .
76+
77+
Sphinx documentation
78+
-----------------------
79+
80+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
81+
install dependencies (feel free to reuse the virtual environment from above):
82+
83+
.. code-block:: shell
84+
85+
python3 -m venv .env
86+
source .env/bin/activate
87+
pip install Sphinx sphinx-rtd-theme
88+
89+
Now, once you have the virtual environment activated:
90+
91+
.. code-block:: shell
5192
52-
.. toctree::
53-
:maxdepth: 2
93+
cd docs
94+
sphinx-build -E -W -b html . _build/html
5495
55-
api
96+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
97+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
98+
locally verify it will pass.

adafruit_thermistor.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# THE SOFTWARE.
2222
"""
2323
`adafruit_thermistor` - Read temperature with a thermistor
24-
====================================================
24+
===========================================================
2525
2626
A thermistor is a resistor that varies with temperature. This driver takes the
2727
parameters of that resistor and its series resistor to determine the current
@@ -42,6 +42,9 @@
4242
* Adafruit `10K Precision Epoxy Thermistor - 3950 NTC <https://www.adafruit.com/products/372>`_
4343
(Product ID: 372)
4444
45+
* Adafruit `Circuit Playground Express <https://www.adafruit.com/products/3333>`_
46+
(Product ID: 3333)
47+
4548
**Software and Dependencies:**
4649
4750
* Adafruit CircuitPython firmware: https://github.com/adafruit/circuitpython/releases

docs/_static/favicon.ico

4.31 KB
Binary file not shown.

api.rst renamed to docs/api.rst

File renamed without changes.

conf.py renamed to docs/conf.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44
import sys
5-
sys.path.insert(0, os.path.abspath('.'))
5+
sys.path.insert(0, os.path.abspath('..'))
66

77
# -- General configuration ------------------------------------------------
88

@@ -28,7 +28,7 @@
2828
source_suffix = '.rst'
2929

3030
# The master toctree document.
31-
master_doc = 'README'
31+
master_doc = 'index'
3232

3333
# General information about the project.
3434
project = u'Adafruit THERMISTOR Library'
@@ -54,7 +54,7 @@
5454
# List of patterns, relative to source directory, that match files and
5555
# directories to ignore when looking for source files.
5656
# This patterns also effect to html_static_path and html_extra_path
57-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
57+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
5858

5959
# The reST default role (used for this markup: `text`) to use for all
6060
# documents.
@@ -71,6 +71,9 @@
7171
# If true, `todo` and `todoList` produce output, else they produce nothing.
7272
todo_include_todos = False
7373

74+
# If this is True, todo emits a warning for each TODO entries. The default is False.
75+
todo_emit_warnings = True
76+
7477

7578
# -- Options for HTML output ----------------------------------------------
7679

@@ -95,6 +98,12 @@
9598
# so a file named "default.css" will overwrite the builtin "default.css".
9699
html_static_path = ['_static']
97100

101+
# The name of an image file (relative to this directory) to use as a favicon of
102+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
103+
# pixels large.
104+
#
105+
html_favicon = '_static/favicon.ico'
106+
98107
# Output file base name for HTML help builder.
99108
htmlhelp_basename = 'AdafruitTHERMISTORLibrarydoc'
100109

@@ -131,7 +140,7 @@
131140
# One entry per manual page. List of tuples
132141
# (source start file, name, description, authors, manual section).
133142
man_pages = [
134-
(master_doc, 'adafruitTHERMISTORlibrary', u'Adafruit THERMISTOR Library Documentation',
143+
(master_doc, 'AdafruitTHERMISTORlibrary', u'Adafruit THERMISTOR Library Documentation',
135144
[author], 1)
136145
]
137146

docs/examples.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/thermistor_simpletest.py
7+
:caption: examples/thermistor_simpletest.py
8+
:linenos:

docs/index.rst

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.. include:: ../README.rst
2+
3+
Table of Contents
4+
=================
5+
6+
.. toctree::
7+
:maxdepth: 4
8+
:hidden:
9+
10+
self
11+
12+
.. toctree::
13+
:caption: Examples
14+
15+
examples
16+
17+
.. toctree::
18+
:caption: API Reference
19+
:maxdepth: 3
20+
21+
api
22+
23+
.. toctree::
24+
:caption: Tutorials
25+
26+
.. toctree::
27+
:caption: Related Products
28+
29+
10K Precision Epoxy Thermistor - 3950 NTC <https://www.adafruit.com/product/372>
30+
31+
Circuit Playground Express <https://www.adafruit.com/product/3333>
32+
33+
.. toctree::
34+
:caption: Other Links
35+
36+
Download <https://github.com/adafruit/Adafruit_CircuitPython_TCS34725/releases/latest>
37+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
38+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
39+
Discord Chat <https://adafru.it/discord>
40+
Adafruit Learning System <https://learn.adafruit.com>
41+
Adafruit Blog <https://blog.adafruit.com>
42+
Adafruit Store <https://www.adafruit.com>
43+
44+
Indices and tables
45+
==================
46+
47+
* :ref:`genindex`
48+
* :ref:`modindex`
49+
* :ref:`search`
File renamed without changes.

0 commit comments

Comments
 (0)