Skip to content

example seems to cause ci errors in bundle #3

@jepler

Description

@jepler

https://github.com/adafruit/Adafruit_CircuitPython_Bundle/actions/runs/14954680115/job/42008766380 (I can't copy the error text on mobile, has to do with bad fstr usage)

Maybe double check whether precommit settings are right, this sybtaxerror should make ruff fail shouldn't it?

Activity

FoamyGuy

FoamyGuy commented on May 11, 2025

@FoamyGuy
Contributor

Ah I ran into that error with the build action as well I think. I'm not sure what the specific syntax that is the culprit but I think something about that line is valid only in py3.12+. I updated the version used by the build action last week, but didn't think about about other actions that might try to parse the code. The library screenshot action will need to be updated as well, I'll submit a PR for that tomorrow.

jepler

jepler commented on May 12, 2025

@jepler
Author
>>> f"{""}"
''

yes, this syntax is accepted in Python 3.13 but not earlier versions, and no version of CircuitPython.

The library sources themselves are checked for circuitpython syntax compatibility when the CI runs mpy-cross on them; I wonder if there's a possibility to run mpy-cross on examples too---not to ship the resulting files, but instead to check that they are considered valid circuitpython syntax as well.

Another option is enhancing ruff config with target-version, except that it's a bit murky which standard python version best corresponds with circuitpython: https://docs.astral.sh/ruff/settings/#target-version https://docs.astral.sh/ruff/configuration/#inferring-the-python-version

fwiw now that I'm on a laptop here's the actual error:

  File "/home/runner/work/Adafruit_CircuitPython_Bundle/Adafruit_CircuitPython_Bundle/CircuitPython_Library_Screenshot_Maker/create_requirement_images.py", line 525, in bundle
    for _ in pool.imap(generate_example_requirement_image, paths):
  File "/opt/hostedtoolcache/Python/3.10.17/x64/lib/python3.10/multiprocessing/pool.py", line 873, in next
    raise value
  File "libraries/helpers/usb_host_mouse/examples/usb_host_mouse_simpletest.py", line 50
    out_str += f" {" ".join(pressed_btns)}"
                                           ^
SyntaxError: f-string: expecting '}'
FoamyGuy

FoamyGuy commented on May 12, 2025

@FoamyGuy
Contributor

I will double check, but I believe the code ran on a circuitpython device without issue. That was why I ended up changing the version of python in use by the actions instead of changing the code to use different formatting syntax at the time.

jepler

jepler commented on May 12, 2025

@jepler
Author

OK, I stand corrected. I didn't think this worked in CircuitPython! but you are correct.

maybe the bundle job should be bumped to run on a newer python than 3.13 then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jepler@FoamyGuy

      Issue actions

        example seems to cause ci errors in bundle · Issue #3 · adafruit/Adafruit_CircuitPython_USB_Host_Mouse