Content-Length: 1443254 | pFad | http://github.com/adafruit/circuitpython/commit/4e8de3c554024d3ac89e9ee77b958a6932a64bec

B4 Swap sphinx to autoapi and the inline stubs · adafruit/circuitpython@4e8de3c · GitHub
Skip to content

Commit 4e8de3c

Browse files
committed
Swap sphinx to autoapi and the inline stubs
1 parent c534a87 commit 4e8de3c

File tree

139 files changed

+337
-1239
lines changed

Some content is hidden

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

139 files changed

+337
-1239
lines changed

Diff for: .github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
sudo apt-get install -y eatmydata
3636
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
37-
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
37+
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml
3838
- name: Versions
3939
run: |
4040
gcc --version

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
############
1515
dist/
1616
*.egg-info
17+
.eggs
1718

1819
# Logs and Databases
1920
######################
@@ -51,6 +52,7 @@ _build
5152
# Generated rst files
5253
######################
5354
genrst/
55+
autoapi/
5456

5557
# ctags and similar
5658
###################

Diff for: Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ clean:
6969
rm -rf $(BUILDDIR)/*
7070
rm -rf $(STUBDIR) $(DISTDIR) *.egg-info
7171

72-
html:
72+
html: stubs
7373
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
7474
@echo
7575
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@@ -213,8 +213,10 @@ check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
213213
$(PYTHON) tools/check_translations.py $^
214214

215215
stubs:
216+
mkdir -p circuitpython-stubs
216217
python tools/extract_pyi.py shared-bindings/ $(STUBDIR)
217-
#python setup.py sdist
218+
python tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
219+
python setup.py sdist
218220

219221
update-frozen-libraries:
220222
@echo "Updating all frozen libraries to latest tagged version."

Diff for: conf.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
'sphinx.ext.todo',
5656
'sphinx.ext.coverage',
5757
'rstjinja',
58-
'c2rst',
5958
'recommonmark',
6059
]
6160

@@ -66,9 +65,17 @@
6665
source_suffix = {
6766
'.rst': 'restructuredtext',
6867
'.md': 'markdown',
69-
'.c': ''
7068
}
7169

70+
extensions.append('autoapi.extension')
71+
72+
autoapi_type = 'python'
73+
# Uncomment this if debugging autoapi
74+
# autoapi_keep_files = True
75+
autoapi_dirs = ['circuitpython-stubs']
76+
autoapi_add_toctree_entry = False
77+
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members', 'show-module-summary']
78+
autoapi_template_dir = 'docs/autoapi/templates'
7279

7380
# The encoding of source files.
7481
#source_encoding = 'utf-8-sig'
@@ -78,7 +85,7 @@
7885

7986
# General information about the project.
8087
project = 'Adafruit CircuitPython'
81-
copyright = '2014-2018, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
88+
copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
8289

8390
# These are overwritten on ReadTheDocs.
8491
# The version info for the project you're documenting, acts as replacement for
@@ -105,6 +112,7 @@
105112
".git",
106113
".venv",
107114
".direnv",
115+
"docs/autoapi",
108116
"docs/README.md",
109117
"drivers",
110118
"examples",

Diff for: docs/c2rst.py

-31
This file was deleted.

Diff for: ports/atmel-samd/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ Port Specific modules
2121
---------------------
2222

2323
.. toctree::
24-
bindings/samd/__init__
24+
../../autoapi/samd/index

Diff for: ports/atmel-samd/bindings/samd/Clock.c

+13-23
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,12 @@
3030
#include "py/objproperty.h"
3131
#include "py/runtime.h"
3232

33-
//| .. currentmodule:: samd
33+
//| import typing
34+
//| class Clock:
35+
//| """Identifies a clock on the microcontroller.
3436
//|
35-
//| :class:`Clock` --- Clock reference
36-
//| ------------------------------------------
37-
//|
38-
//| Identifies a clock on the microcontroller.
39-
//|
40-
//| .. class:: Clock
41-
//|
42-
//| Identifies a clock on the microcontroller. They are fixed by the
43-
//| hardware so they cannot be constructed on demand. Instead, use
44-
//| `samd.clock` to reference the desired clock.
37+
//| They are fixed by the hardware so they cannot be constructed on demand. Instead, use
38+
//| ``samd.clock`` to reference the desired clock."""
4539
//|
4640

4741
STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
@@ -50,9 +44,8 @@ STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print
5044
mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name);
5145
}
5246

53-
//| .. attribute:: enabled
54-
//|
55-
//| Is the clock enabled? (read-only)
47+
//| enabled: bool = ...
48+
//| """Is the clock enabled? (read-only)"""
5649
//|
5750
STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) {
5851
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -69,9 +62,8 @@ const mp_obj_property_t samd_clock_enabled_obj = {
6962
},
7063
};
7164

72-
//| .. attribute:: parent
73-
//|
74-
//| Clock parent. (read-only)
65+
//| parent: typing.Union(Clock | None) = ...
66+
//| """Clock parent. (read-only)"""
7567
//|
7668
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
7769
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -98,9 +90,8 @@ const mp_obj_property_t samd_clock_parent_obj = {
9890
},
9991
};
10092

101-
//| .. attribute:: frequency
102-
//|
103-
//| Clock frequency. (read-only)
93+
//| frequency: int = ...
94+
//| """Clock frequency in Herz. (read-only)"""
10495
//|
10596
STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) {
10697
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -117,9 +108,8 @@ const mp_obj_property_t samd_clock_frequency_obj = {
117108
},
118109
};
119110

120-
//| .. attribute:: calibration
121-
//|
122-
//| Clock calibration. Not all clocks can be calibrated.
111+
//| calibration: int = ...
112+
//| """Clock calibration. Not all clocks can be calibrated."""
123113
//|
124114
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {
125115
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);

Diff for: ports/atmel-samd/bindings/samd/__init__.c

+3-16
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,16 @@
3030

3131
#include "bindings/samd/Clock.h"
3232

33-
//| :mod:`samd` --- SAMD implementation settings
34-
//| =================================================
35-
//|
36-
//| .. module:: samd
37-
//| :synopsis: SAMD implementation settings
38-
//| :platform: SAMD21
39-
//|
40-
//| Libraries
41-
//|
42-
//| .. toctree::
43-
//| :maxdepth: 3
44-
//|
45-
//| Clock
46-
//|
33+
//| """SAMD implementation settings"""
4734

48-
//| :mod:`samd.clock` --- samd clock names
35+
//| """:mod:`samd.clock` --- samd clock names
4936
//| --------------------------------------------------------
5037
//|
5138
//| .. module:: samd.clock
5239
//| :synopsis: samd clock names
5340
//| :platform: SAMD21
5441
//|
55-
//| References to clocks as named by the microcontroller
42+
//| References to clocks as named by the microcontroller"""
5643
//|
5744
const mp_obj_module_t samd_clock_module = {
5845
.base = { &mp_type_module },

Diff for: setup.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
stub_root = Path("circuitpython-stubs")
66
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
77

8-
now = datetime.utcnow()
9-
version = now.strftime("%Y.%m.%d")
10-
118
setup(
129
name="circuitpython-stubs",
1310
description="PEP 561 type stubs for CircuitPython",
1411
url="https://github.com/adafruit/circuitpython",
1512
maintainer="CircuitPythonistas",
1613
author_email="circuitpython@adafruit.com",
17-
version=version,
14+
use_scm_version=True,
1815
license="MIT",
1916
package_data={"circuitpython-stubs": stubs},
2017
packages=["circuitpython-stubs"],
21-
setup_requires=["setuptools>=38.6.0"],
18+
setup_requires=["setuptools>=38.6.0",
19+
"setuptools_scm"],
2220
)

Diff for: shared-bindings/_bleio/Adapter.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@
4848
#define WINDOW_DEFAULT (0.1f)
4949

5050
//| class Adapter:
51-
//| """.. currentmodule:: _bleio
52-
//|
53-
//| :class:`Adapter` --- BLE adapter
54-
//| ----------------------------------------------------
51+
//| """BLE adapter
5552
//|
5653
//| The Adapter manages the discovery and connection to other nearby Bluetooth Low Energy devices.
5754
//| This part of the Bluetooth Low Energy Specification is known as Generic Access Profile (GAP).

Diff for: shared-bindings/_bleio/Address.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@
3535
#include "shared-module/_bleio/Address.h"
3636

3737
//| class Address:
38-
//| """.. currentmodule:: _bleio
39-
//|
40-
//| :class:`Address` -- BLE address
41-
//| =========================================================
42-
//|
43-
//| Encapsulates the address of a BLE device."""
38+
//| """Encapsulates the address of a BLE device."""
4439
//|
4540

4641
//| def __init__(self, address: buf, address_type: Any):
@@ -97,7 +92,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
9792
//| >>> _bleio.adapter.address
9893
//| <Address c8:1d:f5:ed:a8:35>
9994
//| >>> _bleio.adapter.address.address_bytes
100-
//| b'5\xa8\xed\xf5\x1d\xc8'"""
95+
//| b'5\\xa8\\xed\\xf5\\x1d\\xc8'"""
10196
//|
10297
STATIC mp_obj_t bleio_address_get_address_bytes(mp_obj_t self_in) {
10398
bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in);

Diff for: shared-bindings/_bleio/Attribute.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@
3030
#include "shared-bindings/_bleio/UUID.h"
3131

3232
//| class Attribute:
33-
//| """.. currentmodule:: _bleio
33+
//| """Definitions associated with all BLE attributes: characteristics, descriptors, etc.
3434
//|
35-
//| :class:`Attribute` -- BLE Attribute
36-
//| =========================================================
37-
//|
38-
//| Definitions associated with all BLE attributes: characteristics, descriptors, etc.
3935
//| :py:class:`~_bleio.Attribute` is, notionally, a superclass of
4036
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
4137
//| but is not defined as a Python superclass of those classes."""

Diff for: shared-bindings/_bleio/Characteristic.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@
3434
#include "shared-bindings/_bleio/UUID.h"
3535

3636
//| class Characteristic:
37-
//| """.. currentmodule:: _bleio
38-
//|
39-
//| :class:`Characteristic` -- BLE service characteristic
40-
//| =========================================================
41-
//|
42-
//| Stores information about a BLE service characteristic and allows reading
43-
//| and writing of the characteristic's value."""
37+
//| """Stores information about a BLE service characteristic and allows reading
38+
//| and writing of the characteristic's value."""
4439
//|
4540
//| def __init__(self, ):
4641
//| """There is no regular constructor for a Characteristic. A new local Characteristic can be created

Diff for: shared-bindings/_bleio/CharacteristicBuffer.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
4242
}
4343

4444
//| class CharacteristicBuffer:
45-
//| """.. currentmodule:: _bleio
46-
//|
47-
//| :class:`CharacteristicBuffer` -- BLE Service incoming values buffer.
48-
//| =====================================================================
49-
//|
50-
//| Accumulates a Characteristic's incoming values in a FIFO buffer."""
45+
//| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
5146
//|
5247
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64):
5348
//|

Diff for: shared-bindings/_bleio/Connection.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@
4343
#include "shared-bindings/_bleio/Service.h"
4444

4545
//| class Connection:
46-
//| """.. currentmodule:: _bleio
47-
//|
48-
//| :class:`Connection` -- A BLE connection
49-
//| =========================================================
50-
//|
51-
//| A BLE connection to another device. Used to discover and interact with services on the other
46+
//| """A BLE connection to another device. Used to discover and interact with services on the other
5247
//| device.
5348
//|
5449
//| Usage::
@@ -211,15 +206,14 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) {
211206
}
212207
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval);
213208

214-
//| .. attribute:: max_packet_length
215-
//|
216-
//| The maximum number of data bytes that can be sent in a single transmission,
209+
//| attribute: Any = ...
210+
//| """The maximum number of data bytes that can be sent in a single transmission,
217211
//| not including overhead bytes.
218212
//|
219213
//| This is the maximum number of bytes that can be sent in a notification,
220214
//| which must be sent in a single packet.
221215
//| But for a regular characteristic read or write, may be sent in multiple packets,
222-
//| so this limit does not apply.
216+
//| so this limit does not apply."""
223217
//|
224218
STATIC mp_obj_t bleio_connection_get_max_packet_length(mp_obj_t self_in) {
225219
bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in);

Diff for: shared-bindings/_bleio/Descriptor.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@
3434
#include "shared-bindings/_bleio/UUID.h"
3535

3636
//| class Descriptor:
37-
//| """.. currentmodule:: _bleio
37+
//| """Stores information about a BLE descriptor.
3838
//|
39-
//| :class:`Descriptor` -- BLE descriptor
40-
//| =========================================================
41-
//|
42-
//| Stores information about a BLE descriptor.
4339
//| Descriptors are attached to BLE characteristics and provide contextual
4440
//| information about the characteristic."""
4541
//|

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/adafruit/circuitpython/commit/4e8de3c554024d3ac89e9ee77b958a6932a64bec

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy