Skip to content

example seems to cause ci errors in bundle #3

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
jepler opened this issue May 11, 2025 · 4 comments · Fixed by adafruit/Adafruit_CircuitPython_Bundle#505
Closed

example seems to cause ci errors in bundle #3

jepler opened this issue May 11, 2025 · 4 comments · Fixed by adafruit/Adafruit_CircuitPython_Bundle#505

Comments

@jepler
Copy link

jepler commented May 11, 2025

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?

@FoamyGuy
Copy link
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
Copy link
Author

jepler commented May 12, 2025

>>> 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
Copy link
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
Copy link
Author

jepler commented May 12, 2025

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants