Skip to content

Commit 0311c34

Browse files
authored
Merge pull request #21 from adafruit/main
Pull from adafruit main
2 parents 1f75953 + 8e77981 commit 0311c34

File tree

212 files changed

+9438
-3465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+9438
-3465
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Install deps
3737
run: |
3838
sudo apt-get install -y eatmydata
39-
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
39+
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
4040
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli
4141
- name: Versions
4242
run: |
@@ -73,12 +73,19 @@ jobs:
7373
with:
7474
name: stubs
7575
path: circuitpython-stubs*
76-
- name: Docs
76+
- name: Test Documentation Build (HTML)
7777
run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html
7878
- uses: actions/upload-artifact@v2
7979
with:
8080
name: docs
8181
path: _build/html
82+
- name: Test Documentation Build (LaTeX/PDF)
83+
run: |
84+
make latexpdf
85+
- uses: actions/upload-artifact@v2
86+
with:
87+
name: docs
88+
path: _build/latex
8289
- name: Translations
8390
run: make check-translate
8491
- name: New boards check
@@ -253,6 +260,7 @@ jobs:
253260
- "pca10100"
254261
- "pewpew10"
255262
- "pewpew_m4"
263+
- "picoplanet"
256264
- "pirkey_m0"
257265
- "pitaya_go"
258266
- "pyb_nano_v2"

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ _build
5757
######################
5858
genrst/
5959
/autoapi/
60-
/shared-bindings/**/*.rst
60+
/shared-bindings/*/**/*.rst
6161

6262
# ctags and similar
6363
###################
@@ -80,3 +80,8 @@ TAGS
8080
*.mo
8181

8282
.vscode
83+
84+
# Python Virtual Environments
85+
####################
86+
.venv
87+
.env

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,6 @@
147147
[submodule "ports/esp32s2/esp-idf"]
148148
path = ports/esp32s2/esp-idf
149149
url = https://github.com/tannewt/esp-idf.git
150+
[submodule "frozen/Adafruit_CircuitPython_RFM9x"]
151+
path = frozen/Adafruit_CircuitPython_RFM9x
152+
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git

.readthedocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
version: 2
1010

11+
submodules:
12+
include:
13+
- extmod/ulab
14+
15+
formats:
16+
- pdf
17+
1118
python:
1219
version: 3
1320
install:

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ stubs:
245245
@$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
246246
@$(PYTHON) setup.py -q sdist
247247

248+
.PHONY: check-stubs
249+
check-stubs: stubs
250+
MYPYPATH=$(STUBDIR) mypy --strict $(STUBDIR)
251+
248252
update-frozen-libraries:
249253
@echo "Updating all frozen libraries to latest tagged version."
250254
cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done

conf.py

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
#
1818
# SPDX-License-Identifier: MIT
1919

20-
import json
2120
import logging
2221
import os
22+
import re
2323
import subprocess
2424
import sys
2525
import urllib.parse
2626

2727
import recommonmark
28+
from sphinx.transforms import SphinxTransform
29+
from docutils import nodes
30+
from sphinx import addnodes
2831

2932
# If extensions (or modules to document with autodoc) are in another directory,
3033
# add these directories to sys.path here. If the directory is relative to the
@@ -84,6 +87,7 @@
8487
autoapi_add_toctree_entry = False
8588
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members', 'show-module-summary']
8689
autoapi_template_dir = 'docs/autoapi/templates'
90+
autoapi_python_class_content = "both"
8791
autoapi_python_use_implicit_namespaces = True
8892
autoapi_root = "shared-bindings"
8993

@@ -106,7 +110,25 @@
106110
#
107111
# We don't follow "The short X.Y version" vs "The full version, including alpha/beta/rc tags"
108112
# breakdown, so use the same version identifier for both to avoid confusion.
109-
version = release = '0.0.0'
113+
114+
final_version = ""
115+
git_describe = subprocess.run(
116+
["git", "describe", "--dirty", "--tags"],
117+
stdout=subprocess.PIPE,
118+
stderr=subprocess.STDOUT,
119+
encoding="utf-8"
120+
)
121+
if git_describe.returncode == 0:
122+
git_version = re.search(
123+
r"^\d(?:\.\d){0,2}(?:\-(?:alpha|beta|rc)\.\d+){0,1}",
124+
str(git_describe.stdout)
125+
)
126+
if git_version:
127+
final_version = git_version[0]
128+
else:
129+
print("Failed to retrieve git version:", git_describe.stdout)
130+
131+
version = release = final_version
110132

