prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `from starlite import *` broken if `testing` extra not installed
  This is only an issue on main, not in any release.
  
  When I want to try a library out, I'll install it into a fresh env, run python repl and do `from lib import *` and have a play around. If just doing that raised an error it would freak me out a little about the lib.
  
  Possible solution:
  - remove `.testing` imports from `starlite.__all__`
  - add deprecation warning for top-level `.testing` imports
  - remove `if TYPE_CHECKING` too? May as well if we are doing the above, I think?
  
  Refs: #174 #130 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `starlite/__init__.py`
  Content:
  ```
  1 from typing import TYPE_CHECKING, Any
  2 
  3 from starlite.datastructures import File, Redirect, State, Stream, Template
  4 
  5 from .app import Starlite
  6 from .config import (
  7     CacheConfig,
  8     CORSConfig,
  9     OpenAPIConfig,
  10     StaticFilesConfig,
  11     TemplateConfig,
  12 )
  13 from .connection import Request, WebSocket
  14 from .controller import Controller
  15 from .dto import DTOFactory
  16 from .enums import (
  17     HttpMethod,
  18     MediaType,
  19     OpenAPIMediaType,
  20     RequestEncodingType,
  21     ScopeType,
  22 )
  23 from .exceptions import (
  24     HTTPException,
  25     ImproperlyConfiguredException,
  26     InternalServerException,
  27     MissingDependencyException,
  28     NotAuthorizedException,
  29     NotFoundException,
  30     PermissionDeniedException,
  31     ServiceUnavailableException,
  32     StarLiteException,
  33     ValidationException,
  34 )
  35 from .handlers import (
  36     ASGIRouteHandler,
  37     BaseRouteHandler,
  38     HTTPRouteHandler,
  39     WebsocketRouteHandler,
  40     asgi,
  41     delete,
  42     get,
  43     patch,
  44     post,
  45     put,
  46     route,
  47     websocket,
  48 )
  49 from .logging import LoggingConfig, QueueListenerHandler
  50 from .middleware import AbstractAuthenticationMiddleware, AuthenticationResult
  51 from .openapi.controller import OpenAPIController
  52 from .params import Body, Dependency, Parameter
  53 from .plugins import PluginProtocol
  54 from .provide import Provide
  55 from .response import Response
  56 from .router import Router
  57 from .routes import BaseRoute, HTTPRoute, WebSocketRoute
  58 from .types import MiddlewareProtocol, Partial, ResponseHeader
  59 
  60 if TYPE_CHECKING:
  61     from .testing import TestClient, create_test_client, create_test_request
  62 
  63 
  64 __all__ = [
  65     "ASGIRouteHandler",
  66     "AbstractAuthenticationMiddleware",
  67     "AuthenticationResult",
  68     "BaseRoute",
  69     "BaseRouteHandler",
  70     "Body",
  71     "CORSConfig",
  72     "CacheConfig",
  73     "Controller",
  74     "Dependency",
  75     "DTOFactory",
  76     "File",
  77     "HTTPException",
  78     "HTTPRoute",
  79     "HTTPRouteHandler",
  80     "HttpMethod",
  81     "ImproperlyConfiguredException",
  82     "InternalServerException",
  83     "LoggingConfig",
  84     "MediaType",
  85     "MiddlewareProtocol",
  86     "MissingDependencyException",
  87     "NotAuthorizedException",
  88     "NotFoundException",
  89     "OpenAPIConfig",
  90     "OpenAPIController",
  91     "OpenAPIMediaType",
  92     "Parameter",
  93     "Partial",
  94     "PermissionDeniedException",
  95     "PluginProtocol",
  96     "Provide",
  97     "QueueListenerHandler",
  98     "Redirect",
  99     "Request",
  100     "RequestEncodingType",
  101     "Response",
  102     "ResponseHeader",
  103     "Router",
  104     "ScopeType",
  105     "ServiceUnavailableException",
  106     "StarLiteException",
  107     "Starlite",
  108     "State",
  109     "StaticFilesConfig",
  110     "Stream",
  111     "Template",
  112     "TemplateConfig",
  113     "TestClient",
  114     "ValidationException",
  115     "WebSocket",
  116     "WebSocketRoute",
  117     "WebsocketRouteHandler",
  118     "asgi",
  119     "create_test_client",
  120     "create_test_request",
  121     "delete",
  122     "get",
  123     "patch",
  124     "post",
  125     "put",
  126     "route",
  127     "websocket",
  128 ]
  129 
  130 _dynamic_imports = {"TestClient", "create_test_client", "create_test_request"}
  131 
  132 
  133 # pylint: disable=import-outside-toplevel
  134 def __getattr__(name: str) -> Any:
  135     """Provide lazy importing as per https://peps.python.org/pep-0562/"""
  136     if name not in _dynamic_imports:
  137         raise AttributeError(f"Module {__package__} has no attribute {name}")
  138 
  139     from . import testing
  140 
  141     attr = globals()[name] = getattr(testing, name)
  142     return attr
  143
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/starlite/__init__.py b/starlite/__init__.py
  --- a/starlite/__init__.py
  +++ b/starlite/__init__.py
  @@ -1,4 +1,4 @@
  -from typing import TYPE_CHECKING, Any
  +from typing import Any
   
   from starlite.datastructures import File, Redirect, State, Stream, Template
   
  @@ -57,10 +57,6 @@
   from .routes import BaseRoute, HTTPRoute, WebSocketRoute
   from .types import MiddlewareProtocol, Partial, ResponseHeader
   
  -if TYPE_CHECKING:
  -    from .testing import TestClient, create_test_client, create_test_request
  -
  -
   __all__ = [
       "ASGIRouteHandler",
       "AbstractAuthenticationMiddleware",
  @@ -110,14 +106,11 @@
       "Stream",
       "Template",
       "TemplateConfig",
  -    "TestClient",
       "ValidationException",
       "WebSocket",
       "WebSocketRoute",
       "WebsocketRouteHandler",
       "asgi",
  -    "create_test_client",
  -    "create_test_request",
       "delete",
       "get",
       "patch",
  @@ -127,15 +120,24 @@
       "websocket",
   ]
   
  -_dynamic_imports = {"TestClient", "create_test_client", "create_test_request"}
  +
  +_deprecated_imports = {"TestClient", "create_test_client", "create_test_request"}
   
   
   # pylint: disable=import-outside-toplevel
   def __getattr__(name: str) -> Any:
       """Provide lazy importing as per https://peps.python.org/pep-0562/"""
  -    if name not in _dynamic_imports:
  +    if name not in _deprecated_imports:
           raise AttributeError(f"Module {__package__} has no attribute {name}")
   
  +    import warnings
  +
  +    warnings.warn(
  +        f"Importing {name} from {__package__} is deprecated, use `from startlite.testing import {name}` instead",
  +        DeprecationWarning,
  +        stacklevel=2,
  +    )
  +
       from . import testing
   
       attr = globals()[name] = getattr(testing, name)
  
verification_info: {"golden_diff": "diff --git a/starlite/__init__.py b/starlite/__init__.py\n--- a/starlite/__init__.py\n+++ b/starlite/__init__.py\n@@ -1,4 +1,4 @@\n-from typing import TYPE_CHECKING, Any\n+from typing import Any\n \n from starlite.datastructures import File, Redirect, State, Stream, Template\n \n@@ -57,10 +57,6 @@\n from .routes import BaseRoute, HTTPRoute, WebSocketRoute\n from .types import MiddlewareProtocol, Partial, ResponseHeader\n \n-if TYPE_CHECKING:\n-    from .testing import TestClient, create_test_client, create_test_request\n-\n-\n __all__ = [\n     \"ASGIRouteHandler\",\n     \"AbstractAuthenticationMiddleware\",\n@@ -110,14 +106,11 @@\n     \"Stream\",\n     \"Template\",\n     \"TemplateConfig\",\n-    \"TestClient\",\n     \"ValidationException\",\n     \"WebSocket\",\n     \"WebSocketRoute\",\n     \"WebsocketRouteHandler\",\n     \"asgi\",\n-    \"create_test_client\",\n-    \"create_test_request\",\n     \"delete\",\n     \"get\",\n     \"patch\",\n@@ -127,15 +120,24 @@\n     \"websocket\",\n ]\n \n-_dynamic_imports = {\"TestClient\", \"create_test_client\", \"create_test_request\"}\n+\n+_deprecated_imports = {\"TestClient\", \"create_test_client\", \"create_test_request\"}\n \n \n # pylint: disable=import-outside-toplevel\n def __getattr__(name: str) -> Any:\n     \"\"\"Provide lazy importing as per https://peps.python.org/pep-0562/\"\"\"\n-    if name not in _dynamic_imports:\n+    if name not in _deprecated_imports:\n         raise AttributeError(f\"Module {__package__} has no attribute {name}\")\n \n+    import warnings\n+\n+    warnings.warn(\n+        f\"Importing {name} from {__package__} is deprecated, use `from startlite.testing import {name}` instead\",\n+        DeprecationWarning,\n+        stacklevel=2,\n+    )\n+\n     from . import testing\n \n     attr = globals()[name] = getattr(testing, name)\n", "issue": "`from starlite import *` broken if `testing` extra not installed\nThis is only an issue on main, not in any release.\r\n\r\nWhen I want to try a library out, I'll install it into a fresh env, run python repl and do `from lib import *` and have a play around. If just doing that raised an error it would freak me out a little about the lib.\r\n\r\nPossible solution:\r\n- remove `.testing` imports from `starlite.__all__`\r\n- add deprecation warning for top-level `.testing` imports\r\n- remove `if TYPE_CHECKING` too? May as well if we are doing the above, I think?\r\n\r\nRefs: #174 #130 \n", "before_files": [{"content": "from typing import TYPE_CHECKING, Any\n\nfrom starlite.datastructures import File, Redirect, State, Stream, Template\n\nfrom .app import Starlite\nfrom .config import (\n    CacheConfig,\n    CORSConfig,\n    OpenAPIConfig,\n    StaticFilesConfig,\n    TemplateConfig,\n)\nfrom .connection import Request, WebSocket\nfrom .controller import Controller\nfrom .dto import DTOFactory\nfrom .enums import (\n    HttpMethod,\n    MediaType,\n    OpenAPIMediaType,\n    RequestEncodingType,\n    ScopeType,\n)\nfrom .exceptions import (\n    HTTPException,\n    ImproperlyConfiguredException,\n    InternalServerException,\n    MissingDependencyException,\n    NotAuthorizedException,\n    NotFoundException,\n    PermissionDeniedException,\n    ServiceUnavailableException,\n    StarLiteException,\n    ValidationException,\n)\nfrom .handlers import (\n    ASGIRouteHandler,\n    BaseRouteHandler,\n    HTTPRouteHandler,\n    WebsocketRouteHandler,\n    asgi,\n    delete,\n    get,\n    patch,\n    post,\n    put,\n    route,\n    websocket,\n)\nfrom .logging import LoggingConfig, QueueListenerHandler\nfrom .middleware import AbstractAuthenticationMiddleware, AuthenticationResult\nfrom .openapi.controller import OpenAPIController\nfrom .params import Body, Dependency, Parameter\nfrom .plugins import PluginProtocol\nfrom .provide import Provide\nfrom .response import Response\nfrom .router import Router\nfrom .routes import BaseRoute, HTTPRoute, WebSocketRoute\nfrom .types import MiddlewareProtocol, Partial, ResponseHeader\n\nif TYPE_CHECKING:\n    from .testing import TestClient, create_test_client, create_test_request\n\n\n__all__ = [\n    \"ASGIRouteHandler\",\n    \"AbstractAuthenticationMiddleware\",\n    \"AuthenticationResult\",\n    \"BaseRoute\",\n    \"BaseRouteHandler\",\n    \"Body\",\n    \"CORSConfig\",\n    \"CacheConfig\",\n    \"Controller\",\n    \"Dependency\",\n    \"DTOFactory\",\n    \"File\",\n    \"HTTPException\",\n    \"HTTPRoute\",\n    \"HTTPRouteHandler\",\n    \"HttpMethod\",\n    \"ImproperlyConfiguredException\",\n    \"InternalServerException\",\n    \"LoggingConfig\",\n    \"MediaType\",\n    \"MiddlewareProtocol\",\n    \"MissingDependencyException\",\n    \"NotAuthorizedException\",\n    \"NotFoundException\",\n    \"OpenAPIConfig\",\n    \"OpenAPIController\",\n    \"OpenAPIMediaType\",\n    \"Parameter\",\n    \"Partial\",\n    \"PermissionDeniedException\",\n    \"PluginProtocol\",\n    \"Provide\",\n    \"QueueListenerHandler\",\n    \"Redirect\",\n    \"Request\",\n    \"RequestEncodingType\",\n    \"Response\",\n    \"ResponseHeader\",\n    \"Router\",\n    \"ScopeType\",\n    \"ServiceUnavailableException\",\n    \"StarLiteException\",\n    \"Starlite\",\n    \"State\",\n    \"StaticFilesConfig\",\n    \"Stream\",\n    \"Template\",\n    \"TemplateConfig\",\n    \"TestClient\",\n    \"ValidationException\",\n    \"WebSocket\",\n    \"WebSocketRoute\",\n    \"WebsocketRouteHandler\",\n    \"asgi\",\n    \"create_test_client\",\n    \"create_test_request\",\n    \"delete\",\n    \"get\",\n    \"patch\",\n    \"post\",\n    \"put\",\n    \"route\",\n    \"websocket\",\n]\n\n_dynamic_imports = {\"TestClient\", \"create_test_client\", \"create_test_request\"}\n\n\n# pylint: disable=import-outside-toplevel\ndef __getattr__(name: str) -> Any:\n    \"\"\"Provide lazy importing as per https://peps.python.org/pep-0562/\"\"\"\n    if name not in _dynamic_imports:\n        raise AttributeError(f\"Module {__package__} has no attribute {name}\")\n\n    from . import testing\n\n    attr = globals()[name] = getattr(testing, name)\n    return attr\n", "path": "starlite/__init__.py"}], "after_files": [{"content": "from typing import Any\n\nfrom starlite.datastructures import File, Redirect, State, Stream, Template\n\nfrom .app import Starlite\nfrom .config import (\n    CacheConfig,\n    CORSConfig,\n    OpenAPIConfig,\n    StaticFilesConfig,\n    TemplateConfig,\n)\nfrom .connection import Request, WebSocket\nfrom .controller import Controller\nfrom .dto import DTOFactory\nfrom .enums import (\n    HttpMethod,\n    MediaType,\n    OpenAPIMediaType,\n    RequestEncodingType,\n    ScopeType,\n)\nfrom .exceptions import (\n    HTTPException,\n    ImproperlyConfiguredException,\n    InternalServerException,\n    MissingDependencyException,\n    NotAuthorizedException,\n    NotFoundException,\n    PermissionDeniedException,\n    ServiceUnavailableException,\n    StarLiteException,\n    ValidationException,\n)\nfrom .handlers import (\n    ASGIRouteHandler,\n    BaseRouteHandler,\n    HTTPRouteHandler,\n    WebsocketRouteHandler,\n    asgi,\n    delete,\n    get,\n    patch,\n    post,\n    put,\n    route,\n    websocket,\n)\nfrom .logging import LoggingConfig, QueueListenerHandler\nfrom .middleware import AbstractAuthenticationMiddleware, AuthenticationResult\nfrom .openapi.controller import OpenAPIController\nfrom .params import Body, Dependency, Parameter\nfrom .plugins import PluginProtocol\nfrom .provide import Provide\nfrom .response import Response\nfrom .router import Router\nfrom .routes import BaseRoute, HTTPRoute, WebSocketRoute\nfrom .types import MiddlewareProtocol, Partial, ResponseHeader\n\n__all__ = [\n    \"ASGIRouteHandler\",\n    \"AbstractAuthenticationMiddleware\",\n    \"AuthenticationResult\",\n    \"BaseRoute\",\n    \"BaseRouteHandler\",\n    \"Body\",\n    \"CORSConfig\",\n    \"CacheConfig\",\n    \"Controller\",\n    \"Dependency\",\n    \"DTOFactory\",\n    \"File\",\n    \"HTTPException\",\n    \"HTTPRoute\",\n    \"HTTPRouteHandler\",\n    \"HttpMethod\",\n    \"ImproperlyConfiguredException\",\n    \"InternalServerException\",\n    \"LoggingConfig\",\n    \"MediaType\",\n    \"MiddlewareProtocol\",\n    \"MissingDependencyException\",\n    \"NotAuthorizedException\",\n    \"NotFoundException\",\n    \"OpenAPIConfig\",\n    \"OpenAPIController\",\n    \"OpenAPIMediaType\",\n    \"Parameter\",\n    \"Partial\",\n    \"PermissionDeniedException\",\n    \"PluginProtocol\",\n    \"Provide\",\n    \"QueueListenerHandler\",\n    \"Redirect\",\n    \"Request\",\n    \"RequestEncodingType\",\n    \"Response\",\n    \"ResponseHeader\",\n    \"Router\",\n    \"ScopeType\",\n    \"ServiceUnavailableException\",\n    \"StarLiteException\",\n    \"Starlite\",\n    \"State\",\n    \"StaticFilesConfig\",\n    \"Stream\",\n    \"Template\",\n    \"TemplateConfig\",\n    \"ValidationException\",\n    \"WebSocket\",\n    \"WebSocketRoute\",\n    \"WebsocketRouteHandler\",\n    \"asgi\",\n    \"delete\",\n    \"get\",\n    \"patch\",\n    \"post\",\n    \"put\",\n    \"route\",\n    \"websocket\",\n]\n\n\n_deprecated_imports = {\"TestClient\", \"create_test_client\", \"create_test_request\"}\n\n\n# pylint: disable=import-outside-toplevel\ndef __getattr__(name: str) -> Any:\n    \"\"\"Provide lazy importing as per https://peps.python.org/pep-0562/\"\"\"\n    if name not in _deprecated_imports:\n        raise AttributeError(f\"Module {__package__} has no attribute {name}\")\n\n    import warnings\n\n    warnings.warn(\n        f\"Importing {name} from {__package__} is deprecated, use `from startlite.testing import {name}` instead\",\n        DeprecationWarning,\n        stacklevel=2,\n    )\n\n    from . import testing\n\n    attr = globals()[name] = getattr(testing, name)\n    return attr\n", "path": "starlite/__init__.py"}]}