Skip to content

Commit

Permalink
Backport PR #13589 on branch 3.5.x (use jupyter_config_dir instead of…
Browse files Browse the repository at this point in the history
… config_path[0] for workspaces, settings) (#13605)

* Backport PR #13589: use jupyter_config_dir instead of config_path[0] for workspaces, settings

* Fix Python test

Co-authored-by: Min RK <benjaminrk@gmail.com>
Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
  • Loading branch information
3 people committed Dec 19, 2022
1 parent e41d029 commit d309941
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions jupyterlab/commands.py
Expand Up @@ -27,7 +27,7 @@
from urllib.error import URLError
from urllib.request import Request, quote, urljoin, urlopen

from jupyter_core.paths import jupyter_config_path
from jupyter_core.paths import jupyter_config_dir
from jupyter_server.extension.serverextension import (
GREEN_ENABLED,
GREEN_OK,
Expand Down Expand Up @@ -141,14 +141,14 @@ def pjoin(*args):
def get_user_settings_dir():
"""Get the configured JupyterLab user settings directory."""
settings_dir = os.environ.get("JUPYTERLAB_SETTINGS_DIR")
settings_dir = settings_dir or pjoin(jupyter_config_path()[0], "lab", "user-settings")
settings_dir = settings_dir or pjoin(jupyter_config_dir(), "lab", "user-settings")
return osp.abspath(settings_dir)


def get_workspaces_dir():
"""Get the configured JupyterLab workspaces directory."""
workspaces_dir = os.environ.get("JUPYTERLAB_WORKSPACES_DIR")
workspaces_dir = workspaces_dir or pjoin(jupyter_config_path()[0], "lab", "workspaces")
workspaces_dir = workspaces_dir or pjoin(jupyter_config_dir(), "lab", "workspaces")
return osp.abspath(workspaces_dir)


Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Expand Up @@ -53,7 +53,8 @@ test =
pytest-cov
pytest-console-scripts
pytest-check-links>=0.5
pytest-jupyter>=0.5.3
pytest_tornasync
pytest-jupyter>=0.6.0
requests
requests_cache
virtualenv
Expand Down

0 comments on commit d309941

Please sign in to comment.