Skip to content

Commit 8e6feec

Browse files
authored
Merge pull request adafruit#863 from dhalbert/3.0_doc_updates
RTD documentation updates
2 parents 65cfbda + bbdca2f commit 8e6feec

File tree

9 files changed

+82
-89
lines changed

9 files changed

+82
-89
lines changed

README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,15 @@ 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 enabled for most M0
112+
Express boards (those boards with SPI flash chips external
113+
to the microcontroller), and for all M4 builds.
114+
Longints are disabled on other boards due to lack of flash space.
110115

111116
Behavior
112117
~~~~~~~~

docs/design_guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ buffers.
441441
Examples
442442
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
443443

444-
ustruct.pack
444+
struct.pack
445445
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
446446

447-
Use `ustruct.pack_into` instead of `ustruct.pack`.
447+
Use `struct.pack_into` instead of `struct.pack`.
448448

449449
Sensor properties and units
450450
--------------------------------------------------------------------------------

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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Functions
3131
.. admonition:: Difference to CPython
3232
:class: attention
3333

34-
This function is MicroPython extension.
34+
This function is a MicroPython extension.
3535

3636
.. function:: mem_free()
3737

@@ -41,7 +41,7 @@ Functions
4141
.. admonition:: Difference to CPython
4242
:class: attention
4343

44-
This function is MicroPython extension.
44+
This function is a MicroPython extension.
4545

4646
.. function:: threshold([amount])
4747

@@ -63,6 +63,6 @@ Functions
6363
.. admonition:: Difference to CPython
6464
:class: attention
6565

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

docs/library/index.rst

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,74 @@
33
MicroPython libraries
44
=====================
55

6+
Python standard libraries and micro-libraries
7+
---------------------------------------------
8+
9+
These libraries are inherited from MicroPython.
10+
They are similar to the standard Python libraries with the same name
11+
or with the "u" prefix dropped.
12+
They implement a subset of or a variant of the corresponding
13+
standard Python library.
14+
615
.. warning::
716

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.
17+
Though these MicroPython-based libraries are available in CircuitPython,
18+
their functionality may change in the future, perhaps significantly.
19+
As CircuitPython continues to develop, new versions of these libraries will
20+
be created that are more compliant with the standard Python libraries.
21+
You may need to change your code later if you rely
22+
on any non-standard functionality they currently provide.
1023

24+
CircuitPython's goal long-term goalis that code written in CircuitPython
25+
using Python standard libraries will be runnable on CPython without changes.
1126

12-
Python standard libraries and micro-libraries
13-
---------------------------------------------
27+
Some libraries below are not enabled on CircuitPython builds with
28+
limited flash memory, usually on non-Express builds:
29+
``uerrno``, ``ure``.
30+
31+
Some libraries are not currently enabled in any CircuitPython build, but may be in the future:
32+
``uio``, ``ujson``, ``uzlib``.
1433

34+
Some libraries are only enabled only WiFi-capable ports (ESP8266, nRF)
35+
because they are typically used for network software:
36+
``binascii``, ``hashlib``, ``uheapq``, ``uselect``, ``ussl``.
37+
Not all of these are enabled on all WiFi-capable ports.
1538

1639
.. toctree::
1740
:maxdepth: 1
1841

1942
builtins.rst
43+
uheapq.rst
2044
array.rst
21-
gc.rst
22-
sys.rst
2345
binascii.rst
2446
collections.rst
25-
uerrno.rst
47+
gc.rst
2648
hashlib.rst
27-
uheapq.rst
49+
sys.rst
50+
uerrno.rst
2851
uio.rst
2952
ujson.rst
3053
ure.rst
3154
uselect.rst
3255
usocket.rst
3356
ussl.rst
34-
ustruct.rst
3557
uzlib.rst
3658

59+
Omitted functions in the ``string`` library
60+
-------------------------------------------
61+
62+
A few string operations are not enabled on CircuitPython
63+
M0 non-Express builds, due to limited flash memory:
64+
``string.center()``, ``string.partition()``, ``string.splitlines()``,
65+
``string.reversed()``.
66+
3767

38-
MicroPython-specific libraries
39-
------------------------------
68+
CircuitPython/MicroPython-specific libraries
69+
--------------------------------------------
4070

41-
Functionality specific to the MicroPython implementation is available in
42-
the following libraries.
71+
Functionality specific to the CircuitPython/MicroPython implementation is available in
72+
the following libraries. These libraries may change signficantly or be removed in future
73+
versions of CircuitPtyon.
4374

4475
.. toctree::
4576
:maxdepth: 1

docs/library/sys.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,26 @@ Constants
4545
.. data:: implementation
4646

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

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

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

5757
.. admonition:: Difference to CPython
5858
:class: attention
5959

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

6363
.. data:: maxsize
6464

6565
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
66+
or maximum value representable by CircuitPython integer type, if it's smaller
67+
than platform max value (that is the case for CircuitPython ports without
6868
long int support).
6969

7070
This attribute is useful for detecting "bitness" of a platform (32-bit vs
@@ -96,11 +96,11 @@ Constants
9696

9797
.. data:: platform
9898

99-
The platform that MicroPython is running on. For OS/RTOS ports, this is
99+
The platform that CircuitPython is running on. For OS/RTOS ports, this is
100100
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.
103-
If you need to check whether your program runs on MicroPython (vs other
101+
is an identifier of the chip on a board, e.g. ``"MicroChip SAMD51"``.
102+
It thus can be used to distinguish one board from another.
103+
If you need to check whether your program runs on CircuitPython (vs other
104104
Python implementation), use `sys.implementation` instead.
105105

106106
.. data:: stderr

docs/library/ustruct.rst

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.. warning::
22

3-
This module is inherited from MicroPython and may not work in CircuitPython
4-
as documented or at all! If they do work, they may change at any time. It is
5-
unsupported.
3+
Though this MicroPython-based library is available for use in CircuitPython,
4+
its functionality may change in the future, perhaps significantly.
5+
As CircuitPython continues to develop, it may be changed
6+
to comply more closely with the corresponding standard Python library.
7+
You may need to change your code later if you rely
8+
on any non-standard functionality it currently provides.

0 commit comments

Comments
 (0)