Skip to content
Open
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
2 changes: 1 addition & 1 deletion nbdev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- `nbdev.extract_attachments`: A preprocessor that extracts all of the attachments from the notebook file. The extracted attachments are returned in the 'resources' dictionary.
- `nbdev.moddocs`: # Module docs: creating them from existing notebooks
- `nbdev.skill`: Author clear, executable nbdev notebooks where code, prose, examples, outputs, and tests form one coherent narrative."""
- `nbdev.skill`: Author clear, executable nbdev notebooks where code, prose, examples, outputs, and tests form one coherent narrative. Trigger: ALWAYS read this before ANY notebook edit."""

__version__ = "3.3.13"

Expand Down
2 changes: 1 addition & 1 deletion nbdev/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def proc_nbs(
(cache/'_quarto.yml').unlink(missing_ok=True) # single-doc renders strip the staged copy in place (`_strip_sidebar`), so always restage it

files = files.map(_proc_file, mtime=cache_mtime, cache=cache, path=path).filter()
kw = {} if IN_NOTEBOOK else {'method':'spawn'}
kw = {} if in_notebook() else {'method':'spawn'}
parallel(nbdev.serve_drv.main, files, n_workers=n_workers, pause=0.01, **kw)
if cache.exists(): cache.touch()
return cache
6 changes: 3 additions & 3 deletions nbdev/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def test_nb(
cell_timeout:int=600 # seconds before each cell times out (None: no limit)
):
"Execute tests in notebook in `fn` except those with `skip_flags`"
if not IN_NOTEBOOK and threading.current_thread() is threading.main_thread(): signal.signal(signal.SIGINT, _int_handler)
if not in_notebook() and threading.current_thread() is threading.main_thread(): signal.signal(signal.SIGINT, _int_handler)
fn = Path(fn)
_cur_nb[0] = fn
if basepath: sys.path.insert(0, str(basepath))
prev_test = os.environ.get('IN_TEST')
if not IN_NOTEBOOK: os.environ['IN_TEST'] = '1'
if not in_notebook(): os.environ['IN_TEST'] = '1'
try:
flags=set(L(skip_flags)) - set(L(force_flags))
nb = NBProcessor(fn, rm_directives=False, process=True).nb
Expand Down Expand Up @@ -143,7 +143,7 @@ def nbdev_test(
if len(files)==0: return print('No files were eligible for testing')

if n_workers is None: n_workers = 0 if len(files)==1 else min(num_cpus(), 8)
if IN_NOTEBOOK: kw = {'method':'spawn'} if os.name=='nt' or sys.platform=='darwin' else {'method':'forkserver'}
if in_notebook(): kw = {'method':'spawn'} if os.name=='nt' or sys.platform=='darwin' else {'method':'forkserver'}
else: kw = {'method':'spawn'} if sys.platform=='darwin' else {}
wd_pth = cfg.nbs_path
with working_directory(wd_pth if (wd_pth and wd_pth.exists()) else os.getcwd()):
Expand Down
6 changes: 3 additions & 3 deletions nbs/api/12_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@
" cell_timeout:int=600 # seconds before each cell times out (None: no limit)\n",
"):\n",
" \"Execute tests in notebook in `fn` except those with `skip_flags`\"\n",
" if not IN_NOTEBOOK and threading.current_thread() is threading.main_thread(): signal.signal(signal.SIGINT, _int_handler)\n",
" if not in_notebook() and threading.current_thread() is threading.main_thread(): signal.signal(signal.SIGINT, _int_handler)\n",
" fn = Path(fn)\n",
" _cur_nb[0] = fn\n",
" if basepath: sys.path.insert(0, str(basepath))\n",
" prev_test = os.environ.get('IN_TEST')\n",
" if not IN_NOTEBOOK: os.environ['IN_TEST'] = '1'\n",
" if not in_notebook(): os.environ['IN_TEST'] = '1'\n",
" try:\n",
" flags=set(L(skip_flags)) - set(L(force_flags))\n",
" nb = NBProcessor(fn, rm_directives=False, process=True).nb\n",
Expand Down Expand Up @@ -295,7 +295,7 @@
" if len(files)==0: return print('No files were eligible for testing')\n",
"\n",
" if n_workers is None: n_workers = 0 if len(files)==1 else min(num_cpus(), 8)\n",
" if IN_NOTEBOOK: kw = {'method':'spawn'} if os.name=='nt' or sys.platform=='darwin' else {'method':'forkserver'}\n",
" if in_notebook(): kw = {'method':'spawn'} if os.name=='nt' or sys.platform=='darwin' else {'method':'forkserver'}\n",
" else: kw = {'method':'spawn'} if sys.platform=='darwin' else {}\n",
" wd_pth = cfg.nbs_path\n",
" with working_directory(wd_pth if (wd_pth and wd_pth.exists()) else os.getcwd()):\n",
Expand Down
2 changes: 1 addition & 1 deletion nbs/api/17_serve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
" (cache/'_quarto.yml').unlink(missing_ok=True) # single-doc renders strip the staged copy in place (`_strip_sidebar`), so always restage it\n",
"\n",
" files = files.map(_proc_file, mtime=cache_mtime, cache=cache, path=path).filter()\n",
" kw = {} if IN_NOTEBOOK else {'method':'spawn'}\n",
" kw = {} if in_notebook() else {'method':'spawn'}\n",
" parallel(nbdev.serve_drv.main, files, n_workers=n_workers, pause=0.01, **kw)\n",
" if cache.exists(): cache.touch()\n",
" return cache"
Expand Down
Loading