cappa
cappa copied to clipboard
Avoid stub class construction
Right now "functional" declaration internally creates stub dataclasses to use downstream to contruct Command instances, because the way invoked subcommands work internally traverses the output shape to find subcommand instances.
Each of the below steps ought to be able to correspond to a standalone PR that doesn't break anything in order to remove this weird internal traversal and construction, greatly simplifying function handling.
- [ ] inside
map_result, collect all instantiated subcommand instances in a collection in during the recursive production of the output structure. Pass this structure toinvokemachinery, so it doesn't need to traverse real-world attributes to resolve implicit deps - [ ] combine the two divergent
Command.collectcodepaths. pre-existence of arguments shouldn't break anything(?) - [ ] unclear whether we need Field.annotation, if CallableView is handling production of
type_viewgenerally, remove this? - [ ] alter class_inspect to introspect callables directly and return fields without constructing a fake class
All of the above ought to make #168 or other click-ish APIs simpler.