nbdev 3.3.5__tar.gz → 3.3.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {nbdev-3.3.5/nbdev.egg-info → nbdev-3.3.7}/PKG-INFO +3 -3
  2. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/__init__.py +1 -1
  3. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/_modidx.py +3 -4
  4. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/frontmatter.py +7 -30
  5. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/migrate.py +2 -2
  6. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/processors.py +3 -2
  7. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/test.py +7 -4
  8. {nbdev-3.3.5 → nbdev-3.3.7/nbdev.egg-info}/PKG-INFO +3 -3
  9. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev.egg-info/requires.txt +2 -2
  10. {nbdev-3.3.5 → nbdev-3.3.7}/pyproject.toml +1 -1
  11. {nbdev-3.3.5 → nbdev-3.3.7}/CONTRIBUTING.md +0 -0
  12. {nbdev-3.3.5 → nbdev-3.3.7}/LICENSE +0 -0
  13. {nbdev-3.3.5 → nbdev-3.3.7}/MANIFEST.in +0 -0
  14. {nbdev-3.3.5 → nbdev-3.3.7}/README.md +0 -0
  15. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/clean.py +0 -0
  16. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/cli.py +0 -0
  17. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/config.py +0 -0
  18. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/diff.py +0 -0
  19. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/doclinks.py +0 -0
  20. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/export.py +0 -0
  21. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/extract_attachments.py +0 -0
  22. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/imports.py +0 -0
  23. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/maker.py +0 -0
  24. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/merge.py +0 -0
  25. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/moddocs.py +0 -0
  26. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/process.py +0 -0
  27. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/qmd.py +0 -0
  28. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/quarto.py +0 -0
  29. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/release.py +0 -0
  30. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/scrubmagics.py +0 -0
  31. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/serve.py +0 -0
  32. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/serve_drv.py +0 -0
  33. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/showdoc.py +0 -0
  34. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/skill.py +0 -0
  35. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev/sync.py +0 -0
  36. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev.egg-info/SOURCES.txt +0 -0
  37. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev.egg-info/dependency_links.txt +0 -0
  38. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev.egg-info/entry_points.txt +0 -0
  39. {nbdev-3.3.5 → nbdev-3.3.7}/nbdev.egg-info/top_level.txt +0 -0
  40. {nbdev-3.3.5 → nbdev-3.3.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.3.5
3
+ Version: 3.3.7
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
5
  Author-email: "Jeremy Howard and the fast.ai community" <j@fast.ai>
6
6
  License: Apache-2.0
@@ -16,8 +16,8 @@ Classifier: License :: OSI Approved :: Apache Software License
16
16
  Requires-Python: >=3.10
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: fastcore>=2.1.11
20
- Requires-Dist: execnb>=0.2.8
19
+ Requires-Dist: fastcore>=2.2.3
20
+ Requires-Dist: execnb>=0.2.11
21
21
  Requires-Dist: astunparse
22
22
  Requires-Dist: ghapi>=2.0.2
23
23
  Requires-Dist: watchdog
@@ -6,7 +6,7 @@ Modules:
6
6
  - `nbdev.moddocs`: # Module docs: creating them from existing notebooks
7
7
  - `nbdev.skill`: Author clear, executable nbdev notebooks where code, prose, examples, outputs, and tests form one coherent narrative."""
8
8
 
9
- __version__ = "3.3.5"
9
+ __version__ = "3.3.7"
10
10
 
11
11
  from .doclinks import nbdev_export
12
12
  from .showdoc import show_doc
@@ -141,10 +141,8 @@ d = { 'settings': { 'branch': 'main',
141
141
  'nbdev.frontmatter.FrontmatterProc.end': ( 'api/frontmatter.html#frontmatterproc.end',
142
142
  'nbdev/frontmatter.py'),
143
143
  'nbdev.frontmatter._dict2fm': ('api/frontmatter.html#_dict2fm', 'nbdev/frontmatter.py'),
144
- 'nbdev.frontmatter._fm2dict': ('api/frontmatter.html#_fm2dict', 'nbdev/frontmatter.py'),
145
- 'nbdev.frontmatter._insertfm': ('api/frontmatter.html#_insertfm', 'nbdev/frontmatter.py'),
146
- 'nbdev.frontmatter._md2dict': ('api/frontmatter.html#_md2dict', 'nbdev/frontmatter.py'),
147
- 'nbdev.frontmatter.nb_frontmatter': ('api/frontmatter.html#nb_frontmatter', 'nbdev/frontmatter.py')},
144
+ 'nbdev.frontmatter._fm2dict_md': ('api/frontmatter.html#_fm2dict_md', 'nbdev/frontmatter.py'),
145
+ 'nbdev.frontmatter._insertfm': ('api/frontmatter.html#_insertfm', 'nbdev/frontmatter.py')},
148
146
  'nbdev.imports': {},
149
147
  'nbdev.maker': { 'nbdev.maker.ModuleMaker': ('api/maker.html#modulemaker', 'nbdev/maker.py'),
150
148
  'nbdev.maker.ModuleMaker.__init__': ('api/maker.html#modulemaker.__init__', 'nbdev/maker.py'),
@@ -387,5 +385,6 @@ d = { 'settings': { 'branch': 'main',
387
385
  'nbdev.sync.absolute_import': ('api/sync.html#absolute_import', 'nbdev/sync.py'),
388
386
  'nbdev.sync.nbdev_update': ('api/sync.html#nbdev_update', 'nbdev/sync.py')},
389
387
  'nbdev.test': { 'nbdev.test._keep_file': ('api/test.html#_keep_file', 'nbdev/test.py'),
388
+ 'nbdev.test._test_nb_sync': ('api/test.html#_test_nb_sync', 'nbdev/test.py'),
390
389
  'nbdev.test.nbdev_test': ('api/test.html#nbdev_test', 'nbdev/test.py'),
391
390
  'nbdev.test.test_nb': ('api/test.html#test_nb', 'nbdev/test.py')}}}
@@ -5,7 +5,7 @@ Docs: https://nbdev.fast.ai/api/frontmatter.html.md"""
5
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/09_frontmatter.ipynb.
6
6
 
7
7
  # %% auto #0
8
- __all__ = ['nb_frontmatter', 'FrontmatterProc']
8
+ __all__ = ['FrontmatterProc']
9
9
 
10
10
  # %% ../nbs/api/09_frontmatter.ipynb #2398f5ef-06d3-4890-8a54-7cf4f81f3894
11
11
  from .imports import *
@@ -21,38 +21,15 @@ _RE_FM_BASE=r'''^---\s*
21
21
  (.*?\S+.*?)
22
22
  ---\s*'''
23
23
 
24
- _re_fm_nb = re.compile(_RE_FM_BASE+'$', flags=re.DOTALL)
25
24
  _re_fm_md = re.compile(_RE_FM_BASE, flags=re.DOTALL)
26
25
 
26
+
27
27
  # %% ../nbs/api/09_frontmatter.ipynb #1725f3b9
28
- def _fm2dict(s:str, nb=True):
29
- "Load YAML frontmatter into a `dict`"
30
- re_fm = _re_fm_nb if nb else _re_fm_md
31
- match = re_fm.search(s.strip())
28
+ def _fm2dict_md(s:str):
29
+ "Load YAML frontmatter opening a markdown file (body allowed) into a `dict`"
30
+ match = _re_fm_md.search(s.strip())
32
31
  return yaml.safe_load(match.group(1)) if match else {}
33
32
 
34
- def _md2dict(s:str):
35
- "Convert H1 formatted markdown cell to frontmatter dict"
36
- if '#' not in s: return {}
37
- m = re.search(r'^#\s+(\S.*?)\s*$', s, flags=re.MULTILINE)
38
- if not m: return {}
39
- res = {'title': m.group(1)}
40
- m = re.search(r'^>\s+(\S.*?)\s*$', s, flags=re.MULTILINE)
41
- if m: res['description'] = m.group(1)
42
- r = re.findall(r'^-\s+(\S.*:.*\S)\s*$', s, flags=re.MULTILINE)
43
- if r:
44
- try: res.update(yaml.safe_load('\n'.join(r)))
45
- except Exception as e: warn(f'Failed to create YAML dict for:\n{r}\n\n{e}\n')
46
- return res
47
-
48
- # %% ../nbs/api/09_frontmatter.ipynb #4ba11b21
49
- def nb_frontmatter(nb):
50
- "Get frontmatter dict from `nb` without modifying cells"
51
- raw = first(c for c in nb.cells if c.cell_type=='raw')
52
- md = first(c for c in nb.cells if c.cell_type=='markdown')
53
- res = _md2dict(md.source) if md else {}
54
- if raw: res.update(_fm2dict(raw.source))
55
- return res
56
33
 
57
34
  # %% ../nbs/api/09_frontmatter.ipynb #1b5d9d32
58
35
  def _dict2fm(d): return f'---\n{yaml.dump(d)}\n---\n\n'
@@ -71,8 +48,8 @@ class FrontmatterProc(Processor):
71
48
  cell.source = None
72
49
 
73
50
  def cell(self, cell):
74
- if cell.cell_type=='raw': self._update(_fm2dict, cell)
75
- elif cell.cell_type=='markdown' and 'title' not in self.fm: self._update(_md2dict, cell)
51
+ if cell.cell_type=='raw': self._update(cell_frontmatter, cell)
52
+ elif cell.cell_type=='markdown' and 'title' not in self.fm: self._update(md_frontmatter, cell)
76
53
 
77
54
  def end(self):
78
55
  self.nb.frontmatter_ = self.fm
@@ -11,7 +11,7 @@ __all__ = ['MigrateProc', 'fp_md_fm', 'migrate_nb', 'migrate_md', 'nbdev_migrate
11
11
  from .process import *
12
12
  from fastcore.nbio import first_code_ln, langs
13
13
  from .frontmatter import *
14
- from .frontmatter import _fm2dict, _re_fm_md, _dict2fm, _insertfm
14
+ from .frontmatter import _fm2dict_md, _re_fm_md, _dict2fm, _insertfm
15
15
  from .processors import *
16
16
  from .config import get_config, read_nb, set_version, pyproject_tmpl, nbdev_defaults
17
17
  from .sync import write_nb
@@ -98,7 +98,7 @@ def fp_md_fm(path):
98
98
  "Make fastpages front matter in markdown files quarto compliant."
99
99
  p = Path(path)
100
100
  md = p.read_text()
101
- fm = _fm2dict(md, nb=False)
101
+ fm = _fm2dict_md(md)
102
102
  if fm:
103
103
  fm = _fp_convert(fm, path)
104
104
  return _re_fm_md.sub(_dict2fm(fm), md)
@@ -12,13 +12,14 @@ __all__ = ['populate_language', 'insert_warning', 'cell_lang', 'add_show_docs',
12
12
  # %% ../nbs/api/10_processors.ipynb #2398f5ef-06d3-4890-8a54-7cf4f81f3894
13
13
  import ast
14
14
 
15
+ from fastcore.aio import run_sync
16
+
15
17
  from .config import *
16
18
  from .imports import *
17
19
  from .process import *
18
20
  from .showdoc import *
19
21
  from .doclinks import *
20
22
  from .frontmatter import *
21
- from .frontmatter import _fm2dict
22
23
 
23
24
  from fastcore.nbio import *
24
25
  from execnb.shell import *
@@ -256,7 +257,7 @@ class exec_show_docs(Processor):
256
257
  if not self.nb.has_docs_ or not hasattr(self, 'k'): return
257
258
  fm = getattr(self.nb, 'frontmatter_', {})
258
259
  if str2bool(fm.get('skip_showdoc', False)): return
259
- if _do_eval(cell): self.k.cell(cell)
260
+ if _do_eval(cell): run_sync(self.k.cell(cell))
260
261
  title = fm.get('title', '')
261
262
  if self.k.exc:
262
263
  raise Exception(f"Error{' in notebook: '+title if title else ''} in cell {cell.idx_} :\n{cell.source}") from self.k.exc
@@ -8,7 +8,7 @@ Docs: https://nbdev.fast.ai/api/test.html.md"""
8
8
  __all__ = ['test_nb', 'nbdev_test']
9
9
 
10
10
  # %% ../nbs/api/12_test.ipynb #45e10c3f
11
- import time,os,sys,traceback,contextlib,inspect,faulthandler,signal
11
+ import time,os,sys,traceback,contextlib,inspect,faulthandler,signal,asyncio
12
12
  from fastcore.basics import *
13
13
  from fastcore.imports import *
14
14
  from fastcore.foundation import *
@@ -25,7 +25,7 @@ from fastcore.nbio import *
25
25
  from execnb.shell import *
26
26
 
27
27
  # %% ../nbs/api/12_test.ipynb #3f4fa1ad
28
- def test_nb(
28
+ async def test_nb(
29
29
  fn, # file name of notebook to test
30
30
  skip_flags=None, # list of flags marking cells to skip
31
31
  force_flags=None, # list of flags marking cells to always run
@@ -61,7 +61,7 @@ def test_nb(
61
61
  if do_print: print(f'Starting {fn}')
62
62
  try:
63
63
  with working_directory(fn.parent):
64
- k.run_all(nb, exc_stop=True, preproc=_no_eval, verbose=verbose)
64
+ await k.run_all(nb, exc_stop=True, preproc=_no_eval, verbose=verbose)
65
65
  if save: write_nb(nb, fn)
66
66
  res = True
67
67
  except:
@@ -74,6 +74,9 @@ def test_nb(
74
74
  else: os.environ['IN_TEST'] = prev_test
75
75
 
76
76
 
77
+ # %% ../nbs/api/12_test.ipynb #12516e0a
78
+ def _test_nb_sync(fn, **kwargs): return asyncio.run(test_nb(fn, **kwargs))
79
+
77
80
  # %% ../nbs/api/12_test.ipynb #d8bf1f1b-935d-4b69-ba96-827c5d7213f0
78
81
  def _keep_file(
79
82
  p:Path, # filename for which to check for `indicator_fname`
@@ -112,7 +115,7 @@ def nbdev_test(
112
115
  else: kw = {'method':'spawn'} if sys.platform=='darwin' else {}
113
116
  wd_pth = cfg.nbs_path
114
117
  with working_directory(wd_pth if (wd_pth and wd_pth.exists()) else os.getcwd()):
115
- results = parallel(test_nb, files, skip_flags=skip_flags, force_flags=force_flags, n_workers=n_workers,
118
+ results = parallel(_test_nb_sync, files, skip_flags=skip_flags, force_flags=force_flags, n_workers=n_workers,
116
119
  basepath=cfg.config_path, pause=pause, do_print=do_print, verbose=verbose, save=save, **kw)
117
120
  passed,times = zip(*results)
118
121
  if all(passed): print("Success.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.3.5
3
+ Version: 3.3.7
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
5
  Author-email: "Jeremy Howard and the fast.ai community" <j@fast.ai>
6
6
  License: Apache-2.0
@@ -16,8 +16,8 @@ Classifier: License :: OSI Approved :: Apache Software License
16
16
  Requires-Python: >=3.10
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: fastcore>=2.1.11
20
- Requires-Dist: execnb>=0.2.8
19
+ Requires-Dist: fastcore>=2.2.3
20
+ Requires-Dist: execnb>=0.2.11
21
21
  Requires-Dist: astunparse
22
22
  Requires-Dist: ghapi>=2.0.2
23
23
  Requires-Dist: watchdog
@@ -1,5 +1,5 @@
1
- fastcore>=2.1.11
2
- execnb>=0.2.8
1
+ fastcore>=2.2.3
2
+ execnb>=0.2.11
3
3
  astunparse
4
4
  ghapi>=2.0.2
5
5
  watchdog
@@ -19,7 +19,7 @@ classifiers = [
19
19
  "License :: OSI Approved :: Apache Software License",
20
20
  ]
21
21
  dynamic = ["version"]
22
- dependencies = [ "fastcore>=2.1.11", "execnb>=0.2.8", "astunparse", "ghapi>=2.0.2", "watchdog", "asttokens",
22
+ dependencies = [ "fastcore>=2.2.3", "execnb>=0.2.11", "astunparse", "ghapi>=2.0.2", "watchdog", "asttokens",
23
23
  "setuptools", "build", "fastgit>=0.0.7", "pyyaml", "tomli; python_version < '3.11'", ]
24
24
 
25
25
  [project.optional-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes