-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enable collections deque for raspberrypi #6474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable collections deque for raspberrypi #6474
Conversation
In general, we try not to enable language features for just one port, because then we can't write port-independent code. So we would like to turn this for as many ports as possible, assuming there's room, rather than just RP2040. So let's try turning it on if CIRCUITPY_FULL_BUILD is true. |
I'd like to use `collections.deque`: https://docs.circuitpython.org/en/latest/docs/library/collections.html#collections.deque ...on my RP2040-based Keybow 2040 (https://circuitpython.org/board/pimoroni_keybow2040/). For MicroPython, `collections.deque` is enabled for all `rp2` devices, because they all have `MICROPY_CONFIG_ROM_LEVEL` set to 'extra features': ``` ``` https://github.com/micropython/micropython/blob/cf7d962cf38db296d1ac419fc4d5302b64c59644/ports/rp2/mpconfigport.h#L44 ...which includes `MICROPY_PY_COLLECTIONS_DEQUE` (see https://github.com/micropython/micropython/blob/6bda80d81147217a1d830b99b93d2e35d372e8f9/py/mpconfig.h#L1225-L1227 ). For CircuitPython, it looks like `MICROPY_CONFIG_ROM_LEVEL` defaults to 'core' (`MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES`) and isn't updated against any of the ports, so the only port getting `collections.deque` is the `unix` port, which explcitly sets `MICROPY_PY_COLLECTIONS_DEQUE`: https://github.com/adafruit/circuitpython/blob/6925a001382d41940ea9b412b1d1ba517d9880f9/ports/unix/mpconfigport.h#L134 At Dan Halbert's suggestion... adafruit#6474 (comment) ... this commit enables `MICROPY_PY_COLLECTIONS_DEQUE` for all builds where `CIRCUITPY_FULL_BUILD` is true - which includes Raspberry Pi: https://github.com/adafruit/circuitpython/blob/6925a001382d41940ea9b412b1d1ba517d9880f9/ports/raspberrypi/mpconfigport.mk#L11 See also: * adafruit#5734 * micropython@970eedc which originally added collections.deque to MicroPython
cc68d3d
to
6269bbd
Compare
I tried a local implementation with just this in MICROPY_PY_COLLECTIONS_DEQUE ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DMICROPY_PY_COLLECTIONS_DEQUE=$(MICROPY_PY_COLLECTIONS_DEQUE) |
6269bbd
to
7f9ff9c
Compare
7f9ff9c
to
6925a00
Compare
I'd like to use `collections.deque`: https://docs.circuitpython.org/en/latest/docs/library/collections.html#collections.deque ...on my RP2040-based Keybow 2040 (https://circuitpython.org/board/pimoroni_keybow2040/). For MicroPython, `collections.deque` is enabled for all `rp2` devices, because they all have `MICROPY_CONFIG_ROM_LEVEL` set to 'extra features': https://github.com/micropython/micropython/blob/cf7d962cf38db296d1ac419fc4d5302b64c59644/ports/rp2/mpconfigport.h#L44 ...which includes `MICROPY_PY_COLLECTIONS_DEQUE` (see https://github.com/micropython/micropython/blob/6bda80d81147217a1d830b99b93d2e35d372e8f9/py/mpconfig.h#L1225-L1227 ). For CircuitPython, it looks like `MICROPY_CONFIG_ROM_LEVEL` defaults to 'core' (`MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES`) and isn't updated against any of the ports, so the only port getting `collections.deque` is the `unix` port, which explcitly sets `MICROPY_PY_COLLECTIONS_DEQUE`: https://github.com/adafruit/circuitpython/blob/6925a001382d41940ea9b412b1d1ba517d9880f9/ports/unix/mpconfigport.h#L134 At Dan Halbert's suggestion... adafruit#6474 (comment) ... this commit enables `MICROPY_PY_COLLECTIONS_DEQUE` for all builds where `CIRCUITPY_FULL_BUILD` is true - which includes Raspberry Pi: https://github.com/adafruit/circuitpython/blob/6925a001382d41940ea9b412b1d1ba517d9880f9/ports/raspberrypi/mpconfigport.mk#L11 See also: * adafruit#5734 * micropython@970eedc which originally added collections.deque to MicroPython
@rtyley did you mean to close this? I reopened. |
I didn't mean to close it! I managed to make a mess with git, and accidentally pushed the branch when it had only an empty merge commit - so GitHub decided that the the PR was effectively merged, and closed it!! I've now fixed the git branch, and updated as per your comment, just setting |
Builds for bluemicro833, feather_m0_express, kicksat-sprite, pca10100, simmel, metro_m0_express failed due to
I don't know if there's a convenient flag distinguishing between those boards and larger boards like the raspberrypi? |
I can make some decisions about which builds to remove |
Many thanks @dhalbert ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I turned deque
off on SAMD21 builds, and made it fit on a few nRF52833 builds that were too tight by turning off some other things that were generally not needed for those boards.
Hi, I'd like to use
collections.deque
on my RP2040-based Keybow 2040. For MicroPython,collections.deque
is enabled for allrp2
devices, because they haveMICROPY_CONFIG_ROM_LEVEL
set to 'extra features':...which includes
MICROPY_PY_COLLECTIONS_DEQUE
.For CircuitPython, it looks like
MICROPY_CONFIG_ROM_LEVEL
defaults to 'core' (MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES
) and isn't updated against any of the ports, so the only port gettingcollections.deque
is theunix
port, which explcitly setsMICROPY_PY_COLLECTIONS_DEQUE
:circuitpython/ports/unix/mpconfigport.h
Line 134 in 6925a00
This commit just enables
MICROPY_PY_COLLECTIONS_DEQUE
in the same manner for theraspberrypi
port.See also:
collections.deque
to MicroPython