Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis committed Dec 16, 2024
1 parent 52381cc commit 23fb2c2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
19 changes: 18 additions & 1 deletion jhub_apps/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ class JAppsConfig(SingletonConfigurable):

startup_apps = List(
trait=Any, # TODO: Change this, use Instance() maybe or define a new type - https://traitlets.readthedocs.io/en/stable/defining_traits.html
default_value=[{'display_name': 'My Startup App', 'description': 'description', 'thumbnail': 'data:image/jpeg;base64,Y29udGVudHMgb2YgdGh1bWJuYWls', 'filepath': '', 'framework': 'panel', 'custom_command': '', 'public': False, 'keep_alive': False, 'env': {'ENV_VAR_KEY_1': 'ENV_VAR_KEY_1', 'ENV_VAR_KEY_2': 'ENV_VAR_KEY_2'}, 'repository': None, 'jhub_app': True, 'conda_env': '', 'profile': '', 'share_with': {'users': ['alice', 'john'], 'groups': ['alpha', 'beta']}}],
default_value=[{
'display_name': 'Adam\'s App',
'description': 'description',
'thumbnail': 'data:image/jpeg;base64,Y29udGVudHMgb2YgdGh1bWJuYWls',
'filepath': '',
'framework': 'panel',
'custom_command': '',
'public': False,
'keep_alive': False,
'env': {'ENV_VAR_KEY_1': 'ENV_VAR_KEY_1',
'ENV_VAR_KEY_2': 'ENV_VAR_KEY_2'},
'repository': None,
'jhub_app': True,
'conda_env': '',
'profile': '',
'share_with':
{'users': ['alice', 'john'], 'groups': ['alpha', 'beta']}
}],
help="List of apps to start on JHub Apps Launcher startup",
).tag(config=True)
3 changes: 0 additions & 3 deletions jhub_apps/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
from traitlets.config import LazyConfigValue

from jhub_apps import JAppsConfig
from jhub_apps.hub_client.hub_client import HubClient
from jhub_apps.hub_client.utils import is_jupyterhub_5
from jhub_apps.service.models import UserOptions
from jhub_apps.spawner.spawner_creation import subclass_spawner


Expand Down Expand Up @@ -127,7 +125,6 @@ def install_jhub_apps(c, spawner_to_subclass, *, oauth_no_confirm=False):
else:
c.JupyterHub.load_roles = services_roles

# I considered instantiating startup_apps here b/c I have access to c.JAppsConfig.startup_apps, but JUPYTERHUB_API_URL wasn't set yet which was needed by the HubClient so I moved it to jhub_apps/service/app.py.
return c


1 change: 1 addition & 0 deletions jhub_apps/service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def lifespan(app: FastAPI):
def instantiate_startup_apps(user_options_list: list[dict[str, Any]], username: str):
# instantiate custom apps
for user_options_dict in user_options_list:
print(f"Instantiating app with user_options: {pprint.pformat(user_options_dict)}") # TODO: Remove
user_options = UserOptions(**user_options_dict)
hub_client = HubClient(username=username)
hub_client.create_server(
Expand Down
2 changes: 1 addition & 1 deletion jhub_apps/tests/tests_e2e/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_create_server_with_git_repository():
display_name="Test Application",
description="App description",
framework=Framework.panel.value,
thumbnail="data:image/png;base64,ZHVtbXkgaW1hZ2UgZGF0YQ==",
thumbnail="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII",
filepath="panel_basic.py",
repository=Repository(
url="https://github.com/nebari-dev/jhub-apps-from-git-repo-example.git",
Expand Down

0 comments on commit 23fb2c2

Please sign in to comment.