Skip to content

Commit

Permalink
Allow overriding resource mode in Jupyter Server Extension (#6965)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Jul 10, 2024
1 parent 735ea25 commit 86eff50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions panel/io/jupyter_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PanelExecutor(WSHandler):

_tasks = set()

def __init__(self, path, token, root_url):
def __init__(self, path, token, root_url, resources='server'):
self.path = path
self.token = token
self.root_url = root_url
Expand All @@ -87,8 +87,10 @@ def __init__(self, path, token, root_url):
self.write_lock = tornado.locks.Lock()
self._context = None

resources = os.environ.get('BOKEH_RESOURCES', resources)
root_url = self.root_url if resources == 'server' else None
self.resources = Resources(
mode=os.environ.get('BOKEH_RESOURCES', 'server'), root_url=self.root_url,
mode=resources, root_url=root_url,
path_versioner=StaticHandler.append_version, absolute=True
)
self._set_state()
Expand Down
1 change: 0 additions & 1 deletion panel/io/jupyter_server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def get_server_root_dir(settings):
import pathlib
import sys
os.environ['BOKEH_RESOURCES'] = 'server'
app = r'{{ path }}'
os.chdir(str(pathlib.Path(app).parent))
sys.path = [os.getcwd()] + sys.path[1:]
Expand Down

0 comments on commit 86eff50

Please sign in to comment.