Skip to content

Fix for specifying cpy-version when installing#264

Open
RoscoP wants to merge 1 commit into
adafruit:mainfrom
RoscoP:version_override-fix
Open

Fix for specifying cpy-version when installing#264
RoscoP wants to merge 1 commit into
adafruit:mainfrom
RoscoP:version_override-fix

Conversation

@RoscoP

@RoscoP RoscoP commented Jan 12, 2026

Copy link
Copy Markdown

Scope

Fixing an exception issue when using circup, and specifying --cpy-version. This makes changes to the main() and version_override values passed to the backends. Previously this value was set to a string, but usage of get_circuitpython_version() returned a tuple.

Behavior

Previously, calling circup --path . --cpy-version '10.0.3' --board-id adafruit_qtpy_esp32s2 install adafruit-circuitpython-asyncio caused an exception:

  File "...\Lib\site-packages\circup\bundle.py", line 61, in lib_dir
    self.basename.format(platform=PLATFORMS[platform], tag=tag),
                                  ~~~~~~~~~^^^^^^^^^^
KeyError: '1mpy'

This was due to this line:

# DiskBackEnd.install_module_mpy()
...
major_version = self.get_circuitpython_version()[0].split(".")[0]

Requiring the return value to be a tuple, the first entry to be a semver. This fix resolves this.

Comment thread circup/commands.py
using_webworkflow = "host" in ctx.params.keys() and ctx.params["host"] is not None

version_override = None
if board_id or cpy_version:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be an and if we go by the cli help description for these flags.

Comment thread circup/commands.py
click.secho("Could not find a connected CircuitPython device.", fg="red")
sys.exit(1)
else:
cpy_version, board_id = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This becomes not necessary with the improvement you made. If you want you could make this just cpy_version, board_id = ctx.obj["backend"].get_circuitpython_version()

@dunkmann00

Copy link
Copy Markdown
Contributor

Hey nice catch! I'm not a maintainer but have done some work with this repo lately and had a couple of suggestions that I thought I'd share.

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 this pull request may close these issues.

2 participants