Skip to content

Commit

Permalink
Merge pull request #838 from seeM/clarify-v1-warning
Browse files Browse the repository at this point in the history
Include filename in `nbdev_export` warning when nbdev1 syntax is used
  • Loading branch information
jph00 authored Aug 12, 2022
2 parents dd5a0b1 + bce9e4c commit d1d2dbb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions nbdev/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ def create_modules(path, dest, procs=None, debug=False, mod_maker=ModuleMaker):
all_cells = exp.in_all[mod]
name = getattr(exp, 'default_exp', None) if mod=='#' else mod
if not name:
warn("Could not find `#|default_exp` cell. Note nbdev2 no longer supports nbdev1 syntax. Run `nbdev_migrate` to upgrade.\n"
"See https://nbdev.fast.ai/getting_started.html for more information.")
warn(f"Notebook '{path}' uses `#|export` without `#|default_exp` cell.\n"
"Note nbdev2 no longer supports nbdev1 syntax. Run `nbdev_migrate` to upgrade.\n"
"See https://nbdev.fast.ai/getting_started.html for more information.")
return
mm = mod_maker(dest=dest, name=name, nb_path=path, is_new=mod=='#')
mm.make(cells, all_cells, lib_path=dest)
Expand Down
5 changes: 3 additions & 2 deletions nbs/04a_export.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@
" all_cells = exp.in_all[mod]\n",
" name = getattr(exp, 'default_exp', None) if mod=='#' else mod\n",
" if not name:\n",
" warn(\"Could not find `#|default_exp` cell. Note nbdev2 no longer supports nbdev1 syntax. Run `nbdev_migrate` to upgrade.\\n\"\n",
" \"See https://nbdev.fast.ai/getting_started.html for more information.\")\n",
" warn(f\"Notebook '{path}' uses `#|export` without `#|default_exp` cell.\\n\"\n",
" \"Note nbdev2 no longer supports nbdev1 syntax. Run `nbdev_migrate` to upgrade.\\n\"\n",
" \"See https://nbdev.fast.ai/getting_started.html for more information.\")\n",
" return\n",
" mm = mod_maker(dest=dest, name=name, nb_path=path, is_new=mod=='#')\n",
" mm.make(cells, all_cells, lib_path=dest)"
Expand Down

0 comments on commit d1d2dbb

Please sign in to comment.