Juan Luis
03/11/2024, 8:57 PMtyro.cli(your_func)
separately, and you're done. your original function is usable everywhere (unlike Click's decorated functions). your CLI function can be trivially declared as an entry point under [project.scripts]
. it even has support for config objects created from data classes.
wdyt?Arnaud Dhaene
03/11/2024, 9:26 PMtyper
Cody Peterson
03/11/2024, 9:31 PMtyper
and it's pretty great. hadn't heard of tyro
Juan Luis
03/11/2024, 9:35 PMtyro
is very small, don't know how I even arrived there.
typer
looks indeed similar (I knew of it but have never used it). the problem I have is that seemingly some functionality requires you to create the FastAPI-like app = typer.Typer()
and decorate the commands, which I want to avoidJuan Luis
03/11/2024, 9:35 PMJuan Luis
03/11/2024, 9:36 PMCody Peterson
03/11/2024, 9:37 PMThierry Jean
03/11/2024, 9:56 PMdatajoely
03/12/2024, 9:52 AMargparse
now its in the standard library, especially with framework code its just one less dependency that we can avoid conflicting withJuan Luis
03/12/2024, 10:17 AMSysError
to signal completion + its reliance on decorators make it very difficult to reuse CLI functions elsewhere (we've been suffering the consequences of this for years in Kedro - especially given that Databricks launches processes in a very peculiar way). the third one is that it's really difficult to do introspection on the parsed commands etc (something @Dmitry Sorokin suffered when working on our telemetry). the fourth is that its maintainer is excessively blunt IMHO (I fully acknowledge it's difficult to handle such a large number of open source projects though and that they don't owe me anything - but it surely affects my "purchasing" choices).Juan Luis
03/12/2024, 10:18 AMIñigo Hidalgo
03/12/2024, 10:57 AMreliance on decorators make it very difficult to reuse CLI functions elsewherei'm seeing this pain using
prefect
task
and flow
decorators too. my (intended) solution is going to be to define the bare functions in one module and then call the decorator like I would a normal function ie
task_to_run = prefect.task(function_to_run)
instead of using the decorator @
syntaxJuan Luis
03/12/2024, 11:38 AMIñigo Hidalgo
03/13/2024, 9:03 AM