Skip to content

Commit 69869e1

Browse files
committed
CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup
1 parent 97f5d21 commit 69869e1

File tree

18 files changed

+96
-154
lines changed

18 files changed

+96
-154
lines changed

docs/library/uerrno.rst renamed to docs/library/errno.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
:mod:`uerrno` -- system error codes
1+
:mod:`errno` -- system error codes
22
===================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
6-
.. module:: uerrno
4+
.. module:: errno
75
:synopsis: system error codes
86

97
|see_cpython_module| :mod:`cpython:errno`.
@@ -22,13 +20,13 @@ Constants
2220
try:
2321
os.mkdir("my_dir")
2422
except OSError as exc:
25-
if exc.args[0] == uerrno.EEXIST:
23+
if exc.args[0] == errno.EEXIST:
2624
print("Directory already exists")
2725

2826
.. data:: errorcode
2927

3028
Dictionary mapping numeric error codes to strings with symbolic error
3129
code (see above)::
3230

33-
>>> print(uerrno.errorcode[uerrno.EEXIST])
31+
>>> print(errno.errorcode[uerrno.EEXIST])
3432
EEXIST

docs/library/index.rst

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,20 @@ Python standard libraries and micro-libraries
77
---------------------------------------------
88

99
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.
10+
They are similar to the standard Python libraries with the same name.
1211
They implement a subset of or a variant of the corresponding
1312
standard Python library.
1413

15-
.. warning::
16-
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.
23-
2414
CircuitPython's long-term goal is that code written in CircuitPython
2515
using Python standard libraries will be runnable on CPython without changes.
2616

