diff --git a/src/lightning_app/components/serve/python_server.py b/src/lightning_app/components/serve/python_server.py index e447673993973..40b7e83a3bdca 100644 --- a/src/lightning_app/components/serve/python_server.py +++ b/src/lightning_app/components/serve/python_server.py @@ -7,7 +7,7 @@ import uvicorn from fastapi import FastAPI -from lightning_utilities.core.imports import compare_version +from lightning_utilities.core.imports import compare_version, module_available from pydantic import BaseModel from lightning_app.core.work import LightningWork @@ -16,12 +16,9 @@ logger = Logger(__name__) -__doctest_skip__ = ["PythonServer", "PythonServer.*"] - - # Skip doctests if requirements aren't available -if not _is_torch_available(): - __doctest_skip__ += ["PythonServer", "PythonServer.*"] +if not module_available("lightning_api_access") or not _is_torch_available(): + __doctest_skip__ = ["PythonServer", "PythonServer.*"] def _get_device():