typer の API リファレンス
typer (fastapi/typer) の公開 API 127 件 —— クラス 20、関数 65、メソッド 42。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: fastapi/typer
| 種別 | 件数 |
|---|---|
| クラス | 20 |
| 関数 | 65 |
| メソッド | 42 |
API 一覧
func
docs_src.commands.callback.tutorial001_py310.main(verbose:bool=False)Manage users in the awesome CLI app.
func
docs_src.commands.callback.tutorial004_py310.callback()Manage users CLI app.
func
docs_src.commands.context.tutorial001_py310.main(ctx:typer.Context)Manage users in the awesome CLI app.
func
docs_src.commands.context.tutorial002_py310.main()Manage users in the awesome CLI app.
func
docs_src.commands.context.tutorial003_py310.main(ctx:typer.Context)Manage users in the awesome CLI app.
func
docs_src.commands.help.tutorial001_an_py310.create(username:str)Create a new user with username.
func
docs_src.commands.help.tutorial001_an_py310.init()Initialize the users database.
func
docs_src.commands.help.tutorial001_py310.create(username:str)Create a new user with username.
func
docs_src.commands.help.tutorial001_py310.init()Initialize the users database.
func
docs_src.commands.help.tutorial002_py310.create(username:str)Some internal utility function to create.
func
docs_src.commands.help.tutorial002_py310.delete(username:str)Some internal utility function to delete.
func
docs_src.commands.help.tutorial003_py310.create(username:str)Create a user.
func
docs_src.commands.help.tutorial003_py310.delete(username:str)Delete a user.
func
docs_src.commands.help.tutorial005_an_py310.create(username:Annotated[str, typer.Argument(help='The username to be **created**')])**Create** a new *shiny* user.
func
docs_src.commands.help.tutorial005_py310.create(username:str=typer.Argument(..., help='The username to be **created**'))**Create** a new *shiny* user.
func
docs_src.commands.help.tutorial006_py310.config(configuration:str)[blue]Configure[/blue] the system.
func
docs_src.commands.help.tutorial006_py310.create(username:str)[green]Create[/green] a new user.
func
docs_src.commands.help.tutorial006_py310.delete(username:str)[red]Delete[/red] a user.
func
docs_src.commands.help.tutorial006_py310.report()[yellow]Report[/yellow] an issue.
func
docs_src.commands.help.tutorial007_an_py310.config(configuration:str)[blue]Configure[/blue] the system.
func
docs_src.commands.help.tutorial007_py310.config(configuration:str)[blue]Configure[/blue] the system.
func
docs_src.commands.help.tutorial008_py310.create(username:str)[green]Create[/green] a new user.
func
docs_src.subcommands.name_help.tutorial002_py310.users()Manage users in the app.
func
docs_src.subcommands.name_help.tutorial003_py310.users()Manage users in the app.
func
docs_src.subcommands.name_help.tutorial004_py310.old_callback()Old callback help.
func
docs_src.subcommands.name_help.tutorial004_py310.users()Manage users in the app.
func
docs_src.subcommands.name_help.tutorial005_py310.new_users()I have the highland!
func
docs_src.subcommands.name_help.tutorial005_py310.old_callback()Old callback help.
func
docs_src.subcommands.name_help.tutorial005_py310.users()Manage users in the app.
func
docs_src.subcommands.name_help.tutorial006_py310.new_users()I have the highland!
func
docs_src.subcommands.name_help.tutorial006_py310.old_callback()Old callback help.
func
docs_src.subcommands.name_help.tutorial006_py310.users()Manage users in the app.
func
docs_src.subcommands.name_help.tutorial007_py310.new_users()I have the highland!
func
docs_src.subcommands.name_help.tutorial007_py310.old_callback()Old callback help.
func
docs_src.subcommands.name_help.tutorial007_py310.users()Manage users in the app.
func
docs_src.subcommands.name_help.tutorial008_py310.new_users()I have the highland!
func
docs_src.subcommands.name_help.tutorial008_py310.old_callback()Old callback help.
func
docs_src.subcommands.name_help.tutorial008_py310.users()Manage users in the app.
func
typer._click._compat.get_best_encoding(stream:IO[Any]) -> strReturns the default stream encoding if not found.
func
typer._click._compat.is_ascii_encoding(encoding:str) -> boolChecks if a given encoding is ascii.
method
typer._click._termui_impl.ProgressBar.update(n_steps:int) -> NoneUpdate the progress bar by advancing a specified number of steps.
method
typer._click.core.Command.format_epilog(ctx:Context, formatter:HelpFormatter) -> NoneWrites the epilog into the formatter if it exists.
method
typer._click.core.Command.format_help(ctx:Context, formatter:HelpFormatter) -> NoneWrites the help into the formatter if it exists.
method
typer._click.core.Command.format_help_text(ctx:Context, formatter:HelpFormatter) -> NoneWrites the help text to the formatter if it exists.
method
typer._click.core.Command.format_usage(ctx:Context, formatter:HelpFormatter) -> NoneWrites the usage line into the formatter.
method
typer._click.core.Command.get_help(ctx:Context) -> strFormats the help into a string and returns it.
method
typer._click.core.Command.get_help_option(ctx:Context) -> Union['TyperOption', None]Returns the help option object.
method
typer._click.core.Command.get_help_option_names(ctx:Context) -> list[str]Returns the names for the help option.
method
typer._click.core.Command.get_usage(ctx:Context) -> strFormats the usage line into a string and returns it.
method
typer._click.core.Command.make_parser(ctx:Context) -> _OptionParserCreates the underlying option parser for this command.
method
typer._click.core.Command.shell_complete(ctx:Context, incomplete:str) -> list['CompletionItem']Return a list of completions for the incomplete value.
method
typer._click.core.Context.abort() -> NoReturnAborts the script.
method
typer._click.core.Context.call_on_close(f:Callable[..., Any]) -> Callable[..., Any]Register a function to be called when the context tears down.
method
typer._click.core.Context.command_path() -> strThe computed command path.
method
typer._click.core.Context.exit(code:int=0) -> NoReturnExits the application with a given exit code.
method
typer._click.core.Context.fail(message:str) -> NoReturnAborts the execution of the program with a specific error message.
method
typer._click.core.Context.find_object(object_type:type[V]) -> V | NoneFinds the closest object of a given type.
method
typer._click.core.Context.find_root() -> 'Context'Finds the outermost context.
method
typer._click.core.Context.get_parameter_source(name:str) -> ParameterSource | NoneGet the source of a parameter.
method
typer._click.core.Context.invoke(callback:Callable[..., V], *args:Any, **kwargs:Any) -> VInvokes a command callback in exactly the way it expects.
method
typer._click.core.Context.make_formatter() -> HelpFormatterCreates the HelpFormatter for the help and usage output.
method
typer._click.core.Context.set_parameter_source(name:str, source:ParameterSource) -> NoneSet the source of a parameter.
method
typer._click.core.Context.with_resource(context_manager:AbstractContextManager[V]) -> VRegister a resource as if it were used in a ``with`` statement.
method
typer._click.core.Parameter.human_readable_name() -> strReturns the human readable name of this parameter.
method
typer._click.core.Parameter.process_value(ctx:Context, value:Any) -> AnyProcess the value of this parameter
method
typer._click.core.Parameter.shell_complete(ctx:Context, incomplete:str) -> list['CompletionItem']Return a list of completions for the incomplete value.
func
typer._click.decorators.help_option(param_decls:list[str]) -> Callable[[Command], Command]Help option which prints the help page and exits the program.
func
typer._click.decorators.option(param_decls:list[str], cls:type['TyperOption'] | None=None, **attrs:Any) -> Callable[[Command], Command]Attaches an option to the command.
func
typer._click.decorators.show_help(ctx:Context, param:Parameter, value:bool) -> NoneCallback that print the help page on ``<stdout>`` and exits.
class
typer._click.exceptions.AbortAn internal signalling exception that signals Click to abort.
class
typer._click.exceptions.ClickExceptionAn exception that Click can handle and show to the user.
class
typer._click.exceptions.FileErrorRaised if a file cannot be opened.
class
typer._click.exceptions.UsageErrorAn internal exception that signals a usage error.
class
typer._click.formatting.HelpFormatterThis class helps with formatting text-based help pages.
method
typer._click.formatting.HelpFormatter.dedent() -> NoneDecreases the indentation.
method
typer._click.formatting.HelpFormatter.getvalue() -> strReturns the buffer contents.
method
typer._click.formatting.HelpFormatter.indent() -> NoneIncreases the indentation.
method
typer._click.formatting.HelpFormatter.indentation() -> Iterator[None]A context manager that increases the indentation.
method
typer._click.formatting.HelpFormatter.write(string:str) -> NoneWrites a unicode string into the internal buffer.
method
typer._click.formatting.HelpFormatter.write_dl(rows:Sequence[tuple[str, str]], col_max:int=30, col_spacing:int=2) -> NoneWrites a definition list into the buffer.
method
typer._click.formatting.HelpFormatter.write_heading(heading:str) -> NoneWrites a heading into the buffer.
method
typer._click.formatting.HelpFormatter.write_paragraph() -> NoneWrites a paragraph into the buffer.
method
typer._click.formatting.HelpFormatter.write_text(text:str) -> NoneWrites re-indented text into the buffer.
method
typer._click.formatting.HelpFormatter.write_usage(prog:str, args:str='', prefix:str | None=None) -> NoneWrites a usage line into the buffer.
func
typer._click.formatting.wrap_text(text:str, width:int=78, initial_indent:str='', subsequent_indent:str='', preserve_paragraphs:bool=False) -> strA helper function that intelligently wraps text.
func
typer._click.globals.pop_context() -> NoneRemoves the top level from the stack.
func
typer._click.globals.push_context(ctx:'Context') -> NonePushes a new context to the current stack.
func
typer._click.globals.resolve_color_default(color:bool | None=None) -> bool | NoneInternal helper to get the default value of the color flag.
class
typer._click.shell_completion.CompletionItemRepresents a completion value and metadata about the value.
class
typer._click.shell_completion.ShellCompleteBase class for providing shell completion support.
method
typer._click.shell_completion.ShellComplete.complete() -> strProduce the completion data to send back to the shell.
method
typer._click.shell_completion.ShellComplete.source_vars() -> dict[str, Any]Vars for formatting `source_template`.
func
typer._click.shell_completion.add_completion_class(cls:ShellCompleteType, name:str) -> ShellCompleteTypeRegister a `ShellComplete` subclass under the given name.
func
typer._click.termui.confirm(text:str, default:bool | None=False, abort:bool=False, prompt_suffix:str=': ', show_default:bool=True, err:bool=False) -> boolPrompts for confirmation (yes/no question).
func
typer._click.termui.getchar(echo:bool=False) -> strFetches a single character from the terminal and returns it.
class
typer._click.types.DateTimeThe DateTime type converts date strings into `datetime` objects.
class
typer._click.types.FileDeclares a parameter to be a file for reading or writing.
class
typer._click.types.FloatRangeRestrict a `FLOAT` value to a range of accepted values.
class
typer._click.types.IntRangeRestrict an `INT` value to a range of accepted values.
class
typer._click.types.ParamTypeRepresents the type of a parameter.
method
typer._click.types.ParamType.fail(message:str, param:Union['Parameter', None]=None, ctx:Union['Context', None]=None) -> NoReturnHelper method to fail with an invalid value message.
method
typer._click.types.ParamType.get_metavar(param:'Parameter', ctx:'Context') -> str | NoneReturns the metavar default for this param if it provides one.
class
typer._click.types.TupleThe default behavior of Click is to apply a type on a value directly.
func
typer._click.types.convert_type(ty:Any | None, default:Any | None=None) -> ParamTypeFind the most appropriate `ParamType` for the given Python type.
func
typer._click.utils.echo(message:Any | None=None, file:IO[Any] | None=None, nl:bool=True, err:bool=False, color:bool | None=None) -> NonePrint a message and newline to stdout or a file.
func
typer._click.utils.format_filename(filename:str | bytes | os.PathLike[str] | os.PathLike[bytes], shorten:bool=False) -> strFormat a filename as a string for display.
func
typer._click.utils.get_app_dir(app_name:str, roaming:bool=True, force_posix:bool=False) -> strReturns the config folder for the application.
func
typer._click.utils.get_binary_stream(name:Literal['stdin', 'stdout', 'stderr']) -> BinaryIOReturns a system stream for byte processing.
func
typer._click.utils.get_text_stream(name:Literal['stdin', 'stdout', 'stderr'], encoding:str | None=None, errors:str | None='strict') -> TextIOReturns a system stream for text processing.
func
typer._click.utils.make_default_short_help(help:str, max_length:int=45) -> strReturns a condensed version of help string.
func
typer._click.utils.safecall(func:Callable[P, R]) -> Callable[P, R | None]Wraps a function so that it swallows exceptions.
class
typer.main.Typer`Typer` main class, the main entrypoint to use Typer.
func
typer.models.Default(value:DefaultType) -> DefaultTypeYou shouldn't use this function directly.
class
typer.models.DefaultPlaceholderYou shouldn't use this class directly.
class
typer.models.FileBinaryReadYou can use this class to read binary data, receiving `bytes`.
class
typer.models.FileTextWriteYou can use this class for writing text.
class
typer.rich_utils.OptionHighlighterHighlights our special options.
func
typer.rich_utils.escape_before_html_export(input_text:str) -> strEnsure that the input string can be used for HTML export.
func
typer.rich_utils.rich_abort_error() -> NonePrint richly formatted abort error.
func
typer.rich_utils.rich_format_error(self:_click.ClickException) -> NonePrint richly formatted click errors.
func
typer.rich_utils.rich_format_help(*obj:_click.Command | TyperGroup, *ctx:_click.Context, *markup_mode:MarkupModeStrict) -> NonePrint nicely formatted help text using rich.
func
typer.rich_utils.rich_render_text(text:str) -> strRemove rich tags and render a pure text representation
func
typer.rich_utils.rich_to_html(input_text:str) -> strPrint the HTML version of a rich-formatted input string.
class
typer.testing.ResultHolds the captured result of an invoked CLI script.
method
typer.testing.Result.stderr() -> strThe standard error as unicode string.
method
typer.testing.Result.stdout() -> strThe standard output as unicode string.
class
typer.testing.StreamMixerMixes `<stdout>` and `<stderr>` streams.
この情報について
掲載しているシグネチャは fastapi/typer の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。