krr icon indicating copy to clipboard operation
krr copied to clipboard

Refactoring concept: generate typer commands from config

Open LeaveMyYard opened this issue 1 year ago • 1 comments

Related to #219

This is a proposal to move typer command generation to a separate file, restructure components in functions so it is easier to understand what is going on, and to use Pydantic's field extra params to generate typer commands from Config.

Pros:

  • Now to add a new flag it is only required to add it to config
  • Was able to refactor the way a strategy is created, so now it is the same mechanism with strategy settings, so it is easier to understand
  • Code is easier to read for newcomers (it is easier to understand how commands are generated)
  • Data validation and setup of how it is described in --help is now in the same place, and that is much more convenient

Cons:

  • We still use inspect in runtime

NOTE: This is not yet finished, but rather an idea on the change

LeaveMyYard avatar Apr 04 '24 16:04 LeaveMyYard

@aantn WDYT?

LeaveMyYard avatar Apr 04 '24 16:04 LeaveMyYard