[suggestion] Use `Annotated` instead of source code parsing.
LiraNuna opened this issue · 3 comments
LiraNuna commented
typing.Annotated
was introduced in Python 3.9. It seems like the perfect way to add help strings and other meta information.
class ExampleArguments(Tap):
workers: Annotated[int, HelpString('The number of workers to run')]
Of course that will only work for python 3.9 and above.
Cnoor0171 commented
I'd like to instead suggest a pattern similar to dataclass
's field
construct instead. Created #98 as an alternative
swansonk14 commented
Hi @LiraNuna,
Thank you for the suggestion! We like your idea, but we are afraid that your solution would not work cleanly for long help strings since the default value would appear after the long help string. We prefer the alternative solution mentioned in #98. Thanks again for your suggestion and we would appreciate any thoughts on the alternate solution.
Best,
Jesse and Kyle