I have a function where arguments do not have default values. However, I want to generate a CLI for that function with default values for some arguments (for example, based on some config). Something like this:
import json
import tyro
# I don't want this function to have default argument values.
def greet(name: str) -> None:
print(f'Hello, {name}')
def _load_user_config():
with open('user_config.json') as f:
return json.load(f)
if __name__ == '__main__':
user_config = _load_user_config()
tyro.cli(greet, defaults={'name': user_config['name']})
Is it possible to achieve this with tyro?
I have a function where arguments do not have default values. However, I want to generate a CLI for that function with default values for some arguments (for example, based on some config). Something like this:
Is it possible to achieve this with tyro?