`Typer` main class, the main entrypoint to use Typer. Read more in the [Typer docs for First Steps](https://typer.tiangolo.com/tutorial/typer-app/). ## Example ```python import typer app = typer.Typer() ```
| 117 | |
| 118 | |
| 119 | class Typer: |
| 120 | """ |
| 121 | `Typer` main class, the main entrypoint to use Typer. |
| 122 | |
| 123 | Read more in the |
| 124 | [Typer docs for First Steps](https://typer.tiangolo.com/tutorial/typer-app/). |
| 125 | |
| 126 | ## Example |
| 127 | |
| 128 | ```python |
| 129 | import typer |
| 130 | |
| 131 | app = typer.Typer() |
| 132 | ``` |
| 133 | """ |
| 134 | |
| 135 | def __init__( |
| 136 | self, |
| 137 | *, |
| 138 | name: Annotated[ |
| 139 | str | None, |
| 140 | Doc( |
| 141 | """ |
| 142 | The name of this application. |
| 143 | Mostly used to set the name for [subcommands](https://typer.tiangolo.com/tutorial/subcommands/), in which case it can be overridden by `add_typer(name=...)`. |
| 144 | |
| 145 | **Example** |
| 146 | |
| 147 | ```python |
| 148 | import typer |
| 149 | |
| 150 | app = typer.Typer(name="users") |
| 151 | ``` |
| 152 | """ |
| 153 | ), |
| 154 | ] = Default(None), |
| 155 | cls: Annotated[ |
| 156 | type[TyperGroup] | None, |
| 157 | Doc( |
| 158 | """ |
| 159 | The class of this app. Mainly used when [using the Click library underneath](https://typer.tiangolo.com/tutorial/using-click/). Can usually be left at the default value `None`. |
| 160 | Otherwise, should be a subtype of `TyperGroup`. |
| 161 | |
| 162 | **Example** |
| 163 | |
| 164 | ```python |
| 165 | import typer |
| 166 | |
| 167 | app = typer.Typer(cls=TyperGroup) |
| 168 | ``` |
| 169 | """ |
| 170 | ), |
| 171 | ] = Default(None), |
| 172 | invoke_without_command: Annotated[ |
| 173 | bool, |
| 174 | Doc( |
| 175 | """ |
| 176 | By setting this to `True`, you can make sure a callback is executed even when no subcommand is provided. |