Skip to content

Commit 0bb7b5d

Browse files
authored
Merge pull request #1451 from fastai/cli-export
Use Config.find
2 parents 69d3164 + aed2886 commit 0bb7b5d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

nbdev/config.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,8 @@ def nbdev_create_config(
181181

182182
# %% ../nbs/api/01_config.ipynb
183183
def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):
184-
cfg_path = path = Path.cwd() if path is None else Path(path)
185-
while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent
186-
if not (cfg_path/cfg_name).exists(): cfg_path = path
187-
return cfg_path/cfg_name
184+
cfg_path = Path.cwd() if path is None else Path(path)
185+
return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name)
188186

189187
# %% ../nbs/api/01_config.ipynb
190188
def _xdg_config_paths(cfg_name=_nbdev_cfg_name):

nbs/api/01_config.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,8 @@
402402
"source": [
403403
"#|export\n",
404404
"def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):\n",
405-
" cfg_path = path = Path.cwd() if path is None else Path(path)\n",
406-
" while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent\n",
407-
" if not (cfg_path/cfg_name).exists(): cfg_path = path\n",
408-
" return cfg_path/cfg_name"
405+
" cfg_path = Path.cwd() if path is None else Path(path)\n",
406+
" return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name)"
409407
]
410408
},
411409
{

0 commit comments

Comments
 (0)