-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Please add collections deque to CircuitPython #5734
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
Comments
What board are you using? Some of them won't have space for it. |
I'm using the Raspberry Pi Pico.
I was actually looking in the code to see if I could activate it and
recompile?
Thanks :)
…On Thu, Dec 16, 2021 at 3:14 PM Scott Shawcroft ***@***.***> wrote:
What board are you using? Some of them won't have space for it.
—
Reply to this email directly, view it on GitHub
<#5734 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKBDH547IIX4GKCJAPT44DURJCCDANCNFSM5KG5MDDA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You can set |
Thanks!!
I will definitely try it. It's also going to be an opportunity to learn how
to build it :)
…On Thu, Dec 16, 2021 at 3:25 PM Scott Shawcroft ***@***.***> wrote:
You can set MICROPY_PY_COLLECTIONS_DEQUE to (1) to enable it.
—
Reply to this email directly, view it on GitHub
<#5734 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKBDHZN2GR3V5E6T3FZQJ3URJDLNANCNFSM5KG5MDDA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Another quick question for you - I have changed the code, recompiled and
re-flashed the firmware.
The import now works.
When I try to use it:
self.stored_chars = deque([], 4)
I get a ValueError. I am trying to create an empty queue with a maximum of
4 elements.
Can you please give me a hint as how I can investigate this further, as all
I have is a ValueError without any other trace information?
*code.py output:Traceback (most recent call last): File "code.py", line
130, in <module> File "code.py", line 73, in __init__ValueError: Code done
running.*
Thanks!!
On Thu, Dec 16, 2021 at 3:26 PM Jean-Francois Theoret ***@***.***>
wrote:
… Thanks!!
I will definitely try it. It's also going to be an opportunity to learn
how to build it :)
On Thu, Dec 16, 2021 at 3:25 PM Scott Shawcroft ***@***.***>
wrote:
> You can set MICROPY_PY_COLLECTIONS_DEQUE to (1) to enable it.
>
> —
> Reply to this email directly, view it on GitHub
> <#5734 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAKBDHZN2GR3V5E6T3FZQJ3URJDLNANCNFSM5KG5MDDA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Try |
Excellent, thank you!
…On Fri, Dec 17, 2021 at 10:30 AM Dan Halbert ***@***.***> wrote:
Try deque((), 4). The MicroPython code does not support initialization,
and only allows an empty tuple, not an empty list.
—
Reply to this email directly, view it on GitHub
<#5734 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKBDH7LYOZSFDBQU5DRATDURNJTDANCNFSM5KG5MDDA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I built pycubed_v05 (it's an M4 board with SAMD51J20), with |
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 This commit just enables `MICROPY_PY_COLLECTIONS_DEQUE` in the same manner for the `raspberrypi` port. See also: * adafruit#5734 * micropython@970eedc which originally added collections.deque to MicroPython
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
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 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/micropython@970eedc which originally added collections.deque to MicroPython
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
Fjxed by #6474. Still omitted on some very small builds. |
Hello!
Please activate collections deque in CircuitPython. Thanks!
The text was updated successfully, but these errors were encountered: