10000 Please add collections deque to CircuitPython · Issue #5734 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

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

Closed
jftheoret opened this issue Dec 16, 2021 · 9 comments
Closed

Please add collections deque to CircuitPython #5734

jftheoret opened this issue Dec 16, 2021 · 9 comments
Labels
cpython api modules from cpython enhancement good first issue Hacktoberfest Beginner friendly issues for Hacktoberfest event help wanted rp2040 Raspberry Pi RP2040
Milestone

Comments

@jftheoret
Copy link

Hello!

Please activate collections deque in CircuitPython. Thanks!

@tannewt
Copy link
Member
tannewt commented Dec 16, 2021

What board are you using? Some of them won't have space for it.

@tannewt tannewt added the cpython api modules from cpython label Dec 16, 2021
@tannewt tannewt added this to the Long term milestone Dec 16, 2021
@jftheoret
Copy link
Author
jftheoret commented Dec 16, 2021 via email

@tannewt
Copy link
Member
tannewt commented Dec 16, 2021

You can set MICROPY_PY_COLLECTIONS_DEQUE to (1) to enable it.

@tannewt tannewt added the rp2040 Raspberry Pi RP2040 label Dec 16, 2021
@jftheoret
Copy link
Author
jftheoret commented Dec 16, 2021 via email

@jftheoret
Copy link
Author
jftheoret commented Dec 17, 2021 via email

@dhalbert
Copy link
Collaborator

Try deque((), 4). The MicroPython code does not support initialization, and only allows an empty tuple, not an empty list.

@jftheoret
Copy link
Author
jftheoret commented Dec 17, 2021 via email

@polygnomial
Copy link

I built pycubed_v05 (it's an M4 board with SAMD51J20), with MICROPY_PY_COLLECTIONS_DEQUE = 1, but the module is not available in CircuitPython. The .o file is missing from the build/py folder. I also tried with a couple of other combinations of MICROPY_PY_COLLECTIONS etc, but have not gotten it to work. Any suggestions?

rtyley added a commit to rtyley/circuitpython that referenced this issue Jun 10, 2022
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
rtyley added a commit to rtyley/circuitpython that referenced this issue Jun 10, 2022
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 pushed a commit to rtyley/circuitpython that referenced this issue Jun 10, 2022
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
rtyley added a commit to rtyley/circuitpython that referenced this issue Jun 10, 2022
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
@adafruit-adabot adafruit-adabot added the Hacktoberfest Beginner friendly issues for Hacktoberfest event label Sep 29, 2022
@dhalbert
Copy link
Collaborator

Fjxed by #6474. Still omitted on some very small builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpython api modules from cpython enhancement good first issue Hacktoberfest Beginner friendly issues for Hacktoberfest event help wanted rp2040 Raspberry Pi RP2040
Projects
None yet
Development

No branches or pull requests

5 participants
0