Skip to content

West extension for querying runner capabilities #54112

@mbolivar-nordic

Description

@mbolivar-nordic

Is your enhancement proposal related to a problem? Please describe.

Environments such as IDEs may want to call commands like west flash in order to allow users to perform common workflow tasks using GUI widgets or keyboard shortcuts. Currently, such environments have no machine-readable access to the set of available runners and their individual capabilities. This forces them to maintain hacks or quirk tables as runner capabilities change over time. One example happened when the west flash --dev-id option came in and deprecated other runner-specific options with the same purpose (such as --snr for the nrfjprog runner).

This causes problems for the maintainers of such environments and bad user experiences when changes in the runner code regress GUI workflows.

Describe the solution you'd like

A new west extension which allows callers to introspect the capabilities of the runners associated with a build directory or independent of any build directory, named west runners. This should allow callers to dump runner capabilities (such as those captured in a runners.core.RunnerCaps object instance in the runners Python API) to standard output in a machine-readable format such as JSON. The command line interface should be flexible enough to accommodate new queries as time goes on without having to add new commands.

This would be similar in spirit to existing human-readable command output from west flash --context and friends, but with a stable and machine readable output format.

Describe alternatives you've considered

  • asking such environments to query the runner API in Python: this isn't useful enough to all environments that may need this. Emacs's extension language is elisp, VS Code extensions aren't written in Python either, etc. Using JSON as a starting point seems like a better common denominator, especially given that format's usage in the language server protocol (LSP).
  • adding a machine-readable file format with stability guarantees to the zephyr build directory: this is possible, but has two problems compared to the above approach. The first is that extending file formats in future-proof ways can be trickier than adding new command line options. For example, new file contents may break third-party parsers in calling environments that don't expect them, and which we have no control over. The second is that calling environments may want to get some information about runners totally independent of any build directory.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions