Skip to content

Commit

Permalink
Moving lightning_api_access out of base requirements (#15844)
Browse files Browse the repository at this point in the history
* moving the requirements to components extras

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* component requirements to devel

* importing torch in local scope

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* skipping doctest

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
  • Loading branch information
4 people committed Dec 1, 2022
1 parent c5d3bba commit 5864409
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion requirements/app/base.txt
Expand Up @@ -12,4 +12,3 @@ beautifulsoup4>=4.8.0, <4.11.2
inquirer>=2.10.0
psutil<5.9.4
click<=8.1.3
lightning_api_access>=0.0.3
2 changes: 2 additions & 0 deletions requirements/app/components.txt
@@ -0,0 +1,2 @@
# deps required by components in the lightning app repository (src/lightning_app/components)
lightning_api_access>=0.0.3
3 changes: 3 additions & 0 deletions requirements/app/devel.txt
Expand Up @@ -10,4 +10,7 @@
# extended list of dependencies for UI
-r ./ui.txt

# extended list of dependencies for UI
-r ./components.txt

-r ./examples.txt
10 changes: 8 additions & 2 deletions src/lightning_app/components/serve/python_server.py
Expand Up @@ -6,6 +6,7 @@

import uvicorn
from fastapi import FastAPI
from lightning_utilities.core.imports import module_available
from pydantic import BaseModel
from starlette.staticfiles import StaticFiles

Expand All @@ -17,9 +18,14 @@

logger = Logger(__name__)

__doctest_skip__ = []
# Skip doctests if requirements aren't available
if not module_available("lightning_api_access"):
__doctest_skip__ += ["PythonServer", "PythonServer.*"]

# Skip doctests if requirements aren't available
if not _is_torch_available():
__doctest_skip__ = ["PythonServer", "PythonServer.*"]
__doctest_skip__ += ["PythonServer", "PythonServer.*"]


class _PyTorchSpawnRunExecutor(WorkRunExecutor):
Expand Down Expand Up @@ -90,7 +96,7 @@ def _get_sample_data() -> Dict[Any, Any]:


class PythonServer(LightningWork, abc.ABC):
@requires("torch")
@requires(["torch", "lightning_api_access"])
def __init__( # type: ignore
self,
host: str = "127.0.0.1",
Expand Down

0 comments on commit 5864409

Please sign in to comment.