Skip to content

Commit c5436a3

Browse files
authored
Merge pull request #2 from sommersoft/new_docs
Improve Ref Docs
2 parents cd71268 + 4f89bdf commit c5436a3

File tree

10 files changed

+133
-11
lines changed

10 files changed

+133
-11
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
python:
2+
version: 3
13
requirements_file: requirements.txt
24

.travis.yml

Lines changed: 4 additions & 2 deletions
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_gps.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-gps --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,49 @@ Contributions are welcome! Please read our `Code of Conduct
3636
<https://github.com/adafruit/Adafruit_CircuitPython_gps/blob/master/CODE_OF_CONDUCT.md>`_
3737
before contributing to help this project stay welcoming.
3838

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

adafruit_gps.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@
2727
modules to read latitude, longitude, and more.
2828
2929
* Author(s): Tony DiCola
30+
31+
Implementation Notes
32+
--------------------
33+
34+
**Hardware:**
35+
36+
* Adafruit `Ultimate GPS Breakout <https://www.adafruit.com/product/746>`_
37+
* Adafruit `Ultimate GPS FeatherWing <https://www.adafruit.com/product/3133>`_
38+
39+
**Software and Dependencies:**
40+
41+
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
42+
https://github.com/adafruit/circuitpython/releases
43+
3044
"""
3145
import time
3246

@@ -59,7 +73,7 @@ def _parse_float(nmea_data):
5973
# lint warning about too many attributes disabled
6074
#pylint: disable-msg=R0902
6175
class GPS:
62-
""" GPS parsing module. Can parse simple NMEA data sentences from serial GPS
76+
"""GPS parsing module. Can parse simple NMEA data sentences from serial GPS
6377
modules to read latitude, longitude, and more.
6478
"""
6579
def __init__(self, uart):

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: 12 additions & 3 deletions
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

@@ -23,7 +23,7 @@
2323
source_suffix = '.rst'
2424

2525
# The master toctree document.
26-
master_doc = 'README'
26+
master_doc = 'index'
2727

2828
# General information about the project.
2929
project = u'Adafruit GPS Library'
@@ -49,7 +49,7 @@
4949
# List of patterns, relative to source directory, that match files and
5050
# directories to ignore when looking for source files.
5151
# This patterns also effect to html_static_path and html_extra_path
52-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
52+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
5353

5454
# The reST default role (used for this markup: `text`) to use for all
5555
# documents.
@@ -66,6 +66,9 @@
6666
# If true, `todo` and `todoList` produce output, else they produce nothing.
6767
todo_include_todos = False
6868

69+
# If this is True, todo emits a warning for each TODO entries. The default is False.
70+
todo_emit_warnings = True
71+
6972

7073
# -- Options for HTML output ----------------------------------------------
7174

@@ -90,6 +93,12 @@
9093
# so a file named "default.css" will overwrite the builtin "default.css".
9194
html_static_path = ['_static']
9295

96+
# The name of an image file (relative to this directory) to use as a favicon of
97+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
98+
# pixels large.
99+
#
100+
html_favicon = '_static/favicon.ico'
101+
93102
# Output file base name for HTML help builder.
94103
htmlhelp_basename = 'AdafruitGPSLibrarydoc'
95104

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/gps_simpletest.py
7+
:caption: examples/gps_simpletest.py
8+
:linenos:

docs/index.rst

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

0 commit comments

Comments
 (0)