nbdev 3.0.16__tar.gz → 3.0.17__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 (38) hide show
  1. {nbdev-3.0.16/nbdev.egg-info → nbdev-3.0.17}/PKG-INFO +1 -1
  2. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/__init__.py +1 -1
  3. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/_modidx.py +2 -1
  4. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/clean.py +3 -1
  5. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/cli.py +3 -1
  6. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/config.py +20 -4
  7. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/diff.py +3 -1
  8. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/doclinks.py +4 -5
  9. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/export.py +3 -1
  10. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/frontmatter.py +5 -3
  11. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/maker.py +7 -3
  12. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/merge.py +3 -1
  13. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/migrate.py +3 -1
  14. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/process.py +3 -1
  15. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/processors.py +3 -1
  16. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/qmd.py +3 -1
  17. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/quarto.py +3 -1
  18. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/release.py +3 -1
  19. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/serve.py +3 -1
  20. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/showdoc.py +3 -1
  21. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/sync.py +3 -1
  22. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/test.py +5 -2
  23. {nbdev-3.0.16 → nbdev-3.0.17/nbdev.egg-info}/PKG-INFO +1 -1
  24. {nbdev-3.0.16 → nbdev-3.0.17}/CONTRIBUTING.md +0 -0
  25. {nbdev-3.0.16 → nbdev-3.0.17}/LICENSE +0 -0
  26. {nbdev-3.0.16 → nbdev-3.0.17}/MANIFEST.in +0 -0
  27. {nbdev-3.0.16 → nbdev-3.0.17}/README.md +0 -0
  28. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/extract_attachments.py +0 -0
  29. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/imports.py +0 -0
  30. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/scrubmagics.py +0 -0
  31. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev/serve_drv.py +0 -0
  32. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev.egg-info/SOURCES.txt +0 -0
  33. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev.egg-info/dependency_links.txt +0 -0
  34. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev.egg-info/entry_points.txt +0 -0
  35. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev.egg-info/requires.txt +0 -0
  36. {nbdev-3.0.16 → nbdev-3.0.17}/nbdev.egg-info/top_level.txt +0 -0
  37. {nbdev-3.0.16 → nbdev-3.0.17}/pyproject.toml +0 -0
  38. {nbdev-3.0.16 → nbdev-3.0.17}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.0.16
