zephyrproject-rtos/west

Improvement: WestCommandsType should be a class

Open

#959 opened on Jun 6, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (157 forks)auto 404
good first issue

Repository metrics

Stars
 (350 stars)
PR merge metrics
 (PR metrics pending)

Description

See https://github.com/zephyrproject-rtos/west/pull/920#discussion_r3367818364

Actually, would it be simpler and clearer to just promote WestCommandsType to some very basic but actual Python class?

I did consider this, and gave it a brief try, but it felt like a much more invasive refactoring than I was comfortable doing, and that would further explode the size of this #920 PR (which as you said has evolved quite a bit). It most likely should have been a class from the very start tbh - _west_commands_list feels like a constructor, _west_commands_maybe_delist feels like a string representation, _west_commands_merge would be an elegant iadd....

Make sure to include the _west_commands_manifest_dirs in the class somehow - it could be that a subclass of dict would be most suitable for WestCommandsType.

Contributor guide