Skip to content

Commit e65cc07

Browse files
committed
RTD documentation updates
1 parent 22405d6 commit e65cc07

7 files changed

Lines changed: 65 additions & 47 deletions

File tree

README.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ Differences from `MicroPython <https://github.com/micropython/micropython>`__
103103

104104
CircuitPython:
105105

106-
- includes a port for Atmel SAMD21 (Commonly known as M0 in Adafruit
107-
product names.)
108-
- supports only Atmel SAMD21 and ESP8266 ports.
106+
- includes a ports for MicroChip SAMD21 (Commonly known as M0 in Adafruit
107+
product names and SAMD51 (M4).
108+
- supports only SAMD21, SAMD51, and ESP8266 ports. An nRF port is under
109+
development.
109110
- tracks MicroPython's releases (not master).
111+
- Longints (arbitrary-length integers) are turned on for most Express builds
112+
(those boards with SPI flash chips external to the microcontroller),
113+
but not for boards without SPI flash, for space reasons.
110114

111115
Behavior
112116
~~~~~~~~

docs/library/array.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
:mod:`array` -- arrays of numeric data
22
======================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
64
.. module:: array
75
:synopsis: efficient arrays of numeric data
86

docs/library/builtins.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
Builtin functions and exceptions
22
================================
33

4-
.. warning::
5-
6-
These builtins are inherited from MicroPython and may not work in CircuitPython
7-
as documented or at all! If work differently from CPython, then their behavior
8-
may change.
9-
104
All builtin functions and exceptions are described here. They are also
115
available via ``builtins`` module.
126

137
Functions and types
148
-------------------
159

10+
Not all of these functions and types are turned on in all CircuitPython ports, for space reasons.
11+
1612
.. function:: abs()
1713

1814
.. function:: all()
@@ -62,6 +58,8 @@ Functions and types
6258

6359
.. class:: frozenset()
6460

61+
`frozenset() is not enabled on non-Express CircuitPython boards.`
62+
6563
.. function:: getattr()
6664

6765
.. function:: globals()
@@ -80,12 +78,12 @@ Functions and types
8078

8179
.. classmethod:: from_bytes(bytes, byteorder)
8280

83-
In MicroPython, `byteorder` parameter must be positional (this is
81+
In CircuitPython, `byteorder` parameter must be positional (this is
8482
compatible with CPython).
8583

8684
.. method:: to_bytes(size, byteorder)
8785

88-
In MicroPython, `byteorder` parameter must be positional (this is
86+
In CircuitPython, `byteorder` parameter must be positional (this is
8987
compatible with CPython).
9088

9189
.. function:: isinstance()
@@ -130,6 +128,8 @@ Functions and types
130128

131129
.. function:: reversed()
132130

131+
`reversed() is not enabled on non-Express CircuitPython boards.`
132+
133133
.. function:: round()
134134

135135
.. class:: set()
@@ -182,7 +182,7 @@ Exceptions
182182

183183
.. exception:: OSError
184184

185-
|see_cpython| `OSError`. MicroPython doesn't implement ``errno``
185+
|see_cpython| `OSError`. CircuitPython doesn't implement the ``errno``
186186
attribute, instead use the standard way to access exception arguments:
187187
``exc.args[0]``.
188188

docs/library/gc.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
:mod:`gc` -- control the garbage collector
22
==========================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
64
.. module:: gc
75
:synopsis: control the garbage collector
86

@@ -31,7 +29,7 @@ Functions
3129
.. admonition:: Difference to CPython
3230
:class: attention
3331

34-
This function is MicroPython extension.
32+
This function is a MicroPython extension.
3533

3634
.. function:: mem_free()
3735

@@ -41,7 +39,7 @@ Functions
4139
.. admonition:: Difference to CPython
4240
:class: attention
4341

44-
This function is MicroPython extension.
42+
This function is a MicroPython extension.
4543

4644
.. function:: threshold([amount])
4745

@@ -63,6 +61,6 @@ Functions
6361
.. admonition:: Difference to CPython
6462
:class: attention
6563

66-
This function is a MicroPython extension. CPython has a similar
64+
This function is a a MicroPython extension. CPython has a similar
6765
function - ``set_threshold()``, but due to different GC
6866
implementations, its signature and semantics are different.

docs/library/index.rst

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,66 @@
11
.. _micropython_lib:
22

3-
MicroPython libraries
3+
CircuitPython libraries
44
=====================
55

6-
.. warning::
6+
Python standard libraries and micro-libraries
7+
---------------------------------------------
78

8-
These modules are inherited from MicroPython and may not work in CircuitPython
9-
as documented or at all! If they do work, they may change at any time.
9+
These libraries are the same or are subsets or slight variants of the standard Python libraries.
1010

11+
MicroPython prefixed many of these libraries with ``u``. In CircuitPython, those
12+
that are subsets or the same as the standard Python libraries have been or will be renamed
13+
to their original names.
14+
Our aspiration is that code written in CircuitPython
15+
that uses Python standard libraries will be runnable on CPython without changes.
16+
But we may fall short of this goal in some cases.
1117

12-
Python standard libraries and micro-libraries
13-
---------------------------------------------
18+
Some of the libraries below are not enabled on CircuitPython builds with
19+
limited flash memory, usually on non-Express builds:
20+
``uerrno``, ``ure``.
1421

22+
Some libraries are not currently enabled in any CircuitPython build, but may be in the future:
23+
``uio``, ``ujson``, ``uzlib``.
24+
25+
Some libraries are only enabled only WiFi-capable ports (ESP8266, nRF)
26+
because they are typically used for network software:
27+
``binascii``, ``hashlib``, ``uheapq``, ``uselect``, ``ussl``.
28+
Not all of these are enabled on all WiFi-capable ports.
1529

1630
.. toctree::
1731
:maxdepth: 1
1832

1933
builtins.rst
34+
uheapq.rst
2035
array.rst
21-
gc.rst
22-
sys.rst
2336
binascii.rst
2437
collections.rst
25-
uerrno.rst
38+
gc.rst
2639
hashlib.rst
27-
uheapq.rst
40+
struct.rst
41+
sys.rst
42+
uerrno.rst
2843
uio.rst
2944
ujson.rst
3045
ure.rst
3146
uselect.rst
3247
usocket.rst
3348
ussl.rst
34-
ustruct.rst
3549
uzlib.rst
3650

51+
Omitted functions in the ``string`` library
52+
-------------------------------------------
53+
54+
A few string operations are not enabled on CircuitPython builds with
55+
limited flash memory, usually on non-Express builds:
56+
``string.center()``, ``string.partition()``, ``string.splitlines()``,
57+
``string.reversed()``.
58+
3759

38-
MicroPython-specific libraries
60+
CircuitPython/MicroPython-specific libraries
3961
------------------------------
4062

41-
Functionality specific to the MicroPython implementation is available in
63+
Functionality specific to the CircuitPython (MicroPython) implementation is available in
4264
the following libraries.
4365

4466
.. toctree::
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
:mod:`ustruct` -- pack and unpack primitive data types
1+
:mod:`struct` -- pack and unpack primitive data types
22
======================================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
6-
.. module:: ustruct
4+
.. module:: struct
75
:synopsis: pack and unpack primitive data types
86

97
|see_cpython_module| :mod:`cpython:struct`.

docs/library/sys.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
:mod:`sys` -- system specific functions
22
=======================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
64
.. module:: sys
75
:synopsis: system specific functions
86

@@ -45,26 +43,26 @@ Constants
4543
.. data:: implementation
4644

4745
Object with information about the current Python implementation. For
48-
MicroPython, it has following attributes:
46+
CircuitPython, it has following attributes:
4947

50-
* *name* - string "micropython"
48+
* *name* - string "circuitpython"
5149
* *version* - tuple (major, minor, micro), e.g. (1, 7, 0)
5250

53-
This object is the recommended way to distinguish MicroPython from other
51+
This object is the recommended way to distinguish CircuitPython from other
5452
Python implementations (note that it still may not exist in the very
5553
minimal ports).
5654

5755
.. admonition:: Difference to CPython
5856
:class: attention
5957

6058
CPython mandates more attributes for this object, but the actual useful
61-
bare minimum is implemented in MicroPython.
59+
bare minimum is implemented in CircuitPython.
6260

6361
.. data:: maxsize
6462

6563
Maximum value which a native integer type can hold on the current platform,
66-
or maximum value representable by MicroPython integer type, if it's smaller
67-
than platform max value (that is the case for MicroPython ports without
64+
or maximum value representable by CircuitPython integer type, if it's smaller
65+
than platform max value (that is the case for CircuitPython ports without
6866
long int support).
6967

7068
This attribute is useful for detecting "bitness" of a platform (32-bit vs
@@ -96,10 +94,10 @@ Constants
9694

9795
.. data:: platform
9896

99-
The platform that MicroPython is running on. For OS/RTOS ports, this is
97+
The platform that CircuitPython is running on. For OS/RTOS ports, this is
10098
usually an identifier of the OS, e.g. ``"linux"``. For baremetal ports it
101-
is an identifier of a board, e.g. ``"pyboard"`` for the original MicroPython
102-
reference board. It thus can be used to distinguish one board from another.
99+
is an identifier of the chip on a board, e.g. ``"MicroChip SAMD51"``.
100+
It thus can be used to distinguish one board from another.
103101
If you need to check whether your program runs on MicroPython (vs other
104102
Python implementation), use `sys.implementation` instead.
105103

0 commit comments

Comments
 (0)