Shorthand syntax for Annotated type metadata - WASM Demo

This is a demonstration of the proposed shorthand syntax for typing.Annotated. See the PEP draft for more details.

Load Demo: Typer | Annotationlib
"""Demonstrates the `@` shorthand used with an un-patched `typer`. """ import typer from typer.testing import CliRunner app = typer.Typer() @app.command() def main( name: str @ typer.Argument(..., help="The person to greet"), count: int @ typer.Option(help="Number of greetings") = 1, formal: bool @ typer.Option("--formal/--informal") = False ): for _ in range(count): if formal: print(f"Greetings, Mx. {name}.") else: print(f"Hello {name}!") res = CliRunner().invoke(app, ["Alice", "--count", "5"]) print(res.stdout)
The simple REPL provides a limited Python experience in the browser. Tools/wasm/README.md contains a list of known limitations and issues. Networking, subprocesses, and threading are not available.