Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nbdev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ def watch_export(nbs:str=None, # Nb directory to watch for changes
lib = lib or (cfg.lib_path if cfg else '.')
if cfg and (nbs != cfg.nbs_path or lib != cfg.lib_path) and not force:
raise ValueError("In nbdev project. Use --force to override config.")
run(f'nbdev_export')
run('nbdev-export')
def _export(e,lib=lib):
p = e.src_path
if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith(('tmp','.~'))):
if e.event_type == 'modified':
time.sleep(0.1)
try: run(f'nb_export --lib_path {lib} "{p}"')
try: run(f'nb-export --lib_path {lib} "{p}"')
except IOError:
time.sleep(0.3)
run(f'nb_export --lib_path {lib} "{p}"')
run(f'nb-export --lib_path {lib} "{p}"')
with fs_watchdog(_export, nbs):
while True: time.sleep(1)

Expand Down
14 changes: 10 additions & 4 deletions nbs/api/13_cli.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,16 @@
" lib = lib or (cfg.lib_path if cfg else '.')\n",
" if cfg and (nbs != cfg.nbs_path or lib != cfg.lib_path) and not force:\n",
" raise ValueError(\"In nbdev project. Use --force to override config.\")\n",
" run(f'nbdev_export')\n",
" run('nbdev-export')\n",
" def _export(e,lib=lib):\n",
" p = e.src_path\n",
" if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith(('tmp','.~'))):\n",
" if e.event_type == 'modified':\n",
" time.sleep(0.1)\n",
" try: run(f'nb_export --lib_path {lib} \"{p}\"')\n",
" try: run(f'nb-export --lib_path {lib} \"{p}\"')\n",
" except IOError:\n",
" time.sleep(0.3)\n",
" run(f'nb_export --lib_path {lib} \"{p}\"')\n",
" run(f'nb-export --lib_path {lib} \"{p}\"')\n",
" with fs_watchdog(_export, nbs):\n",
" while True: time.sleep(1)"
]
Expand Down Expand Up @@ -445,7 +445,13 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "python3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
8 changes: 6 additions & 2 deletions nbs/api/16_migrate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,8 @@
"outputs": [],
"source": [
"from configparser import ConfigParser\n",
"import tomllib"
"try: import tomllib\n",
"except ImportError: import tomli as tomllib"
]
},
{
Expand Down Expand Up @@ -1551,7 +1552,10 @@
]
}
],
"metadata": {},
"metadata": {
"solveit_dialog_mode": "learning",
"solveit_ver": 2
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading