Skip to content

Commit

Permalink
Merge branch 'main' into feature/add-trial-compare
Browse files Browse the repository at this point in the history
  • Loading branch information
hrntsm committed Jan 31, 2025
2 parents 48edf11 + 765735c commit ab441d8
Show file tree
Hide file tree
Showing 6 changed files with 9,273 additions and 6,873 deletions.
6 changes: 5 additions & 1 deletion jupyterlab/jupyterlab_optuna/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

_dashboard_app: WSGIApplication | None = None
_is_initialized = False
_base_url = ""
threading_lock = threading.Lock()


Expand Down Expand Up @@ -66,7 +67,7 @@ def dashboard_app(env, start_response):
# Set Content-Type
if "/api/" in env["PATH_INFO"]:
env["CONTENT_TYPE"] = "application/json"
env["PATH_INFO"] = env["PATH_INFO"].replace(f"/{API_NAMESPACE}", "")
env["PATH_INFO"] = env["PATH_INFO"].replace(_base_url, "")

if _dashboard_app is None:
start_response("400 Bad Request", [{"Content-Type": "application/json"}])
Expand All @@ -76,9 +77,12 @@ def dashboard_app(env, start_response):


def setup_handlers(web_app):
global _base_url

host_pattern = ".*$"

base_url = web_app.settings["base_url"]
_base_url = url_path_join(base_url, API_NAMESPACE)
# Prepend the base_url so that it works in a JupyterHub setting
initialize_route_pattern = url_path_join(base_url, API_NAMESPACE, "api/is_initialized")
handlers = [(initialize_route_pattern, InitializedStateHandler)]
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-optuna",
"version": "0.2.0",
"version": "0.2.2-beta.1",
"description": "A JupyterLab extension for Optuna",
"keywords": [
"jupyter",
Expand Down
10 changes: 4 additions & 6 deletions jupyterlab/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ namespace CommandIDs {
* Initialization data for the jupyterlab-optuna extension.
*/
const plugin: JupyterFrontEndPlugin<void> = {
id: "@jupyterlab-examples/server-extension:plugin",
description:
"A minimal JupyterLab extension with backend and frontend parts.",
id: "jupyterlab-optuna:plugin",
description: "A JupyterLab extension for Optuna",
autoStart: true,
optional: [ILauncher],
requires: [ICommandPalette],
Expand All @@ -32,9 +31,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
palette: ICommandPalette,
launcher: ILauncher | null
) => {
console.log(
"JupyterLab extension @jupyterlab-examples/server-extension is activated!"
)
console.log("JupyterLab extension jupyterlab-optuna is activated!")
console.log("ICommandPalette:", palette)

const { commands, shell } = app
Expand All @@ -60,6 +57,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
command: CommandIDs.ui,
})
}
palette.addItem({ command: CommandIDs.ui, category: "Optuna" })
},
}

Expand Down
Loading

0 comments on commit ab441d8

Please sign in to comment.