Skip to content

Commit f4b552a

Browse files
authored
Merge pull request #10 from sommersoft/new_docs
Improve Ref Docs
2 parents 8cb4e1f + f3412f4 commit f4b552a

10 files changed

+133
-19
lines changed
File renamed without changes.

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ 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
2121
on:
2222
tags: true
2323

2424
install:
25-
- pip install pylint circuitpython-build-tools
25+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
2626

2727
script:
2828
- pylint adafruit_ccs811.py
2929
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3030
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ccs811 --library_location .
31+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,56 @@ To read the gas sensor and temperature simply read the attributes:
6060
6161
print("CO2: ", ccs.eCO2, " TVOC:", ccs.TVOC, " temp:", ccs.temperature)
6262
63-
API Reference
64-
=============
63+
Contributing
64+
============
65+
66+
Contributions are welcome! Please read our `Code of Conduct
67+
<https://github.com/adafruit/Adafruit_CircuitPython_VEML6070/blob/master/CODE_OF_CONDUCT.md>`_
68+
before contributing to help this project stay welcoming.
69+
70+
Building locally
71+
================
72+
73+
To build this library locally you'll need to install the
74+
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.
75+
76+
.. code-block:: shell
77+
78+
python3 -m venv .env
79+
source .env/bin/activate
80+
pip install circuitpython-build-tools
81+
82+
Once installed, make sure you are in the virtual environment:
83+
84+
.. code-block:: shell
85+
86+
source .env/bin/activate
87+
88+
Then run the build:
89+
90+
.. code-block:: shell
91+
92+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ccs811 --library_location .
93+
94+
Sphinx documentation
95+
-----------------------
96+
97+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
98+
install dependencies (feel free to reuse the virtual environment from above):
99+
100+
.. code-block:: shell
101+
102+
python3 -m venv .env
103+
source .env/bin/activate
104+
pip install Sphinx sphinx-rtd-theme
105+
106+
Now, once you have the virtual environment activated:
107+
108+
.. code-block:: shell
65109
66-
.. toctree::
67-
:maxdepth: 2
110+
cd docs
111+
sphinx-build -E -W -b html . _build/html
68112
69-
api
113+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
114+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
115+
locally verify it will pass.

adafruit_ccs811.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# THE SOFTWARE.
2222

2323
"""
24-
`CCS811` - CCS811 air quality sensor
25-
====================================================
24+
`CCS811` - Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2
25+
======================================================================
2626
This library supports the use of the CCS811 air quality sensor in CircuitPython.
2727
2828
Author(s): Dean Miller for Adafruit Industries

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

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#
1919
import os
2020
import sys
21-
sys.path.insert(0, os.path.abspath('.'))
21+
sys.path.insert(0, os.path.abspath('..'))
2222

2323
# -- General configuration ------------------------------------------------
2424

@@ -36,29 +36,32 @@
3636
'sphinx.ext.intersphinx'
3737
]
3838

39-
autodoc_mock_imports = []
39+
# Uncomment the below if you use native CircuitPython modules such as
40+
# digitalio, micropython and busio. List the modules you use. Without it, the
41+
# autodoc module docs will fail to generate with a warning.
42+
autodoc_mock_imports = ["micropython", "adafruit_bus_device", "adafruit_register"]
4043

4144
# Mock out micropython ourselves.
42-
import imp
43-
m = imp.new_module("micropython")
44-
m.const = lambda x: x
45-
sys.modules["micropython"] = m
45+
#import imp
46+
#m = imp.new_module("micropython")
47+
#m.const = lambda x: x
48+
#sys.modules["micropython"] = m
4649

4750
# Add any paths that contain templates here, relative to this directory.
4851
templates_path = ['_templates']
4952

5053
# The suffix(es) of source filenames.
5154
# You can specify multiple suffix as a list of string:
5255
#
53-
source_suffix = ['.rst', '.md']
54-
# source_suffix = '.rst'
56+
#source_suffix = ['.rst', '.md']
57+
source_suffix = '.rst'
5558

5659
# The encoding of source files.
5760
#
5861
# source_encoding = 'utf-8-sig'
5962

6063
# The master toctree document.
61-
master_doc = 'README'
64+
master_doc = 'index'
6265

6366
# General information about the project.
6467
project = u'Adafruit\'s CCS811 Library'
@@ -93,7 +96,7 @@
9396
# List of patterns, relative to source directory, that match files and
9497
# directories to ignore when looking for source files.
9598
# This patterns also effect to html_static_path and html_extra_path
96-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
99+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
97100

98101
# The reST default role (used for this markup: `text`) to use for all
99102
# documents.
@@ -126,6 +129,9 @@
126129
# If true, `todo` and `todoList` produce output, else they produce nothing.
127130
todo_include_todos = True
128131

132+
# If this is True, todo emits a warning for each TODO entries. The default is False.
133+
todo_emit_warnings = True
134+
129135

130136
# -- Options for HTML output ----------------------------------------------
131137

@@ -179,6 +185,12 @@
179185
# so a file named "default.css" will overwrite the builtin "default.css".
180186
html_static_path = ['_static']
181187

188+
# The name of an image file (relative to this directory) to use as a favicon of
189+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
190+
# pixels large.
191+
#
192+
html_favicon = '_static/favicon.ico'
193+
182194
# Add any extra paths that contain custom files (such as robots.txt or
183195
# .htaccess) here, relative to this directory. These files are copied
184196
# directly to the root of the documentation.

docs/examples.rst

Lines changed: 8 additions & 0 deletions
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/ccs811_simpletest.py
7+
:caption: examples/ccs811_simpletest.py
8+
:linenos:

docs/index.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2 <https://www.adafruit.com/product/3566>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_CCS811/releases/latest>
35+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
36+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
37+
Discord Chat <https://adafru.it/discord>
38+
Adafruit Learning System <https://learn.adafruit.com>
39+
Adafruit Blog <https://blog.adafruit.com>
40+
Adafruit Store <https://www.adafruit.com>
41+
42+
Indices and tables
43+
==================
44+
45+
* :ref:`genindex`
46+
* :ref:`modindex`
47+
* :ref:`search`
File renamed without changes.

0 commit comments

Comments
 (0)