Lucretiel / autocommand

Autocommand turns a python function into a CLI program
GNU Lesser General Public License v3.0
53 stars 9 forks source link

Use `typing.Annotated` for arg transformations instead of a 'callable annotation' #30

Open bswck opened 6 months ago

bswck commented 6 months ago

During reading the pip-run code, I raised an eyebrow upon seeing this: https://github.com/jaraco/pip-run/blob/f5c50a4c2a84bc43ed090820d44f2d4bac6cb0c6/pip_run/read-deps.py#L21

Thanks to typing.Annotated being present, there is a modern, type-safe way to do it, like here: https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#add-query-to-annotated-in-the-q-parameter

jaraco commented 2 months ago

I encountered this issue again today in jaraco/jaraco.home@33fb951.

jaraco commented 2 months ago

I'll offer a $50 bounty for an accepted PR on this issue.

bswck commented 2 months ago

I'll take it along with #34. 🚀