11"""Registers the jupyterlab front and backend quickopen extensions"""
22import json
3- import os . path as osp
3+ from pathlib import Path
44
55from ._version import __version__
66
7- HERE = osp . abspath ( osp . dirname ( __file__ ))
7+ HERE = Path ( __file__ ). parent . resolve ( )
88
9- with open ( osp . join ( HERE , "labextension" , "package.json" )) as fid :
9+ with ( HERE / "labextension" / "package.json" ). open ( ) as fid :
1010 data = json .load (fid )
1111
1212
@@ -27,15 +27,15 @@ def _load_jupyter_server_extension(server_app):
2727
2828 Parameters
2929 ----------
30- lab_app : jupyterlab.labapp.LabApp
30+ server_app : jupyterlab.labapp.LabApp
3131 JupyterLab application instance
3232 """
3333 server_app .log .debug ("notebook_dir: %s" , server_app .notebook_dir )
3434 server_app .log .debug (
3535 "contents_manager.root_dir: %s" , server_app .contents_manager .root_dir
3636 )
3737 if (
38- not osp . isdir (server_app .root_dir )
38+ not Path (server_app .root_dir ). is_dir ( )
3939 or server_app .contents_manager .root_dir != server_app .root_dir
4040 ):
4141 server_app .log .info (
@@ -54,3 +54,7 @@ def _load_jupyter_server_extension(server_app):
5454 f"Registered QuickOpenHandler extension at URL path { route_pattern } "
5555 f"to serve results of scanning local path { server_app .notebook_dir } "
5656 )
57+
58+
59+ # For backward compatibility with notebook server - useful for Binder/JupyterHub
60+ load_jupyter_server_extension = _load_jupyter_server_extension
0 commit comments