27-
Some libraries below are not enabled on CircuitPython builds with
17+
These libraries are not enabled on CircuitPython builds with
2818
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``.
19+
``binascii``, ``errno``, ``json``, ``re``.
3320

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.
21+
These libraries are not currently enabled in any CircuitPython build, but may be in the future,
22+
with the ``u`` prefix dropped:
23+
``uctypes`, ``uhashlib``, ``uio``, ``uzlib``.
3824

3925
.. toctree::
4026
:maxdepth: 1
@@ -44,13 +30,14 @@ Not all of these are enabled on all WiFi-capable ports.
4430
array.rst
4531
binascii.rst
4632
collections.rst
33+
errno.rst
4734
gc.rst
4835
hashlib.rst
36+
io.rst
37+
json.rst
38+
re.rst
4939
sys.rst
50-
uerrno.rst
51-
uio.rst
52-
ujson.rst
53-
ure.rst
40+
uctypes.rst
5441
uselect.rst
5542
usocket.rst
5643
ussl.rst
@@ -59,8 +46,8 @@ Not all of these are enabled on all WiFi-capable ports.
5946
Omitted functions in the ``string`` library
6047
-------------------------------------------
6148

62-
A few string operations are not enabled on CircuitPython
63-
M0 non-Express builds, due to limited flash memory:
49+
A few string operations are not enabled on small builds
50+
(usually non-Express), due to limited flash memory:
6451
``string.center()``, ``string.partition()``, ``string.splitlines()``,
6552
``string.reversed()``.
6653

@@ -78,15 +65,3 @@ versions of CircuitPython.
7865
btree.rst
7966
framebuf.rst
8067
micropython.rst
81-
network.rst
82-
uctypes.rst
83-
84-
Libraries specific to the ESP8266
85-
---------------------------------
86-
87-
The following libraries are specific to the ESP8266.
88-
89-
.. toctree::
90-
:maxdepth: 2
91-
92-
esp.rst

docs/library/uio.rst renamed to docs/library/io.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
:mod:`uio` -- input/output streams
1+
:mod:`io` -- input/output streams
22
==================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
6-
.. module:: uio
4+
.. module:: io
75
:synopsis: input/output streams
86

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

docs/library/ujson.rst renamed to docs/library/json.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
:mod:`ujson` -- JSON encoding and decoding
1+
:mod:`json` -- JSON encoding and decoding
22
==========================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
6-
.. module:: ujson
4+
.. module:: json
75
:synopsis: JSON encoding and decoding
86

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

docs/library/ure.rst renamed to docs/library/re.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
:mod:`ure` -- simple regular expressions
1+
:mod:`re` -- simple regular expressions
22
========================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
6-
.. module:: ure
4+
.. module:: re
75
:synopsis: regular expressions
86

97
|see_cpython_module| :mod:`cpython:re`.
@@ -77,7 +75,7 @@ Regex objects
7775
-------------
7876

7977
Compiled regular expression. Instances of this class are created using
80-
`ure.compile()`.
78+
`re.compile()`.
8179

8280
.. method:: regex.match(string)
8381
regex.search(string)

docs/shared_bindings_matrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from concurrent.futures import ThreadPoolExecutor
3232

33-
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
33+
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm']
3434

3535
def get_circuitpython_root_dir():
3636
""" The path to the root './circuitpython' directory
@@ -44,7 +44,7 @@ def get_shared_bindings():
4444
""" Get a list of modules in shared-bindings based on folder names
4545
"""
4646
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
47-
return [item.name for item in shared_bindings_dir.iterdir()] + ["ulab"]
47+
return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"]
4848

4949

5050
def read_mpconfig():

ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
#define IGNORE_PIN_PA24 1
4545
#define IGNORE_PIN_PA25 1
4646

47-
#define MICROPY_PY_URE 0
47+
// Can't fit.
48+
#define CIRCUITPY_RE 0

ports/atmel-samd/mpconfigport.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@
4545
#define MICROPY_PY_BUILTINS_COMPLEX (0)
4646
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
4747
#define MICROPY_PY_FUNCTION_ATTRS (0)
48-
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
49-
#define MICROPY_PY_IO (0)
5048
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
51-
#define MICROPY_PY_UBINASCII (0)
52-
#define MICROPY_PY_UJSON (0)
5349
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
5450
#define MICROPY_PY_UERRNO_LIST \
5551
X(EPERM) \
@@ -84,9 +80,6 @@
8480
#define SPI_FLASH_MAX_BAUDRATE 24000000
8581
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
8682
#define MICROPY_PY_FUNCTION_ATTRS (1)
87-
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
88-
#define MICROPY_PY_IO (1)
89-
#define MICROPY_PY_UJSON (1)
9083
// MICROPY_PY_UERRNO_LIST - Use the default
9184

9285
#endif // SAM_D5X_E5X

ports/atmel-samd/mpconfigport.mk

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,16 @@ endif
2020

2121
# Put samd21-only choices here.
2222
ifeq ($(CHIP_FAMILY),samd21)
23-
# frequencyio not yet verified as working on SAMD21, though make it possible to override.
24-
ifndef CIRCUITPY_AUDIOMIXER
25-
CIRCUITPY_AUDIOMIXER = 0
26-
endif
27-
28-
ifndef CIRCUITPY_AUDIOMP3
29-
CIRCUITPY_AUDIOMP3 = 0
30-
endif
31-
32-
ifndef CIRCUITPY_BUILTINS_POW3
33-
CIRCUITPY_BUILTINS_POW3 = 0
34-
endif
3523

36-
ifndef CIRCUITPY_FREQUENCYIO
37-
CIRCUITPY_FREQUENCYIO = 0
38-
endif
24+
# The ?='s allow overriding in mpconfigboard.mk.
3925

40-
ifndef CIRCUITPY_TOUCHIO_USE_NATIVE
41-
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
42-
endif
26+
CIRCUITPY_AUDIOMIXER ?= 0
27+
CIRCUITPY_BINASCII ?= 0
28+
CIRCUITPY_AUDIOMP3 ?= 0
29+
CIRCUITPY_BUILTINS_POW3 ?= 0
30+
CIRCUITPY_FREQUENCYIO ?= 0
31+
CIRCUITPY_JSON ?= 0
32+
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
4333

4434
# No room for HCI _bleio on SAMD21.
4535
CIRCUITPY_BLEIO_HCI = 0
@@ -71,27 +61,13 @@ ifeq ($(CHIP_FAMILY),samd51)
7161
# No native touchio on SAMD51.
7262
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
7363

74-
# The ifndef's allow overriding in mpconfigboard.mk.
75-
76-
ifndef CIRCUITPY_NETWORK
77-
CIRCUITPY_NETWORK = 0
78-
endif
79-
80-
ifndef CIRCUITPY_PS2IO
81-
CIRCUITPY_PS2IO = 1
82-
endif
83-
84-
ifndef CIRCUITPY_SAMD
85-
CIRCUITPY_SAMD = 1
86-
endif
87-
88-
ifndef CIRCUITPY_RGBMATRIX
89-
CIRCUITPY_RGBMATRIX = $(CIRCUITPY_FULL_BUILD)
90-
endif
64+
# The ?='s allow overriding in mpconfigboard.mk.
9165

92-
ifndef CIRCUITPY_FRAMEBUFFERIO
93-
CIRCUITPY_FRAMEBUFFERIO = $(CIRCUITPY_FULL_BUILD)
94-
endif
66+
CIRCUITPY_NETWORK ?= 0
67+
CIRCUITPY_PS2IO ?= 1
68+
CIRCUITPY_SAMD ?= 1
69+
CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FULL_BUILD)
70+
CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD)
9571

9672
endif # samd51
9773

ports/esp32s2/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#define MICROPY_NLR_THUMB (0)
3232

33-
#define MICROPY_PY_UJSON (1)
3433
#define MICROPY_USE_INTERNAL_PRINTF (0)
3534
#define MICROPY_PY_SYS_PLATFORM "Espressif ESP32-S2"
3635

0 commit comments

Comments
 (0)