Skip to content
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

Add board-id and cpy-version params #182

Merged
merged 4 commits into from
Oct 23, 2023

Conversation

lynt-smitka
Copy link
Contributor

``I added two more parameters to circup to override board_id a CPY_VERSION detection.

The motivation is the ability to manage the version of libraries in local projects on the computer's filesystem.

I maintain several dozen CircuitPython projects, and with these parameters I can easily keep all the project's libs up to date without having to keep uploading them to the development boards.

Without these parameters, it is necessary to add a boot_out.txt file to the projects to emulate the board. With these parameters, management is much more convenient.

Example:
circup --path d:\cpy\picopad\demo1 --board-id pajenicko_picopad --cpy-version 8.2.6 list

Help message:

circup  --help
Usage: circup [OPTIONS] COMMAND [ARGS]...

  A tool to manage and update libraries on a CircuitPython device.

Options:
  --verbose           Comprehensive logging is sent to stdout.
  --path DIRECTORY    Path to CircuitPython directory. Overrides automatic
                      path detection.
  --board-id TEXT     Manual Board ID of the CircuitPython device. If provided
                      in combination with --cpy-version, it overrides the
                      detected board ID.
  --cpy-version TEXT  Manual CircuitPython version. If provided in combination
                      with --board-id, it overrides the detected CPy version.
  --version           Show the version and exit.
  --help              Show this message and exit.

Commands:
  bundle-add     Add bundles to the local bundles list, by "user/repo"...
  bundle-remove  Remove one or more bundles from the local bundles list.
  bundle-show    Show the list of bundles, default and local, with URL,...
  freeze         Output details of all the modules found on the connected...
  install        Install a named module(s) onto the device.
  list           Lists all out of date modules found on the connected...
  show           Show a list of available modules in the bundle.
  uninstall      Uninstall a named module(s) from the connected device.
  update         Update modules on the device. Use --all to automatically
                 update all modules without Major Version warnings.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks!

@tannewt tannewt merged commit abd2251 into adafruit:main Oct 23, 2023
1 check passed
@FoamyGuy
Copy link
Contributor

@lynt-smitka As I understand it the only real usage of the --board-id argument value is splicing it into the downloads page URL that gets shown to the user by the prompt if their version of Circuitpython (or the mocked version passed with --cpy-version) is out of date.

Do you recall if this ever had any other usage? It's possible that I broke it with recent refactors (as I did with --cpy-version I've submitted #219 resolves that)

If there was no other usage of it I'm wonder whether it would make sense to just get rid of --board-id and do one of the following:

  • catch the exception during the Circuitpython core version check essentially making that check optional by continuing even if it fails to find boot_out.txt. Then the user could use a command like circup --path project_dir/ --cpy-version 9.0.4 install whatever and it would succeed but not print the update prompt
  • add a --skip-version-check flag argument that can be passed by the user to explicitly indicate they want to skip the version check, which would also end up negating the need for the board-id and boot_out.txt file.

I'm working on updating the circup documentation and came across these arguments didn't know what their intended use was at first. I believe the --board-id argument in particular is a little bit confusing, from the users perspective I was thinking that would be used to target a specific device when you have multiples connected, but it's actual usage is not related to that. I'm thinking that it would be less confusing to not have --board-id and just handle the error or skip version check so that the utility can still be used in local directories like your original PR intended.

@lynt-smitka
Copy link
Contributor Author

@FoamyGuy Yes, the main use is for maintenance of many projects where I need to update library versions. The parameters are practically used to bypass the boot_out.txt check to make it easier to emulate the connected device. I'm not sure if circup by board_id doesn't also take frozen modules into account. If not, exception handling would be a sufficient solution.

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.

None yet

3 participants