Repository: jupyter/jupyter_core

Issue:
Jupyter --paths incorrect output
Hi,

`jupyter --paths` outputs:
```
$ jupyter --paths
config:
    /path/to/user/.jupyter
    /path/to/venv/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /path/to/user/.local/share/jupyter
    /path/to/venv/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /path/to/user/.local/share/jupyter/runtime
```

Surprisingly, if you have a file named `/path/to/user/jupyter_notebook_config.py` it get's used too! I'm not sure if this is a bug in the output of `--paths` or a bug in which files should be used for config (or if this a bug in jupyter_server).

Discussion:

Patch:
diff --git a/jupyter_core/application.py b/jupyter_core/application.py
index cb46d12..5b05706 100644
--- a/jupyter_core/application.py
+++ b/jupyter_core/application.py
@@ -88,8 +88,8 @@ class JupyterApp(Application):
     def config_file_paths(self):
         path = jupyter_config_path()
         if self.config_dir not in path:
-            path.insert(0, self.config_dir)
-        path.insert(0, os.getcwd())
+            # Insert config dir after cwd.
+            path.insert(1, self.config_dir)
         return path
 
     data_dir = Unicode()
diff --git a/jupyter_core/paths.py b/jupyter_core/paths.py
index 7dafd91..f9d4625 100644
--- a/jupyter_core/paths.py
+++ b/jupyter_core/paths.py
@@ -251,7 +251,7 @@ def jupyter_config_path():
         # jupyter_config_dir makes a blank config when JUPYTER_NO_CONFIG is set.
         return [jupyter_config_dir()]
 
-    paths: list = []
+    paths: list = [os.getcwd()]
 
     # highest priority is explicit environment variable
     if os.environ.get("JUPYTER_CONFIG_PATH"):


Test patch:
diff --git a/jupyter_core/tests/test_paths.py b/jupyter_core/tests/test_paths.py
index 0d16358..7e0fa37 100644
--- a/jupyter_core/tests/test_paths.py
+++ b/jupyter_core/tests/test_paths.py
@@ -287,6 +287,7 @@ def test_jupyter_config_path():
     values = list(
         dict.fromkeys(
             [
+                os.getcwd(),
                 jupyter_config_dir(),
                 os.path.join(site.getuserbase(), "etc", "jupyter"),
                 paths.ENV_CONFIG_PATH[0],
@@ -300,8 +301,9 @@ def test_jupyter_config_path():
 def test_jupyter_config_path_no_user_site():
     with patch.object(site, "ENABLE_USER_SITE", False):
         path = jupyter_config_path()
-    assert path[0] == jupyter_config_dir()
-    assert path[1] == paths.ENV_CONFIG_PATH[0]
+    assert path[0] == os.getcwd()
+    assert path[1] == jupyter_config_dir()
+    assert path[2] == paths.ENV_CONFIG_PATH[0]
 
 
 def test_jupyter_config_path_prefer_env():
@@ -312,6 +314,7 @@ def test_jupyter_config_path_prefer_env():
     values = list(
         dict.fromkeys(
             [
+                os.getcwd(),
                 paths.ENV_CONFIG_PATH[0],
                 jupyter_config_dir(),
                 os.path.join(site.getuserbase(), "etc", "jupyter"),
@@ -332,7 +335,7 @@ def test_jupyter_config_path_env():
 
     with patch.dict("os.environ", {"JUPYTER_CONFIG_PATH": path_env}):
         path = jupyter_config_path()
-    assert path[:2] == [pjoin("foo", "bar"), pjoin("bar", "baz")]
+    assert path[1:3] == [pjoin("foo", "bar"), pjoin("bar", "baz")]
 
 
 def test_prefer_environment_over_user():