111133
# The language for content autogenerated by Sphinx. Refer to documentation
112134
# for a list of supported languages.
@@ -423,7 +445,38 @@ def generate_redirects(app):
423445
with open(redirected_filename, 'w') as f:
424446
f.write(TEMPLATE % urllib.parse.quote(to_path, '#/'))
425447

448+
449+
class CoreModuleTransform(SphinxTransform):
450+
default_priority = 870
451+
452+
def _convert_first_paragraph_into_title(self):
453+
title = self.document.next_node(nodes.title)
454+
paragraph = self.document.next_node(nodes.paragraph)
455+
if not title or not paragraph:
456+
return
457+
if isinstance(paragraph[0], nodes.paragraph):
458+
paragraph = paragraph[0]
459+
if all(isinstance(child, nodes.Text) for child in paragraph.children):
460+
for child in paragraph.children:
461+
title.append(nodes.Text(" \u2013 "))
462+
title.append(child)
463+
paragraph.parent.remove(paragraph)
464+
465+
def _enable_linking_to_nonclass_targets(self):
466+
for desc in self.document.traverse(addnodes.desc):
467+
for xref in desc.traverse(addnodes.pending_xref):
468+
if xref.attributes.get("reftype") == "class":
469+
xref.attributes.pop("refspecific", None)
470+
471+
def apply(self, **kwargs):
472+
docname = self.env.docname
473+
if docname.startswith(autoapi_root) and docname.endswith("/index"):
474+
self._convert_first_paragraph_into_title()
475+
self._enable_linking_to_nonclass_targets()
476+
477+
426478
def setup(app):
427479
app.add_css_file("customstyle.css")
428480
app.add_config_value('redirects_file', 'redirects', 'env')
429481
app.connect('builder-inited', generate_redirects)
482+
app.add_transform(CoreModuleTransform)

docs/autoapi/templates/python/module.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
1919
{% if visible_subpackages %}
2020
.. toctree::
21-
:titlesonly:
22-
:maxdepth: 3
21+
:maxdepth: 2
2322

2423
{% for subpackage in visible_subpackages %}
2524
{{ subpackage.short_name }}/index.rst

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sphinx<3
1+
sphinx<4
22
recommonmark==0.6.0
33
sphinxcontrib-svg2pdfconverter==0.1.0
44
astroid

docs/rstjinja.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,28 @@ def rstjinja(app, docname, source):
66
Render our pages as a jinja template for fancy templating goodness.
77
"""
88
# Make sure we're outputting HTML
9-
if app.builder.format != 'html':
9+
if app.builder.format not in ("html", "latex"):
1010
return
1111

1212
# we only want our one jinja template to run through this func
1313
if "shared-bindings/support_matrix" not in docname:
1414
return
1515

16-
src = source[0]
16+
src = rendered = source[0]
1717
print(docname)
18-
rendered = app.builder.templates.render_string(
19-
src, app.config.html_context
20-
)
18+
19+
if app.builder.format == "html":
20+
rendered = app.builder.templates.render_string(
21+
src, app.config.html_context
22+
)
23+
else:
24+
from sphinx.util.template import BaseRenderer
25+
renderer = BaseRenderer()
26+
rendered = renderer.render_string(
27+
src,
28+
app.config.html_context
29+
)
30+
2131
source[0] = rendered
2232

2333
def setup(app):

extmod/moductypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
520520
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
521521
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
522522
if (index >= arr_sz) {
523-
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("struct: index out of range")));
523+
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_struct);
524524
}
525525

526526
if (t->len == 2) {

0 commit comments

Comments
 (0)