fastapp package
Subpackages
Submodules
fastapp.serve module
Uvicorn x Gunicorn x Nginx x FastAPI Configuration
- fastapp.serve.sigterm_handler(pids: List[int]) None [source]
Termination Signal Handler
- Parameters
pids (List[int]) – List of Process PIDs
- Return type
None
- fastapp.serve.start_server(asgi_app: str, nginx_config: Optional[Union[str, Path]] = None) None [source]
Start the Nginx and Gunicorn Proceses
The Gunicorn process uses the uvicorn.workers.UvicornWorker worker and binds itself to the Gunicorn .sock which is picked up by Nginx. The result is a capable server meant to run on a single instance.
If you wanted to scale this to a solution like Kubernetes you would handle replication at the cluster lecel instead of Gunicorn doing it for you. More info at https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker
- Return type
None
- fastapp.serve.start_server_debug(app: str, host: str = '0.0.0.0', port: int = 8080, reload: bool = True) None [source]
Start the Uvicorn Development Server
This server also has live loading
- Parameters
app (str) – FastAPI Object Reference
host (str, optional) – API Host, defaults to “0.0.0.0”
Default:'0.0.0.0'
port (int, optional) – API Port
Default:8080
reload (bool, optional) – Whether to Reload the API Source in real-time. This consumes more resources.
Default:True
- Return type
None
Module contents
fastapp
- class fastapp.FastApp(debug: bool = True, title: str = 'FastApp', description: str = 'Example ML Server with FastAPI', version: str = '0.1.7', **kwargs: Any)[source]
Bases:
FastAPI
FastApp FastAPI Class
- class fastapp.FastAppRouter(*, prefix: str = '', tags: ~typing.Optional[~typing.List[~typing.Union[str, ~enum.Enum]]] = None, dependencies: ~typing.Optional[~typing.Sequence[~fastapi.params.Depends]] = None, default_response_class: ~typing.Type[~starlette.responses.Response] = <fastapi.datastructures.DefaultPlaceholder object>, responses: ~typing.Optional[~typing.Dict[~typing.Union[int, str], ~typing.Dict[str, ~typing.Any]]] = None, callbacks: ~typing.Optional[~typing.List[~starlette.routing.BaseRoute]] = None, routes: ~typing.Optional[~typing.List[~starlette.routing.BaseRoute]] = None, redirect_slashes: bool = True, default: ~typing.Optional[~typing.Callable[[~typing.MutableMapping[str, ~typing.Any], ~typing.Callable[[], ~typing.Awaitable[~typing.MutableMapping[str, ~typing.Any]]], ~typing.Callable[[~typing.MutableMapping[str, ~typing.Any]], ~typing.Awaitable[None]]], ~typing.Awaitable[None]]] = None, dependency_overrides_provider: ~typing.Optional[~typing.Any] = None, route_class: ~typing.Type[~fastapi.routing.APIRoute] = <class 'fastapi.routing.APIRoute'>, on_startup: ~typing.Optional[~typing.Sequence[~typing.Callable[[], ~typing.Any]]] = None, on_shutdown: ~typing.Optional[~typing.Sequence[~typing.Callable[[], ~typing.Any]]] = None, deprecated: ~typing.Optional[bool] = None, include_in_schema: bool = True, generate_unique_id_function: ~typing.Callable[[~fastapi.routing.APIRoute], str] = <fastapi.datastructures.DefaultPlaceholder object>)[source]
Bases:
APIRouter
Base API Router Class for FastApp