Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
fix requirement lightning[app]
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Oct 16, 2023
1 parent a988782 commit ff62871
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import lightning as L
from lightning.app import CloudCompute, LightningApp

from lai_jupyter import JupyterLab

app = L.LightningApp(JupyterLab(cloud_compute=L.CloudCompute("cpu-small")))
app = LightningApp(JupyterLab(cloud_compute=CloudCompute("cpu-small")))
8 changes: 4 additions & 4 deletions lai_jupyter/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from time import sleep
from typing import Literal, Optional

import lightning as L
from lightning.app import BuildConfig, CloudCompute, LightningWork

R_INSTALL: list = """
sudo apt-get update
Expand All @@ -28,19 +28,19 @@


@dataclass
class CustomBuildConfig(L.BuildConfig):
class CustomBuildConfig(BuildConfig):
kernel: str = "python"

def build_commands(self) -> list:
commands = {"python": [], "r": R_INSTALL, "julia": JULIA_INSTALL}[self.kernel]
return commands


class JupyterLab(L.LightningWork):
class JupyterLab(LightningWork):
def __init__(
self,
kernel: Literal["python", "r", "julia"] = "python",
cloud_compute: Optional[L.CloudCompute] = None,
cloud_compute: Optional[CloudCompute] = None,
parallel: bool = True,
) -> None:
super().__init__(
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
typing-extensions>=4.0.0
jupyterlab==4.0.6
lightning>=1.9.0, <3.0.0
typing-extensions >=4.0.0
jupyterlab ==4.0.6
lightning[app] >=2.0.0, <2.2.0
notebook
10 changes: 5 additions & 5 deletions tests/test_jupyter_app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import os

import lightning as L
import requests
from lightning.app import CloudCompute, LightningApp, LightningFlow
from lightning.app.runners import MultiProcessRuntime

from lai_jupyter import JupyterLab


class TestJupyterServer(L.LightningFlow):
class TestJupyterServer(LightningFlow):
def __init__(self):
super().__init__()
self.success = False
Expand All @@ -18,11 +18,11 @@ def run(self, jupyter_url: str):
self.success = True


class RootFlow(L.LightningFlow):
class RootFlow(LightningFlow):
def __init__(self):
super().__init__()
self.jupyter_work = JupyterLab(
kernel="python", cloud_compute=L.CloudCompute(os.getenv("LIGHTNING_JUPYTER_LAB_COMPUTE", "cpu-small"))
kernel="python", cloud_compute=CloudCompute(os.getenv("LIGHTNING_JUPYTER_LAB_COMPUTE", "cpu-small"))
)
self.test_jupyter_flow = TestJupyterServer()

Expand All @@ -40,5 +40,5 @@ def configure_layout(self):


def test_file_server():
app = L.LightningApp(RootFlow())
app = LightningApp(RootFlow())
MultiProcessRuntime(app).dispatch()

0 comments on commit ff62871

Please sign in to comment.