You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to add options from typed-settings Object in a similar style as it is described in docs.
It looks like what am I describing is the ability to dynamically set options from an object. I guess it is similar to #305#86 (comment)
Here is what typed-settings usage looks like
importclickimportosimporttyped_settingsastsos.environ['EXAMPLE_SPAM'] ="23"@ts.settingsclassSettings:
spam: int=42@click.command()@ts.click_options(Settings, "example")defcli(settings: Settings):
print(settings)
# As you can see, an option is generated for each setting:importclick.testingrunner=click.testing.CliRunner()
print(runner.invoke(cli, ["--help"]).output)
output
Usage: cli [OPTIONS]
Options:
--spam INTEGER [default: 23]
--help Show this message and exit.
print(runner.invoke(cli, ["--spam=3"]).output)
Settings(spam=3)
Wanted Code
importtyperimportosos.environ['EXAMPLE_SPAM'] ="23"importtyped_settingsasts@ts.settingsclassSettings:
spam: int=42app=typer.Typer()
@app.command()defdynamic_options(settings:Settings=typer.Options()): # load options from the classprint(settings)
This discussion was converted from issue #434 on February 22, 2026 11:41.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Description
Hi,
I'd like to use
typed-settingshttps://typed-settings.readthedocs.io/en/latest/guides/click.html#command-line-arguments-with-click with Typer. It has a decorator to generate click options from the settings object see the link totyped-settings.I tried to include the click app in typer https://typer.tiangolo.com/tutorial/using-click/#including-a-typer-app-in-a-click-app but then I'm essentially using click and not Typer.
Wanted Solution
I would like to be able to add options from typed-settings Object in a similar style as it is described in docs.
It looks like what am I describing is the ability to dynamically set options from an object. I guess it is similar to #305 #86 (comment)
Here is what typed-settings usage looks like
output
Wanted Code
Alternatives
No response
Operating System
Linux
Operating System Details
No response
Typer Version
0.6.1
Python Version
3.9
Additional Context
Beta Was this translation helpful? Give feedback.
All reactions