Skip to content

Commit 61c8352

Browse files
authored
Merge pull request #6 from tannewt/auto_build_sphinx
Rework doc organization
2 parents ad2fa6d + f0bedb7 commit 61c8352

File tree

9 files changed

+87
-27
lines changed

9 files changed

+87
-27
lines changed
File renamed without changes.

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ deploy:
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_pcf8523.py
2929
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3030
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-pcf8523 --library_location .
31+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ Introduction to Adafruit's PCF8523 Real Time Clock (RTC) Library
66
:target: https://circuitpython.readthedocs.io/projects/pcf8523/en/latest/
77
:alt: Documentation Status
88

9-
.. image :: https://badges.gitter.im/adafruit/circuitpython.svg
10-
:target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
11-
:alt: Gitter
9+
.. image :: https://img.shields.io/discord/327254708534116352.svg
10+
:target: https://discord.gg/nBQh6qu
11+
:alt: Discord
12+
13+
.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_PCF8523.svg?branch=master
14+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_PCF8523
15+
:alt: Build Status
1216

1317
This is a great battery-backed real time clock (RTC) that allows your
1418
microcontroller project to keep track of time even if it is reprogrammed,
@@ -23,7 +27,8 @@ temperature compensated alternative, please check out the
2327
If you need a DS1307 for compatibility reasons, check out our
2428
`DS1307 RTC breakout <https://www.adafruit.com/products/3296>`_.
2529

26-
.. image:: 3295-00.jpg
30+
.. image:: _static/3295-00.jpg
31+
:alt: PCF8523 Breakout Board
2732

2833
Dependencies
2934
=============
@@ -76,15 +81,15 @@ the RTC object:
7681
Date and time
7782
-------------
7883

79-
To set the time, you need to set ``datetime`` to a `time.struct_time` object:
84+
To set the time, you need to set datetime` to a `time.struct_time` object:
8085

8186
.. code:: python
8287
8388
rtc.datetime = time.struct_time((2017,1,9,15,6,0,0,9,-1))
8489
85-
After the RTC is set, you retrieve the time by reading the ``datetime``
86-
attribute and access the standard attributes of a struct_time such as `tm_year`,
87-
`tm_hour` and `tm_min`.
90+
After the RTC is set, you retrieve the time by reading the `datetime`
91+
attribute and access the standard attributes of a struct_time such as ``tm_year``,
92+
``tm_hour`` and ``tm_min``.
8893

8994
.. code:: python
9095
@@ -95,7 +100,7 @@ attribute and access the standard attributes of a struct_time such as `tm_year`,
95100
Alarm
96101
-----
97102

98-
To set the time, you need to set ``alarm`` to a tuple with a `time.struct_time`
103+
To set the time, you need to set `alarm` to a tuple with a `time.struct_time`
99104
object and string representing the frequency such as "hourly":
100105

101106
.. code:: python
@@ -110,11 +115,3 @@ After the RTC is set, you retrieve the alarm status by reading the
110115
if rtc.alarm_status:
111116
print("wake up!")
112117
rtc.alarm_status = False
113-
114-
API Reference
115-
=============
116-
117-
.. toctree::
118-
:maxdepth: 2
119-
120-
api
File renamed without changes.

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: 14 additions & 9 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

@@ -32,10 +32,14 @@
3232
extensions = [
3333
'sphinx.ext.autodoc',
3434
'sphinx.ext.todo',
35-
'sphinx.ext.viewcode',
3635
'sphinx.ext.intersphinx'
3736
]
3837

38+
# Uncomment the below if you use native CircuitPython modules such as
39+
# digitalio, micropython and busio. List the modules you use. Without it, the
40+
# autodoc module docs will fail to generate with a warning.
41+
autodoc_mock_imports = ["adafruit_bus_device", "adafruit_register"]
42+
3943
# Add any paths that contain templates here, relative to this directory.
4044
templates_path = ['_templates']
4145

@@ -50,7 +54,7 @@
5054
# source_encoding = 'utf-8-sig'
5155

5256
# The master toctree document.
53-
master_doc = 'README'
57+
master_doc = 'index'
5458

5559
# General information about the project.
5660
project = u'Adafruit\'s PCF8523 RTC Library'
@@ -85,7 +89,7 @@
8589
# List of patterns, relative to source directory, that match files and
8690
# directories to ignore when looking for source files.
8791
# This patterns also effect to html_static_path and html_extra_path
88-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
92+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
8993

9094
# The reST default role (used for this markup: `text`) to use for all
9195
# documents.
@@ -116,8 +120,10 @@
116120
# keep_warnings = False
117121

118122
# If true, `todo` and `todoList` produce output, else they produce nothing.
119-
todo_include_todos = True
123+
todo_include_todos = False
120124

125+
# If this is True, todo emits a warning for each TODO entries. The default is False.
126+
todo_emit_warnings = True
121127

122128
# -- Options for HTML output ----------------------------------------------
123129

@@ -160,11 +166,10 @@
160166
#
161167
# html_logo = None
162168

163-
# The name of an image file (relative to this directory) to use as a favicon of
164-
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
169+
# The name of an image file (within the static path) to use as favicon of the
170+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
165171
# pixels large.
166-
#
167-
# html_favicon = None
172+
html_favicon = '_static/favicon.ico'
168173

169174
# Add any paths that contain custom static files (such as style sheets) here,
170175
# relative to this directory. They are copied after the builtin static files,

docs/examples.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Demo
2+
----
3+
4+
.. literalinclude:: ../examples/demo.py
5+
:caption: examples/demo.py
6+
:linenos:

docs/index.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
Adafruit PCF8523 Real Time Clock <https://learn.adafruit.com/adafruit-pcf8523-real-time-clock?view=all>
27+
Adafruit Adalogger FeatherWing <https://learn.adafruit.com/adafruit-adalogger-featherwing?view=all>
28+
29+
.. toctree::
30+
:caption: Related Products
31+
32+
Adafruit PCF8523 Real Time Clock Breakout <https://www.adafruit.com/product/3295>
33+
Adafruit Adalogger FeatherWing - RTC + SD <https://www.adafruit.com/product/2922>
34+
35+
.. toctree::
36+
:caption: Other Links
37+
38+
Download <https://github.com/adafruit/Adafruit_CircuitPython_PCF8523/releases/latest>
39+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
40+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
41+
Discord Chat <https://adafru.it/discord>
42+
Adafruit Learning System <https://learn.adafruit.com>
43+
Adafruit Blog <https://blog.adafruit.com>
44+
Adafruit Store <https://www.adafruit.com>
45+
46+
Indices and tables
47+
==================
48+
49+
* :ref:`genindex`
50+
* :ref:`modindex`
51+
* :ref:`search`

0 commit comments

Comments
 (0)