Skip to content

Create colorwheel() native module with matching Python version #4926

@kattni

Description

@kattni

We included colorwheel() in both _pixelbuf and adafruit_pypixelbuf, but to use it across all CircuitPython-compatible, it requires a try/except import structure. This was something we did not consider from the beginning.

We should rename _pypixelbuf and adafruit_pypixelbuf to match so Pypixelbuf is a drop-in replacement for _pixelbuf.

@dhalbert has suggested another option involving making the latter an alias for the former, so a single import works for both, but we're not entirely sure how priority of native modules over libraries works, so are therefore unsure how aliasing would work.

My suggestion is to rename adafruit_pypixelbuf to adafruit_pixelbuf and rename _pixelbuf to match. This is to maintain the fact that the native module is not Python, and therefore should not be named py anything, but I'm willing to concede to it not really mattering in the end, and that it may be easier to only rename the native module.

There are very few Learn guides that reference adafruit_pypixelbuf, and those that do, do so only in the required library lists, so there is very little that would need to be updated to match. The only direct references to either one in code appear to be when I have written code to call color_wheel(), which I don't believe has happened that often yet, so again, very little to be updated.

As we are breaking other things as well, I'd like to see this happen in 7.0.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions