typer_router package

Build Typer CLI Apps with File System-Based Routing

Submodules

typer_router.exc module

exception typer_router.exc.NoParentRouteException[source]

Bases: TyperRouterException

exception typer_router.exc.TyperRouterException[source]

Bases: Exception

typer_router.from_fs module

typer_router.from_fs.routes_from_app_import_path(app_import_path)[source]

Create routes from an app import path.

Return type:

List[Route]

typer_router.from_fs.routes_from_app_module(app_module)[source]

Create routes from an app module.

Return type:

List[Route]

typer_router.route module

class typer_router.route.Route(*args, **kwargs)[source]

Bases: BaseModel

property depth: int
Return type:

int

classmethod from_file_path(file_path, function_name='main')[source]
Return type:

Route

classmethod from_import_path(import_path, is_dir, function_name='main')[source]
Return type:

Route

function_name = 'main'
import_path
is_dir
name
property parent: Route
Return type:

Route

property parts: List[str]
Return type:

List[str]

property subpaths: List[str]
Return type:

List[str]

property subroutes: List[Route]
Return type:

List[Route]

typer_router.router module

class typer_router.router.Router(*args, **kwargs)[source]

Bases: BaseModel

app_import_path
classmethod from_app_import_path(app_import_path)[source]
Return type:

Router

classmethod from_app_module(module)[source]
Return type:

Router

full_import_path_for(route)[source]
Return type:

str

routes
to_typer(**typer_kwargs)[source]
Return type:

Typer

typer_router.to_typer module

typer_router.to_typer.add_route_to_typer_app(route, router, app)[source]
typer_router.to_typer.create_typer_app_from_router(router, **typer_kwargs)[source]
Return type:

Typer