class_docstr: Class (or function) decorated with the `@serve.deployment` decorator.
  
  This is run on a number of replica actors. Requests to those replicas call
  this class.
  
  One or more deployments can be composed together into an `Application` which is
  then run via `serve.run` or a config file.
  
  Example:
  
  .. code-block:: python
  
      @serve.deployment
      class MyDeployment:
          def __init__(self, name: str):
              self._name = name
  
          def __call__(self, request):
              return "Hello world!"
  
          app = MyDeployment.bind()
          # Run via `serve.run` or the `serve run` CLI command.
          serve.run(app)
code: def __init__(
      self,
      name: str,
      deployment_config: DeploymentConfig,
      replica_config: ReplicaConfig,
      version: Optional[str] = None,
      route_prefix: Union[str, None, DEFAULT] = DEFAULT.VALUE,
      _internal=False,
  ) -> None:
      if not _internal:
          raise RuntimeError(
              "The Deployment constructor should not be called "
              "directly. Use `@serve.deployment` instead."
          )
      if not isinstance(name, str):
          raise TypeError("name must be a string.")
      if not (version is None or isinstance(version, str)):
          raise TypeError("version must be a string.")
      if route_prefix is not DEFAULT.VALUE and route_prefix is not None:
          if not isinstance(route_prefix, str):
              raise TypeError("route_prefix must be a string.")
          if not route_prefix.startswith("/"):
              raise ValueError("route_prefix must start with '/'.")
          if route_prefix != "/" and route_prefix.endswith("/"):
              raise ValueError(
                  "route_prefix must not end with '/' unless it's the root."
              )
          if "{" in route_prefix or "}" in route_prefix:
              raise ValueError(
                  "route_prefix may not contain wildcards."
              )
  
      docs_path = None
      if (
          inspect.isclass(replica_config.deployment_def)
          and hasattr(replica_config.deployment_def, "__module__")
          and replica_config.deployment_def.__module__
          == "ray.serve.api"
          and hasattr(
              replica_config.deployment_def, "__fastapi_docs_path__"
          )
      ):
          docs_path = (
              replica_config.deployment_def.__fastapi_docs_path__
          )
  
      self._name = name
      self._version = version
      self._deployment_config = deployment_config
      self._replica_config = replica_config
      self._route_prefix = route_prefix
      self._docs_path = docs_path
  
imports: import inspect
  import logging
  import warnings
  from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from ray.dag.class_node import ClassNode
  from ray.dag.dag_node import DAGNodeBase
  from ray.dag.function_node import FunctionNode
  from ray.serve._private.config import DeploymentConfig, ReplicaConfig
  from ray.serve._private.constants import SERVE_LOGGER_NAME
  from ray.serve._private.utils import DEFAULT, Default
  from ray.serve.config import AutoscalingConfig
  from ray.serve.context import _get_global_client
  from ray.serve.handle import RayServeHandle, RayServeSyncHandle
  from ray.serve.schema import DeploymentSchema, LoggingConfig, RayActorOptionsSchema
  from ray.util.annotations import Deprecated, PublicAPI
label_desc: Use image node_id 1 to create a new Deployment object  with example: obj = Deployment(name, deployment_config, replica_config, version, route_prefix, _internal)