Skip to content

build_app

Build a configured parking status FastAPI application.

The returned app loads its runtime dependencies during lifespan startup, registers the space-status and waitlist routes, and serves the built static site from the configured site_dir.

Parameters:

Name Type Description Default
space_update_model type[SpaceUpdateBaseModel]

Concrete Pydantic payload model used to validate parking sensor updates posted to the endpoint /space/update-state.

required
app_config AppConfig | YamlPath

Either an AppConfig instance or a YAML path to load one from. Defaults to [CWD]/app-config.yaml.

DEFAULT
sqlite_dir DirectoryPath

Directory where the app stores its SQLite databases. Defaults to [CWD]/sqlite-dbs/.

DEFAULT
site_dir DirectoryPath

Directory containing the built static site to mount at /. If a non-default path is desired, it's recommended to not pass this argument and instead set the environment variable PARK_IT_SITE_DIR, which is used in the default mkdocs.yml config to specify the build directory. Defaults to the path specified by PARK_IT_SITE_DIR if set, else [CWD]/site/.

DEFAULT
google_token_path FilePath | None

Path to the saved Google OAuth token JSON file used for refresh and reauthentication. Only required if the email waitlist feature is enabled. Defaults to [CWD]/auth-token.json.

DEFAULT
waitlist_password_path FilePath | None

Path to a text file containing your chosen shared waitlist password. You can also set this with the environment variable PARK_IT_WAITLIST_PASSWORD, but a dedicated file is more secure. Password is only required if the email waitlist feature is enabled. Defaults to None.

None

Returns:

Name Type Description
FastAPI FastAPI

Configured application instance.