@@ -115,6 +115,8 @@ async def my_handler(request: Request, my_param: InputModel) -> OutputModel:
115115 configured. The following is an example of an endpoint builder class
116116
117117 ```python
118+ from zenml.deployers.server import BaseDeploymentAppRunner
119+
118120 class MyHandler:
119121 def __init__(
120122 self,
@@ -140,6 +142,8 @@ async def __call__(self, request: Request, my_param: InputModel) -> OutputModel:
140142 configured. The following is an example of an endpoint builder function:
141143
142144 ```python
145+ from zenml.deployers.server import BaseDeploymentAppRunner
146+
143147 def my_builder(
144148 app_runner: "BaseDeploymentAppRunner",
145149 **kwargs: Any,
@@ -224,6 +228,8 @@ async def my_middleware(request: Request, call_next) -> Response:
224228 configured. The following is an example of a middleware class:
225229
226230 ```python
231+ from zenml.deployers.server import BaseDeploymentAppRunner
232+
227233 class MyMiddleware:
228234 def __init__(
229235 self,
@@ -251,6 +257,8 @@ async def __call__(
251257 configured. The following is an example of a middleware builder function:
252258
253259 ```python
260+ from zenml.deployers.server import BaseDeploymentAppRunner
261+
254262 def my_middleware_builder(
255263 app_runner: "BaseDeploymentAppRunner",
256264 **kwargs: Any,
@@ -313,6 +321,8 @@ class AppExtensionSpec(BaseModel):
313321 `extension_kwargs` as keyword arguments. This is an example:
314322
315323 ```python
324+ from zenml.deployers.server import BaseDeploymentAppRunner
325+
316326 def extension(app_runner: BaseDeploymentAppRunner, **kwargs)
317327
318328 @app_runner.asgi_app.get("/my-extension")
@@ -327,6 +337,9 @@ def my_extension(request: Request) -> Response:
327337 is an example:
328338
329339 ```python
340+ from zenml.deployers.server import BaseAppExtension
341+ from zenml.deployers.server import BaseDeploymentAppRunner
342+
330343 class MyExtension(BaseAppExtension):
331344
332345 def __init__(self, **kwargs):
@@ -423,6 +436,15 @@ class SecureHeadersConfig(BaseModel):
423436 )
424437
425438
439+ DEFAULT_DEPLOYMENT_APP_ROOT_URL_PATH = ""
440+ DEFAULT_DEPLOYMENT_APP_DOCS_URL_PATH = "/docs"
441+ DEFAULT_DEPLOYMENT_APP_REDOC_URL_PATH = "/redoc"
442+ DEFAULT_DEPLOYMENT_APP_INVOKE_URL_PATH = "/invoke"
443+ DEFAULT_DEPLOYMENT_APP_HEALTH_URL_PATH = "/health"
444+ DEFAULT_DEPLOYMENT_APP_INFO_URL_PATH = "/info"
445+ DEFAULT_DEPLOYMENT_APP_METRICS_URL_PATH = "/metrics"
446+
447+
426448class DeploymentSettings (BaseSettings ):
427449 """Settings for the pipeline deployment."""
428450
@@ -434,13 +456,13 @@ class DeploymentSettings(BaseSettings):
434456 app_version : Optional [str ] = None
435457 app_kwargs : Dict [str , Any ] = {}
436458
437- root_url_path : str = ""
438- docs_url_path : str = "/docs"
439- redoc_url_path : str = "/redoc"
440- invoke_url_path : str = "/invoke"
441- health_url_path : str = "/health"
442- info_url_path : str = "/info"
443- metrics_url_path : str = "/metrics"
459+ root_url_path : str = DEFAULT_DEPLOYMENT_APP_ROOT_URL_PATH
460+ docs_url_path : str = DEFAULT_DEPLOYMENT_APP_DOCS_URL_PATH
461+ redoc_url_path : str = DEFAULT_DEPLOYMENT_APP_REDOC_URL_PATH
462+ invoke_url_path : str = DEFAULT_DEPLOYMENT_APP_INVOKE_URL_PATH
463+ health_url_path : str = DEFAULT_DEPLOYMENT_APP_HEALTH_URL_PATH
464+ info_url_path : str = DEFAULT_DEPLOYMENT_APP_INFO_URL_PATH
465+ metrics_url_path : str = DEFAULT_DEPLOYMENT_APP_METRICS_URL_PATH
444466
445467 dashboard_files_path : str = ""
446468
0 commit comments