3
+ Version: 3.0.17
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
@@ -1,4 +1,4 @@
1
- __version__ = "3.0.16"
1
+ __version__ = "3.0.17"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
@@ -52,6 +52,8 @@ d = { 'settings': { 'branch': 'main',
52
52
  'nbdev.config.import_obj': ('api/config.html#import_obj', 'nbdev/config.py'),
53
53
  'nbdev.config.is_nbdev': ('api/config.html#is_nbdev', 'nbdev/config.py'),
54
54
  'nbdev.config.nbdev_create_config': ('api/config.html#nbdev_create_config', 'nbdev/config.py'),
55
+ 'nbdev.config.nbpath2docurl': ('api/config.html#nbpath2docurl', 'nbdev/config.py'),
56
+ 'nbdev.config.nbpath2html': ('api/config.html#nbpath2html', 'nbdev/config.py'),
55
57
  'nbdev.config.read_version': ('api/config.html#read_version', 'nbdev/config.py'),
56
58
  'nbdev.config.set_version': ('api/config.html#set_version', 'nbdev/config.py'),
57
59
  'nbdev.config.show_src': ('api/config.html#show_src', 'nbdev/config.py'),
@@ -82,7 +84,6 @@ d = { 'settings': { 'branch': 'main',
82
84
  'nbdev.doclinks._get_modidx': ('api/doclinks.html#_get_modidx', 'nbdev/doclinks.py'),
83
85
  'nbdev.doclinks._iter_py_cells': ('api/doclinks.html#_iter_py_cells', 'nbdev/doclinks.py'),
84
86
  'nbdev.doclinks._lineno': ('api/doclinks.html#_lineno', 'nbdev/doclinks.py'),
85
- 'nbdev.doclinks._nbpath2html': ('api/doclinks.html#_nbpath2html', 'nbdev/doclinks.py'),
86
87
  'nbdev.doclinks._qual_mod': ('api/doclinks.html#_qual_mod', 'nbdev/doclinks.py'),
87
88
  'nbdev.doclinks._qual_sym': ('api/doclinks.html#_qual_sym', 'nbdev/doclinks.py'),
88
89
  'nbdev.doclinks._qual_syms': ('api/doclinks.html#_qual_syms', 'nbdev/doclinks.py'),
@@ -1,4 +1,6 @@
1
- """Strip superfluous metadata from notebooks"""
1
+ """Strip superfluous metadata from notebooks
2
+
3
+ Docs: https://nbdev.fast.ai/api/clean.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/11_clean.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """CLI commands"""
1
+ """CLI commands
2
+
3
+ Docs: https://nbdev.fast.ai/api/cli.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/13_cli.ipynb.
4
6
 
@@ -1,11 +1,13 @@
1
- """Configuring nbdev and bootstrapping notebook export"""
1
+ """Configuring nbdev and bootstrapping notebook export
2
+
3
+ Docs: https://nbdev.fast.ai/api/config.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/01_config.ipynb.
4
6
 
5
7
  # %% auto #0
6
8
  __all__ = ['pyproject_nm', 'pyproject_tmpl', 'nbdev_defaults', 'pyproj_tmpl', 'nbdev_create_config', 'ConfigToml', 'get_config',
7
- 'is_nbdev', 'create_output', 'show_src', 'read_version', 'set_version', 'bump_version', 'update_version',
8
- 'update_proj', 'add_init', 'import_obj', 'write_cells']
9
+ 'is_nbdev', 'create_output', 'show_src', 'nbpath2html', 'nbpath2docurl', 'read_version', 'set_version',
10
+ 'bump_version', 'update_version', 'update_proj', 'add_init', 'import_obj', 'write_cells']
9
11
 
10
12
  # %% ../nbs/api/01_config.ipynb #6fd14ecd
11
13
  from datetime import datetime
@@ -16,7 +18,7 @@ from fastcore.script import *
16
18
  from fastcore.style import *
17
19
  from fastcore.xdg import *
18
20
 
19
- import ast,importlib,warnings
21
+ import ast,importlib,re,warnings
20
22
  from IPython.display import Markdown
21
23
  from fastcore.nbio import read_nb,NbCell
22
24
  from urllib.error import HTTPError
@@ -254,6 +256,20 @@ def create_output(txt, mime):
254
256
  # %% ../nbs/api/01_config.ipynb #5a4d8e52
255
257
  def show_src(src, lang='python'): return Markdown(f'```{lang}\n{src}\n```')
256
258
 
259
+ # %% ../nbs/api/01_config.ipynb #14a9c607
260
+ def nbpath2html(p):
261
+ "Convert notebook path `p` to its html doc path (strips numeric prefix)"
262
+ p = Path(p)
263
+ return p.with_name(re.sub(r'^\d+[a-zA-Z0-9]*_', '', p.name.lower())).with_suffix('.html')
264
+
265
+ # %% ../nbs/api/01_config.ipynb #c830bb2b
266
+ def nbpath2docurl(nb_path):
267
+ "Hosted docs URL (with `.md` suffix) for notebook `nb_path`, or '' if no `doc_host`"
268
+ cfg = get_config()
269
+ if not cfg.doc_host: return ''
270
+ p = Path(nb_path).resolve().relative_to(cfg.path('nbs_path'))
271
+ return f"{cfg.doc_host.rstrip('/')}{cfg.doc_baseurl}{nbpath2html(p).as_posix()}.md"
272
+
257
273
  # %% ../nbs/api/01_config.ipynb #163177f2
258
274
  pyproj_tmpl = """[build-system]
259
275
  requires = ["setuptools>=64.0"]
@@ -1,4 +1,6 @@
1
- """Get ipynb diffs by cell"""
1
+ """Get ipynb diffs by cell
2
+
3
+ Docs: https://nbdev.fast.ai/api/diff.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/19_diff.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Generating a documentation index from a module"""
1
+ """Generating a documentation index from a module
2
+
3
+ Docs: https://nbdev.fast.ai/api/doclinks.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/05_doclinks.ipynb.
4
6
 
@@ -70,9 +72,6 @@ def _iter_py_cells(p):
70
72
  if code.endswith('\n'): code=code[:-1]
71
73
  yield AttrDict(nb=nb, cell_id=cell_id, code=code, nb_path=nb_path, py_path=p.resolve())
72
74
 
73
- # %% ../nbs/api/05_doclinks.ipynb #d1c22276
74
- def _nbpath2html(p): return p.with_name(re.sub(r'^\d+[a-zA-Z0-9]*_', '', p.name.lower())).with_suffix('.html')
75
-
76
75
  # %% ../nbs/api/05_doclinks.ipynb #f57b8709
77
76
  def _get_modidx(py_path, code_root, nbs_path):
78
77
  "Get module symbol index for a Python source file"
@@ -84,7 +83,7 @@ def _get_modidx(py_path, code_root, nbs_path):
84
83
  d = {}
85
84
  for cell in _iter_py_cells(py_path):
86
85
  if 'auto' in cell.nb: continue
87
- loc = _nbpath2html(cell.nb_path.relative_to(nbs_path))
86
+ loc = nbpath2html(cell.nb_path.relative_to(nbs_path))
88
87
 
89
88
  def _stor(nm):
90
89
  for n in L(nm): d[f'{mod_name}.{n}'] = f'{loc.as_posix()}#{n.lower()}',rel_name
@@ -1,4 +1,6 @@
1
- """Exporting a notebook to a library"""
1
+ """Exporting a notebook to a library
2
+
3
+ Docs: https://nbdev.fast.ai/api/export.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/04_export.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """A YAML and formatted-markdown frontmatter processor"""
1
+ """A YAML and formatted-markdown frontmatter processor
2
+
3
+ Docs: https://nbdev.fast.ai/api/frontmatter.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/09_frontmatter.ipynb.
4
6
 
@@ -8,7 +10,7 @@ __all__ = ['nb_frontmatter', 'FrontmatterProc']
8
10
  # %% ../nbs/api/09_frontmatter.ipynb #2398f5ef-06d3-4890-8a54-7cf4f81f3894
9
11
  from .imports import *
10
12
  from .process import *
11
- from .doclinks import _nbpath2html
13
+ from .config import nbpath2html
12
14
 
13
15
  from fastcore.nbio import *
14
16
  from fastcore.imports import *
@@ -80,5 +82,5 @@ class FrontmatterProc(Processor):
80
82
  'from your _quarto.yml file (e.g. `ipynb-filter: [nbdev_filter]`), since they are no '
81
83
  'longer supported as of nbdev v2.3. See the v2.3 launch post for more information: '
82
84
  'https://forums.fast.ai/t/upcoming-changes-in-v2-3-edit-now-released/98905.')
83
- self.fm.update({'output-file': _nbpath2html(Path(self.nb.path_)).name})
85
+ self.fm.update({'output-file': nbpath2html(Path(self.nb.path_)).name})
84
86
  _insertfm(self.nb, self.fm)
@@ -1,4 +1,6 @@
1
- """Create one or more modules from selected notebook cells"""
1
+ """Create one or more modules from selected notebook cells
2
+
3
+ Docs: https://nbdev.fast.ai/api/maker.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/02_maker.ipynb.
4
6
 
@@ -174,7 +176,7 @@ def _import2relative(cells, lib_path=None):
174
176
  for cell in cells: cell.import2relative(lib_path)
175
177
 
176
178
  # %% ../nbs/api/02_maker.ipynb #5bff9d71
177
- def _retr_mdoc(cells):
179
+ def _retr_mdoc(cells, nb_path=None):
178
180
  "Search for markdown cells used to create module docstring"
179
181
  md1 = first(o for o in cells if o.cell_type=='markdown' and o.source.startswith('# '))
180
182
  if not md1: return ''
@@ -183,6 +185,8 @@ def _retr_mdoc(cells):
183
185
  summ = '\n'.join(l.lstrip('> ').strip() for l in lines)
184
186
  docs = L(o.source.rstrip() for o in cells if o.cell_type=='markdown' and 'export' in getattr(o,'directives_',{}))
185
187
  mdoc = '\n\n'.join(L(summ)+docs).strip()
188
+ url = nbpath2docurl(nb_path) if nb_path else ''
189
+ if url: mdoc = (mdoc + f'\n\nDocs: {url}').strip()
186
190
  return f'"""{mdoc}"""\n\n' if mdoc else ''
187
191
 
188
192
  # %% ../nbs/api/02_maker.ipynb #cdd205d6
@@ -205,7 +209,7 @@ def make(self:ModuleMaker, cells, all_cells=None, lib_path=None):
205
209
  tw = TextWrapper(width=120, initial_indent='', subsequent_indent=' '*11, break_long_words=False)
206
210
  all_str = '\n'.join(tw.wrap(str(_all)))
207
211
  with self.fname.open('w', encoding="utf-8") as f:
208
- f.write(_retr_mdoc(cells))
212
+ f.write(_retr_mdoc(cells, self.nb_path))
209
213
  f.write(f"# AUTOGENERATED! DO NOT EDIT! File to edit: {self.dest2nb}.")
210
214
  if last_future > 0: write_cells(cells[:last_future], self.hdr, f)
211
215
  if self.parse and not self.solo_nb: f.write(f"\n\n# %% auto #0\n__all__ = {all_str}")
@@ -1,4 +1,6 @@
1
- """Fix merge conflicts in jupyter notebooks"""
1
+ """Fix merge conflicts in jupyter notebooks
2
+
3
+ Docs: https://nbdev.fast.ai/api/merge.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/07_merge.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Utilities for migrating to nbdev"""
1
+ """Utilities for migrating to nbdev
2
+
3
+ Docs: https://nbdev.fast.ai/api/migrate.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/16_migrate.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """A notebook processor"""
1
+ """A notebook processor
2
+
3
+ Docs: https://nbdev.fast.ai/api/process.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/03_process.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Some processors for NBProcessor"""
1
+ """Some processors for NBProcessor
2
+
3
+ Docs: https://nbdev.fast.ai/api/processors.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/10_processors.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Basic qmd generation helpers (experimental)"""
1
+ """Basic qmd generation helpers (experimental)
2
+
3
+ Docs: https://nbdev.fast.ai/api/qmd.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/15_qmd.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Install and interact with Quarto from nbdev"""
1
+ """Install and interact with Quarto from nbdev
2
+
3
+ Docs: https://nbdev.fast.ai/api/quarto.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/14_quarto.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Auto-generated tagged releases and release notes from GitHub issues"""
1
+ """Auto-generated tagged releases and release notes from GitHub issues
2
+
3
+ Docs: https://nbdev.fast.ai/api/release.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/18_release.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """A parallel ipynb processor (experimental)"""
1
+ """A parallel ipynb processor (experimental)
2
+
3
+ Docs: https://nbdev.fast.ai/api/serve.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/17_serve.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Display symbol documentation in notebook and website"""
1
+ """Display symbol documentation in notebook and website
2
+
3
+ Docs: https://nbdev.fast.ai/api/showdoc.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/08_showdoc.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Propagate small changes in the library back to notebooks"""
1
+ """Propagate small changes in the library back to notebooks
2
+
3
+ Docs: https://nbdev.fast.ai/api/sync.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/06_sync.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Run unit tests on notebooks in parallel"""
1
+ """Run unit tests on notebooks in parallel
2
+
3
+ Docs: https://nbdev.fast.ai/api/test.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/12_test.ipynb.
4
6
 
@@ -6,7 +8,7 @@
6
8
  __all__ = ['test_nb', 'nbdev_test']
7
9
 
8
10
  # %% ../nbs/api/12_test.ipynb #45e10c3f
9
- import time,os,sys,traceback,contextlib, inspect
11
+ import time,os,sys,traceback,contextlib,inspect,faulthandler,signal
10
12
  from fastcore.basics import *
11
13
  from fastcore.imports import *
12
14
  from fastcore.foundation import *
@@ -32,6 +34,7 @@ def test_nb(fn, # file name of notebook to test
32
34
  verbose=False, # stream stdout/stderr from cells to console?
33
35
  save=False): # write outputs back to notebook on success?
34
36
  "Execute tests in notebook in `fn` except those with `skip_flags`"
37
+ faulthandler.register(signal.SIGINT, file=sys.__stderr__, all_threads=True, chain=True)
35
38
  if basepath: sys.path.insert(0, str(basepath))
36
39
  if not IN_NOTEBOOK: os.environ["IN_TEST"] = '1'
37
40
  flags=set(L(skip_flags)) - set(L(force_flags))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.0.16
3
+ Version: 3.0.17
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
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