nbdev 3.0.15__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.
- {nbdev-3.0.15/nbdev.egg-info → nbdev-3.0.17}/PKG-INFO +1 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/__init__.py +1 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/_modidx.py +2 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/clean.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/cli.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/config.py +20 -4
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/diff.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/doclinks.py +4 -5
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/export.py +4 -2
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/frontmatter.py +5 -3
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/maker.py +12 -7
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/merge.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/migrate.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/process.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/processors.py +6 -3
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/qmd.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/quarto.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/release.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/serve.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/showdoc.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/sync.py +3 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/test.py +5 -2
- {nbdev-3.0.15 → nbdev-3.0.17/nbdev.egg-info}/PKG-INFO +1 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/pyproject.toml +1 -1
- {nbdev-3.0.15 → nbdev-3.0.17}/CONTRIBUTING.md +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/LICENSE +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/MANIFEST.in +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/README.md +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/extract_attachments.py +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/imports.py +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/scrubmagics.py +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev/serve_drv.py +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev.egg-info/SOURCES.txt +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev.egg-info/dependency_links.txt +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev.egg-info/entry_points.txt +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev.egg-info/requires.txt +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/nbdev.egg-info/top_level.txt +0 -0
- {nbdev-3.0.15 → nbdev-3.0.17}/setup.cfg +0 -0
|
@@ -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,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', '
|
|
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
|
-
"""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 =
|
|
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
|
|
|
@@ -30,7 +32,7 @@ class ExportModuleProc:
|
|
|
30
32
|
def __call__(self, cell):
|
|
31
33
|
src = cell.source
|
|
32
34
|
if not src: return
|
|
33
|
-
if cell.cell_type=='markdown' and src.startswith('# '): self.
|
|
35
|
+
if cell.cell_type=='markdown' and (src.startswith('# ') or 'export' in cell.directives_): self._exporti_(cell)
|
|
34
36
|
_exports_=_export_
|
|
35
37
|
|
|
36
38
|
# %% ../nbs/api/04_export.ipynb #76717e36
|
|
@@ -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 .
|
|
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':
|
|
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
|
|
|
@@ -111,7 +113,7 @@ def make_code_cells(*ss): return dict2nb({'cells':L(ss).map(mk_cell)}).cells
|
|
|
111
113
|
# %% ../nbs/api/02_maker.ipynb #a2546836
|
|
112
114
|
def relative_import(name, fname, level=0):
|
|
113
115
|
"Convert a module `name` to a name relative to `fname`"
|
|
114
|
-
|
|
116
|
+
if level: raise ValueError(f"nbdev export does not support relative imports: module={name}, export_path={fname}")
|
|
115
117
|
sname = name.replace('.','/')
|
|
116
118
|
if not(os.path.commonpath([sname,fname])): return name
|
|
117
119
|
rel = os.path.relpath(sname, fname)
|
|
@@ -174,15 +176,18 @@ 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):
|
|
178
|
-
"Search for
|
|
179
|
+
def _retr_mdoc(cells, nb_path=None):
|
|
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 ''
|
|
181
183
|
lines = dropwhile(lambda l: not l.startswith('> '), md1.source.splitlines())
|
|
182
184
|
lines = list(takewhile(lambda l: l.startswith('> '), lines))
|
|
183
|
-
if not lines: return ''
|
|
184
185
|
summ = '\n'.join(l.lstrip('> ').strip() for l in lines)
|
|
185
|
-
|
|
186
|
+
docs = L(o.source.rstrip() for o in cells if o.cell_type=='markdown' and 'export' in getattr(o,'directives_',{}))
|
|
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()
|
|
190
|
+
return f'"""{mdoc}"""\n\n' if mdoc else ''
|
|
186
191
|
|
|
187
192
|
# %% ../nbs/api/02_maker.ipynb #cdd205d6
|
|
188
193
|
@patch
|
|
@@ -204,7 +209,7 @@ def make(self:ModuleMaker, cells, all_cells=None, lib_path=None):
|
|
|
204
209
|
tw = TextWrapper(width=120, initial_indent='', subsequent_indent=' '*11, break_long_words=False)
|
|
205
210
|
all_str = '\n'.join(tw.wrap(str(_all)))
|
|
206
211
|
with self.fname.open('w', encoding="utf-8") as f:
|
|
207
|
-
f.write(_retr_mdoc(cells))
|
|
212
|
+
f.write(_retr_mdoc(cells, self.nb_path))
|
|
208
213
|
f.write(f"# AUTOGENERATED! DO NOT EDIT! File to edit: {self.dest2nb}.")
|
|
209
214
|
if last_future > 0: write_cells(cells[:last_future], self.hdr, f)
|
|
210
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
|
-
"""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
|
|
|
@@ -198,8 +200,9 @@ def rm_header_dash(cell):
|
|
|
198
200
|
_hide_dirs = {'export','exporti', 'hide','default_exp'}
|
|
199
201
|
|
|
200
202
|
def rm_export(cell):
|
|
201
|
-
"Remove cells that are exported or hidden"
|
|
202
|
-
if cell.directives_ and (cell.directives_.keys() & _hide_dirs): del(cell['source'])
|
|
203
|
+
"Remove code cells that are exported or hidden"
|
|
204
|
+
if cell.cell_type=='code' and cell.directives_ and (cell.directives_.keys() & _hide_dirs): del(cell['source'])
|
|
205
|
+
|
|
203
206
|
|
|
204
207
|
# %% ../nbs/api/10_processors.ipynb #2d9a0a30
|
|
205
208
|
_re_showdoc = re.compile(r'^show_doc', re.MULTILINE)
|
|
@@ -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
|
-
"""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,
|
|
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))
|
|
@@ -76,7 +76,7 @@ version = {attr = "nbdev.__version__"}
|
|
|
76
76
|
include = ["nbdev"]
|
|
77
77
|
|
|
78
78
|
[tool.nbdev]
|
|
79
|
-
allowed_metadata_keys = ['
|
|
79
|
+
allowed_metadata_keys = ['solveit']
|
|
80
80
|
custom_sidebar = true
|
|
81
81
|
readme_nb = "getting_started.ipynb"
|
|
82
82
|
jupyter_hooks = true
|
|
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
|