Skip to content

Commit e3a44ce

Browse files
committed
add pub func
1 parent 906a467 commit e3a44ce

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

nbdev/_modidx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
'nbdev.config.config_key': ('api/config.html#config_key', 'nbdev/config.py'),
4242
'nbdev.config.create_output': ('api/config.html#create_output', 'nbdev/config.py'),
4343
'nbdev.config.get_config': ('api/config.html#get_config', 'nbdev/config.py'),
44+
'nbdev.config.is_nbdev': ('api/config.html#is_nbdev', 'nbdev/config.py'),
4445
'nbdev.config.nbdev_create_config': ('api/config.html#nbdev_create_config', 'nbdev/config.py'),
4546
'nbdev.config.show_src': ('api/config.html#show_src', 'nbdev/config.py'),
4647
'nbdev.config.update_version': ('api/config.html#update_version', 'nbdev/config.py'),

nbdev/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/01_config.ipynb.
44

55
# %% auto 0
6-
__all__ = ['nbdev_create_config', 'get_config', 'config_key', 'create_output', 'show_src', 'update_version', 'add_init',
7-
'write_cells']
6+
__all__ = ['nbdev_create_config', 'get_config', 'config_key', 'is_nbdev', 'create_output', 'show_src', 'update_version',
7+
'add_init', 'write_cells']
88

99
# %% ../nbs/api/01_config.ipynb
1010
from datetime import datetime
@@ -209,6 +209,9 @@ def config_key(c, default=None, path=True, missing_ok=None):
209209
warn("`config_key` is deprecated. Use `get_config().get` or `get_config().path` instead.", DeprecationWarning)
210210
return get_config().path(c, default) if path else get_config().get(c, default)
211211

212+
# %% ../nbs/api/01_config.ipynb
213+
def is_nbdev(): return _nbdev_config_file().exists()
214+
212215
# %% ../nbs/api/01_config.ipynb
213216
def create_output(txt, mime):
214217
"Add a cell output containing `txt` of the `mime` text MIME sub-type"

nbs/api/01_config.ipynb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,26 @@
596596
"## Helpers"
597597
]
598598
},
599+
{
600+
"cell_type": "code",
601+
"execution_count": null,
602+
"metadata": {},
603+
"outputs": [],
604+
"source": [
605+
"#|export\n",
606+
"def is_nbdev(): return _nbdev_config_file().exists()"
607+
]
608+
},
609+
{
610+
"cell_type": "code",
611+
"execution_count": null,
612+
"metadata": {},
613+
"outputs": [],
614+
"source": [
615+
"#|hide\n",
616+
"test_eq(is_nbdev(), True)"
617+
]
618+
},
599619
{
600620
"cell_type": "code",
601621
"execution_count": null,

0 commit comments

Comments
 (0)