nbdev 2.3.31__py3-none-any.whl → 2.3.33__py3-none-any.whl
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/__init__.py +1 -1
- nbdev/_modidx.py +5 -1
- nbdev/cli.py +34 -2
- nbdev/config.py +2 -4
- nbdev/doclinks.py +39 -24
- nbdev/export.py +10 -3
- nbdev/migrate.py +1 -1
- nbdev/processors.py +1 -1
- nbdev/quarto.py +2 -2
- nbdev/release.py +1 -1
- nbdev/showdoc.py +28 -5
- nbdev/sync.py +5 -2
- {nbdev-2.3.31.dist-info → nbdev-2.3.33.dist-info}/METADATA +5 -2
- nbdev-2.3.33.dist-info/RECORD +29 -0
- {nbdev-2.3.31.dist-info → nbdev-2.3.33.dist-info}/entry_points.txt +2 -0
- nbdev-2.3.31.dist-info/RECORD +0 -29
- {nbdev-2.3.31.dist-info → nbdev-2.3.33.dist-info}/LICENSE +0 -0
- {nbdev-2.3.31.dist-info → nbdev-2.3.33.dist-info}/WHEEL +0 -0
- {nbdev-2.3.31.dist-info → nbdev-2.3.33.dist-info}/top_level.txt +0 -0
nbdev/__init__.py
CHANGED
nbdev/_modidx.py
CHANGED
|
@@ -23,9 +23,11 @@ d = { 'settings': { 'branch': 'master',
|
|
|
23
23
|
'nbdev.cli._update_repo_meta': ('api/cli.html#_update_repo_meta', 'nbdev/cli.py'),
|
|
24
24
|
'nbdev.cli.chelp': ('api/cli.html#chelp', 'nbdev/cli.py'),
|
|
25
25
|
'nbdev.cli.extract_tgz': ('api/cli.html#extract_tgz', 'nbdev/cli.py'),
|
|
26
|
+
'nbdev.cli.nb_export_cli': ('api/cli.html#nb_export_cli', 'nbdev/cli.py'),
|
|
26
27
|
'nbdev.cli.nbdev_filter': ('api/cli.html#nbdev_filter', 'nbdev/cli.py'),
|
|
27
28
|
'nbdev.cli.nbdev_new': ('api/cli.html#nbdev_new', 'nbdev/cli.py'),
|
|
28
|
-
'nbdev.cli.nbdev_update_license': ('api/cli.html#nbdev_update_license', 'nbdev/cli.py')
|
|
29
|
+
'nbdev.cli.nbdev_update_license': ('api/cli.html#nbdev_update_license', 'nbdev/cli.py'),
|
|
30
|
+
'nbdev.cli.watch_export': ('api/cli.html#watch_export', 'nbdev/cli.py')},
|
|
29
31
|
'nbdev.config': { 'nbdev.config._apply_defaults': ('api/config.html#_apply_defaults', 'nbdev/config.py'),
|
|
30
32
|
'nbdev.config._basic_export_nb': ('api/config.html#_basic_export_nb', 'nbdev/config.py'),
|
|
31
33
|
'nbdev.config._cfg2txt': ('api/config.html#_cfg2txt', 'nbdev/config.py'),
|
|
@@ -56,6 +58,7 @@ d = { 'settings': { 'branch': 'master',
|
|
|
56
58
|
'nbdev.doclinks.NbdevLookup.link_line': ('api/doclinks.html#nbdevlookup.link_line', 'nbdev/doclinks.py'),
|
|
57
59
|
'nbdev.doclinks.NbdevLookup.linkify': ('api/doclinks.html#nbdevlookup.linkify', 'nbdev/doclinks.py'),
|
|
58
60
|
'nbdev.doclinks._binop_leafs': ('api/doclinks.html#_binop_leafs', 'nbdev/doclinks.py'),
|
|
61
|
+
'nbdev.doclinks._build_lookup_table': ('api/doclinks.html#_build_lookup_table', 'nbdev/doclinks.py'),
|
|
59
62
|
'nbdev.doclinks._build_modidx': ('api/doclinks.html#_build_modidx', 'nbdev/doclinks.py'),
|
|
60
63
|
'nbdev.doclinks._find_mod': ('api/doclinks.html#_find_mod', 'nbdev/doclinks.py'),
|
|
61
64
|
'nbdev.doclinks._get_exps': ('api/doclinks.html#_get_exps', 'nbdev/doclinks.py'),
|
|
@@ -332,6 +335,7 @@ d = { 'settings': { 'branch': 'master',
|
|
|
332
335
|
'nbdev.showdoc.ShowDocRenderer': ('api/showdoc.html#showdocrenderer', 'nbdev/showdoc.py'),
|
|
333
336
|
'nbdev.showdoc.ShowDocRenderer.__init__': ('api/showdoc.html#showdocrenderer.__init__', 'nbdev/showdoc.py'),
|
|
334
337
|
'nbdev.showdoc._bold': ('api/showdoc.html#_bold', 'nbdev/showdoc.py'),
|
|
338
|
+
'nbdev.showdoc._create_html_table': ('api/showdoc.html#_create_html_table', 'nbdev/showdoc.py'),
|
|
335
339
|
'nbdev.showdoc._docstring': ('api/showdoc.html#_docstring', 'nbdev/showdoc.py'),
|
|
336
340
|
'nbdev.showdoc._escape_markdown': ('api/showdoc.html#_escape_markdown', 'nbdev/showdoc.py'),
|
|
337
341
|
'nbdev.showdoc._ext_link': ('api/showdoc.html#_ext_link', 'nbdev/showdoc.py'),
|
nbdev/cli.py
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# %% ../nbs/api/13_cli.ipynb 2
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
import warnings
|
|
8
|
+
import time
|
|
8
9
|
|
|
9
10
|
from .config import *
|
|
10
11
|
from .process import *
|
|
@@ -12,9 +13,11 @@ from .processors import *
|
|
|
12
13
|
from .doclinks import *
|
|
13
14
|
from .test import *
|
|
14
15
|
from .clean import *
|
|
15
|
-
from .quarto import nbdev_readme, refresh_quarto_yml
|
|
16
|
+
from .quarto import nbdev_readme, refresh_quarto_yml, fs_watchdog
|
|
17
|
+
from .export import nb_export
|
|
16
18
|
from .frontmatter import FrontmatterProc
|
|
17
19
|
|
|
20
|
+
from fastcore.xtras import run
|
|
18
21
|
from execnb.nbio import *
|
|
19
22
|
from fastcore.meta import *
|
|
20
23
|
from fastcore.utils import *
|
|
@@ -27,7 +30,8 @@ from contextlib import redirect_stdout
|
|
|
27
30
|
import os, tarfile, sys
|
|
28
31
|
|
|
29
32
|
# %% auto 0
|
|
30
|
-
__all__ = ['mapping', 'nbdev_filter', 'extract_tgz', 'nbdev_new', 'nbdev_update_license', '
|
|
33
|
+
__all__ = ['mapping', 'nbdev_filter', 'extract_tgz', 'nbdev_new', 'nbdev_update_license', 'nb_export_cli', 'watch_export',
|
|
34
|
+
'chelp']
|
|
31
35
|
|
|
32
36
|
# %% ../nbs/api/13_cli.ipynb
|
|
33
37
|
@call_parse
|
|
@@ -158,6 +162,34 @@ def nbdev_update_license(
|
|
|
158
162
|
lic.write(body)
|
|
159
163
|
print(f"License updated from {curr_lic} to {to}")
|
|
160
164
|
|
|
165
|
+
# %% ../nbs/api/13_cli.ipynb
|
|
166
|
+
@call_parse
|
|
167
|
+
@delegates(nb_export, but=['procs', 'mod_maker'])
|
|
168
|
+
def nb_export_cli(nbname,
|
|
169
|
+
debug:store_true=False, # Debug flag
|
|
170
|
+
**kwargs):
|
|
171
|
+
"Export a single nbdev notebook to a python script."
|
|
172
|
+
return nb_export(nbname=nbname, debug=debug, **kwargs)
|
|
173
|
+
|
|
174
|
+
# %% ../nbs/api/13_cli.ipynb
|
|
175
|
+
@call_parse
|
|
176
|
+
def watch_export(nbs:str=None, # Nb directory to watch for changes
|
|
177
|
+
lib:str=None, # Export directory to write py files to
|
|
178
|
+
force:bool=False # Ignore nbdev config if in nbdev project
|
|
179
|
+
):
|
|
180
|
+
'''Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available'''
|
|
181
|
+
cfg = get_config() if is_nbdev() else None
|
|
182
|
+
nbs = nbs or (cfg.nbs_path if cfg else '.')
|
|
183
|
+
lib = lib or (cfg.lib_path if cfg else '.')
|
|
184
|
+
if cfg and (nbs != cfg.nbs_path or lib != cfg.lib_path) and not force:
|
|
185
|
+
raise ValueError("In nbdev project. Use --force to override config.")
|
|
186
|
+
def _export(e,lib=lib):
|
|
187
|
+
p = e.src_path
|
|
188
|
+
if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith('.~')):
|
|
189
|
+
if e.event_type == 'modified': run(f'nb_export --lib_path {lib} "{p}"')
|
|
190
|
+
with fs_watchdog(_export, nbs):
|
|
191
|
+
while True: time.sleep(1)
|
|
192
|
+
|
|
161
193
|
# %% ../nbs/api/13_cli.ipynb
|
|
162
194
|
@call_parse
|
|
163
195
|
def chelp():
|
nbdev/config.py
CHANGED
|
@@ -181,10 +181,8 @@ def nbdev_create_config(
|
|
|
181
181
|
|
|
182
182
|
# %% ../nbs/api/01_config.ipynb
|
|
183
183
|
def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):
|
|
184
|
-
cfg_path =
|
|
185
|
-
|
|
186
|
-
if not (cfg_path/cfg_name).exists(): cfg_path = path
|
|
187
|
-
return cfg_path/cfg_name
|
|
184
|
+
cfg_path = Path.cwd() if path is None else Path(path)
|
|
185
|
+
return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name)
|
|
188
186
|
|
|
189
187
|
# %% ../nbs/api/01_config.ipynb
|
|
190
188
|
def _xdg_config_paths(cfg_name=_nbdev_cfg_name):
|
nbdev/doclinks.py
CHANGED
|
@@ -22,6 +22,7 @@ from astunparse import unparse
|
|
|
22
22
|
from pprint import pformat
|
|
23
23
|
from urllib.parse import urljoin
|
|
24
24
|
from functools import lru_cache
|
|
25
|
+
from types import ModuleType
|
|
25
26
|
|
|
26
27
|
# %% ../nbs/api/05_doclinks.ipynb
|
|
27
28
|
def _sym_nm(klas, sym): return f'{unparse(klas).strip()}.{sym.name}'
|
|
@@ -166,6 +167,7 @@ def _find_mod(mod):
|
|
|
166
167
|
|
|
167
168
|
@lru_cache(None)
|
|
168
169
|
def _get_exps(mod):
|
|
170
|
+
"Get the line numbers for function and class definitions in module"
|
|
169
171
|
mf = _find_mod(mod)
|
|
170
172
|
if not mf: return {}
|
|
171
173
|
txt = mf.read_text(encoding='utf-8')
|
|
@@ -181,6 +183,7 @@ def _lineno(sym, fname): return _get_exps(fname).get(sym, None) if fname else No
|
|
|
181
183
|
|
|
182
184
|
# %% ../nbs/api/05_doclinks.ipynb
|
|
183
185
|
def _qual_sym(s, settings):
|
|
186
|
+
"Get qualified nb, py, and github paths for a symbol s"
|
|
184
187
|
if not isinstance(s,tuple): return s
|
|
185
188
|
nb,py = s
|
|
186
189
|
nbbase = urljoin(settings["doc_host"]+'/',settings["doc_baseurl"])
|
|
@@ -195,34 +198,45 @@ def _qual_syms(entries):
|
|
|
195
198
|
return {'syms': {mod:_qual_mod(d, settings) for mod,d in entries['syms'].items()}, 'settings':settings}
|
|
196
199
|
|
|
197
200
|
# %% ../nbs/api/05_doclinks.ipynb
|
|
198
|
-
_re_backticks = re.compile(r'`([^`\s]
|
|
201
|
+
_re_backticks = re.compile(r'`([^`\s]+?)(?:\(\))?`')
|
|
199
202
|
|
|
200
203
|
# %% ../nbs/api/05_doclinks.ipynb
|
|
201
204
|
@lru_cache(None)
|
|
205
|
+
def _build_lookup_table(strip_libs=None, incl_libs=None, skip_mods=None):
|
|
206
|
+
cfg = get_config()
|
|
207
|
+
if strip_libs is None:
|
|
208
|
+
try: strip_libs = cfg.get('strip_libs', cfg.get('lib_path', 'nbdev').name).split()
|
|
209
|
+
except FileNotFoundError: strip_libs = 'nbdev'
|
|
210
|
+
skip_mods = setify(skip_mods)
|
|
211
|
+
strip_libs = L(strip_libs)
|
|
212
|
+
if incl_libs is not None: incl_libs = (L(incl_libs)+strip_libs).unique()
|
|
213
|
+
entries = {}
|
|
214
|
+
for o in pkg_resources.iter_entry_points(group='nbdev'):
|
|
215
|
+
if incl_libs is not None and o.dist.key not in incl_libs: continue
|
|
216
|
+
try: entries[o.name] = _qual_syms(o.resolve())
|
|
217
|
+
except Exception: pass
|
|
218
|
+
py_syms = merge(*L(o['syms'].values() for o in entries.values()).concat())
|
|
219
|
+
for m in strip_libs:
|
|
220
|
+
if m in entries:
|
|
221
|
+
_d = entries[m]
|
|
222
|
+
stripped = {remove_prefix(k,f"{mod}."):v
|
|
223
|
+
for mod,dets in _d['syms'].items() if mod not in skip_mods
|
|
224
|
+
for k,v in dets.items()}
|
|
225
|
+
py_syms = merge(stripped, py_syms)
|
|
226
|
+
return entries,py_syms
|
|
227
|
+
|
|
228
|
+
# %% ../nbs/api/05_doclinks.ipynb
|
|
202
229
|
class NbdevLookup:
|
|
203
230
|
"Mapping from symbol names to docs and source URLs"
|
|
204
|
-
def __init__(self, strip_libs=None, incl_libs=None, skip_mods=None):
|
|
205
|
-
|
|
206
|
-
if
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
self.entries = {o.name: _qual_syms(o.resolve()) for o in list(pkg_resources.iter_entry_points(group='nbdev'))
|
|
214
|
-
if incl_libs is None or o.dist.key in incl_libs}
|
|
215
|
-
py_syms = merge(*L(o['syms'].values() for o in self.entries.values()).concat())
|
|
216
|
-
for m in strip_libs:
|
|
217
|
-
if m in self.entries:
|
|
218
|
-
_d = self.entries[m]
|
|
219
|
-
stripped = {remove_prefix(k,f"{mod}."):v
|
|
220
|
-
for mod,dets in _d['syms'].items() if mod not in skip_mods
|
|
221
|
-
for k,v in dets.items()}
|
|
222
|
-
py_syms = merge(stripped, py_syms)
|
|
223
|
-
self.syms = py_syms
|
|
224
|
-
|
|
225
|
-
def __getitem__(self, s): return self.syms.get(s, None)
|
|
231
|
+
def __init__(self, strip_libs=None, incl_libs=None, skip_mods=None, ns=None):
|
|
232
|
+
self.entries,self.syms = _build_lookup_table(strip_libs, incl_libs, skip_mods)
|
|
233
|
+
self.aliases = {n:o.__name__ for n,o in (ns or {}).items() if isinstance(o, ModuleType)}
|
|
234
|
+
|
|
235
|
+
def __getitem__(self, s):
|
|
236
|
+
if '.' in s:
|
|
237
|
+
pre,post = s.split('.', 1)
|
|
238
|
+
if pre in self.aliases: s = f"{self.aliases[pre]}.{post}"
|
|
239
|
+
return self.syms.get(s, None)
|
|
226
240
|
|
|
227
241
|
def doc(self, sym):
|
|
228
242
|
"Link to docs for `sym`"
|
|
@@ -236,12 +250,13 @@ class NbdevLookup:
|
|
|
236
250
|
_,py,gh = res
|
|
237
251
|
line = _lineno(sym, py)
|
|
238
252
|
return f'{gh}#L{line}'
|
|
239
|
-
|
|
253
|
+
|
|
240
254
|
def _link_sym(self, m):
|
|
241
255
|
l = m.group(1)
|
|
242
256
|
s = self.doc(l)
|
|
243
257
|
if s is None: return m.group(0)
|
|
244
258
|
l = l.replace('\\', r'\\')
|
|
259
|
+
if m.group(0).endswith('()`'): l += '()'
|
|
245
260
|
return rf"[`{l}`]({s})"
|
|
246
261
|
|
|
247
262
|
def link_line(self, l): return _re_backticks.sub(self._link_sym, l)
|
nbdev/export.py
CHANGED
|
@@ -14,6 +14,7 @@ from .process import *
|
|
|
14
14
|
from fastcore.script import *
|
|
15
15
|
from fastcore.basics import *
|
|
16
16
|
from fastcore.imports import *
|
|
17
|
+
from fastcore.meta import *
|
|
17
18
|
|
|
18
19
|
from collections import defaultdict
|
|
19
20
|
|
|
@@ -63,12 +64,18 @@ import nbdev.export
|
|
|
63
64
|
def optional_procs():
|
|
64
65
|
"An explicit list of processors that could be used by `nb_export`"
|
|
65
66
|
return L([p for p in nbdev.export.__all__
|
|
66
|
-
if p not in ["nb_export", "ExportModuleProc", "optional_procs"]])
|
|
67
|
+
if p not in ["nb_export", "nb_export_cli", "ExportModuleProc", "optional_procs"]])
|
|
67
68
|
|
|
68
69
|
# %% ../nbs/api/04_export.ipynb
|
|
69
|
-
def nb_export(nbname,
|
|
70
|
+
def nb_export(nbname:str, # Filename of notebook
|
|
71
|
+
lib_path:str=None, # Path to destination library. If not in a nbdev project, defaults to current directory.
|
|
72
|
+
procs=None, # Processors to use
|
|
73
|
+
name:str=None, # Name of python script {name}.py to create.
|
|
74
|
+
mod_maker=ModuleMaker,
|
|
75
|
+
debug:bool=False, # Debug mode
|
|
76
|
+
):
|
|
70
77
|
"Create module(s) from notebook"
|
|
71
|
-
if lib_path is None: lib_path = get_config().lib_path
|
|
78
|
+
if lib_path is None: lib_path = get_config().lib_path if is_nbdev() else '.'
|
|
72
79
|
exp = ExportModuleProc()
|
|
73
80
|
nb = NBProcessor(nbname, [exp]+L(procs), debug=debug)
|
|
74
81
|
nb.process()
|
nbdev/migrate.py
CHANGED
|
@@ -112,7 +112,7 @@ def _re_v1():
|
|
|
112
112
|
d += L(get_config().tst_flags).filter()
|
|
113
113
|
d += [s.replace('_', '-') for s in d] # allow for hyphenated version of old directives
|
|
114
114
|
_tmp = '|'.join(list(set(d)))
|
|
115
|
-
return re.compile(
|
|
115
|
+
return re.compile(fr"^[ \f\v\t]*?(#)\s*({_tmp})(?!\S)", re.MULTILINE)
|
|
116
116
|
|
|
117
117
|
def _repl_directives(code_str):
|
|
118
118
|
def _fmt(x): return f"#| {_subv1(x[2].replace('-', '_').strip())}"
|
nbdev/processors.py
CHANGED
|
@@ -206,7 +206,7 @@ _re_showdoc = re.compile(r'^show_doc', re.MULTILINE)
|
|
|
206
206
|
def _is_showdoc(cell): return cell['cell_type'] == 'code' and _re_showdoc.search(cell.source)
|
|
207
207
|
def _add_directives(cell, d):
|
|
208
208
|
for k,v in d.items():
|
|
209
|
-
if not re.findall(
|
|
209
|
+
if not re.findall(fr'#\| *{k}:', cell.source): cell.source = f'#| {k}: {v}\n' + cell.source
|
|
210
210
|
|
|
211
211
|
def clean_show_doc(cell):
|
|
212
212
|
"Remove ShowDoc input cells"
|
nbdev/quarto.py
CHANGED
|
@@ -89,7 +89,7 @@ def _recursive_parser(
|
|
|
89
89
|
set_index: bool = True): # If `True`, `index` file will be set to href.
|
|
90
90
|
for name, val in dir_dict.items():
|
|
91
91
|
if type(val) is str:
|
|
92
|
-
if re.search('index\..*', re.sub(r'^\d+_', '', val)) and set_index and section:
|
|
92
|
+
if re.search(r'index\..*', re.sub(r'^\d+_', '', val)) and set_index and section:
|
|
93
93
|
section.update({'href': str(dirpath/val)})
|
|
94
94
|
else:
|
|
95
95
|
contents.append(str(dirpath/val))
|
|
@@ -110,7 +110,7 @@ def nbdev_sidebar(
|
|
|
110
110
|
path:str=None, # Path to notebooks
|
|
111
111
|
printit:bool=False, # Print YAML for debugging
|
|
112
112
|
force:bool=False, # Create sidebar even if settings.ini custom_sidebar=False
|
|
113
|
-
skip_folder_re:str='(?:^[_.]|^www\$)', # Skip folders matching regex
|
|
113
|
+
skip_folder_re:str=r'(?:^[_.]|^www\$)', # Skip folders matching regex
|
|
114
114
|
**kwargs):
|
|
115
115
|
"Create sidebar.yml"
|
|
116
116
|
if not force and get_config().custom_sidebar: return
|
nbdev/release.py
CHANGED
|
@@ -288,7 +288,7 @@ def release_conda(
|
|
|
288
288
|
if skip_upload: return print(loc)
|
|
289
289
|
if not upload_user: upload_user = get_config().conda_user
|
|
290
290
|
if not upload_user: return print("`conda_user` not in settings.ini and no `upload_user` passed. Cannot upload")
|
|
291
|
-
if 'anaconda upload' not in res: return print(f"{res}\n\
|
|
291
|
+
if 'anaconda upload' not in res: return print(f"{res}\n\nFailed. Check auto-upload not set in .condarc. Try `--do_build False`.")
|
|
292
292
|
return anaconda_upload(name, loc)
|
|
293
293
|
|
|
294
294
|
# %% ../nbs/api/18_release.ipynb
|
nbdev/showdoc.py
CHANGED
|
@@ -192,24 +192,47 @@ def show_doc(sym, # Symbol to document
|
|
|
192
192
|
if isinstance(sym, TypeDispatch): pass
|
|
193
193
|
else:return renderer(sym or show_doc, name=name, title_level=title_level)
|
|
194
194
|
|
|
195
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
196
|
+
def _create_html_table(table_str):
|
|
197
|
+
def split_row(row):
|
|
198
|
+
return re.findall(r'\|(?:(?:\\.|[^|\\])*)', row)
|
|
199
|
+
|
|
200
|
+
def unescape_cell(cell):
|
|
201
|
+
return cell.strip(' *|').replace(r'\|', '|')
|
|
202
|
+
|
|
203
|
+
lines = table_str.strip().split('\n')
|
|
204
|
+
header = [f"<th>{unescape_cell(cell)}</th>" for cell in split_row(lines[0])]
|
|
205
|
+
rows = [[f"<td>{unescape_cell(cell)}</td>" for cell in split_row(line)] for line in lines[2:]]
|
|
206
|
+
|
|
207
|
+
return f'''<table>
|
|
208
|
+
<thead><tr>{' '.join(header)}</tr></thead>
|
|
209
|
+
<tbody>{''.join(f'<tr>{" ".join(row)}</tr>' for row in rows)}</tbody>
|
|
210
|
+
</table>'''
|
|
211
|
+
|
|
195
212
|
# %% ../nbs/api/08_showdoc.ipynb
|
|
196
213
|
def _html_link(url, txt): return f'<a href="{url}" target="_blank" rel="noreferrer noopener">{txt}</a>'
|
|
197
214
|
|
|
215
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
198
216
|
class BasicHtmlRenderer(ShowDocRenderer):
|
|
199
|
-
"
|
|
217
|
+
"HTML renderer for `show_doc`"
|
|
200
218
|
def _repr_html_(self):
|
|
201
219
|
doc = '<hr/>\n'
|
|
220
|
+
src = NbdevLookup().code(self.fn)
|
|
202
221
|
doc += f'<h{self.title_level}>{self.nm}</h{self.title_level}>\n'
|
|
203
|
-
|
|
204
|
-
|
|
222
|
+
sig = _fmt_sig(self.sig) if self.sig else ''
|
|
223
|
+
# Escape < and > characters in the signature
|
|
224
|
+
sig = sig.replace('<', '<').replace('>', '>')
|
|
225
|
+
doc += f'<blockquote><pre><code>{self.nm} {sig}</code></pre></blockquote>'
|
|
226
|
+
if self.docs:
|
|
227
|
+
doc += f"<p><i>{self.docs}</i></p>"
|
|
228
|
+
if src: doc += f"<br/>{_html_link(src, 'source')}"
|
|
229
|
+
if self.dm.has_docment: doc += _create_html_table(str(self.dm))
|
|
205
230
|
return doc
|
|
206
231
|
|
|
207
232
|
def doc(self):
|
|
208
233
|
"Show `show_doc` info along with link to docs"
|
|
209
234
|
from IPython.display import display,HTML
|
|
210
235
|
res = self._repr_html_()
|
|
211
|
-
docs = NbdevLookup().doc(self.fn)
|
|
212
|
-
if docs is not None: res += '\n<p>' +_html_link(docs, "Show in docs") + '</p>'
|
|
213
236
|
display(HTML(res))
|
|
214
237
|
|
|
215
238
|
# %% ../nbs/api/08_showdoc.ipynb
|
nbdev/sync.py
CHANGED
|
@@ -19,7 +19,7 @@ from fastcore.script import *
|
|
|
19
19
|
from fastcore.xtras import *
|
|
20
20
|
|
|
21
21
|
import ast
|
|
22
|
-
|
|
22
|
+
import importlib
|
|
23
23
|
|
|
24
24
|
# %% ../nbs/api/06_sync.ipynb
|
|
25
25
|
def absolute_import(name, fname, level):
|
|
@@ -32,7 +32,10 @@ def absolute_import(name, fname, level):
|
|
|
32
32
|
# %% ../nbs/api/06_sync.ipynb
|
|
33
33
|
@functools.lru_cache(maxsize=None)
|
|
34
34
|
def _mod_files():
|
|
35
|
-
|
|
35
|
+
midx_spec = importlib.util.spec_from_file_location("_modidx", get_config().lib_path / "_modidx.py")
|
|
36
|
+
midx = importlib.util.module_from_spec(midx_spec)
|
|
37
|
+
midx_spec.loader.exec_module(midx)
|
|
38
|
+
|
|
36
39
|
return L(files for mod in midx.d['syms'].values() for _,files in mod.values()).unique()
|
|
37
40
|
|
|
38
41
|
# %% ../nbs/api/06_sync.ipynb
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nbdev
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.33
|
|
4
4
|
Summary: Create delightful software with Jupyter Notebooks
|
|
5
|
-
Home-page: https://github.com/
|
|
5
|
+
Home-page: https://github.com/AnswerDotAI/nbdev
|
|
6
6
|
Author: Jeremy Howard and Hamel Husain
|
|
7
7
|
Author-email: j@fast.ai
|
|
8
8
|
License: Apache Software License 2.0
|
|
@@ -28,6 +28,7 @@ Requires-Dist: astunparse
|
|
|
28
28
|
Requires-Dist: ghapi >=1.0.3
|
|
29
29
|
Requires-Dist: watchdog
|
|
30
30
|
Requires-Dist: asttokens
|
|
31
|
+
Requires-Dist: setuptools
|
|
31
32
|
Requires-Dist: PyYAML
|
|
32
33
|
Provides-Extra: dev
|
|
33
34
|
Requires-Dist: ipywidgets ; extra == 'dev'
|
|
@@ -38,6 +39,8 @@ Requires-Dist: matplotlib ; extra == 'dev'
|
|
|
38
39
|
Requires-Dist: black ; extra == 'dev'
|
|
39
40
|
Requires-Dist: svg.py ; extra == 'dev'
|
|
40
41
|
Requires-Dist: nbclassic ; extra == 'dev'
|
|
42
|
+
Requires-Dist: pysymbol-llm ; extra == 'dev'
|
|
43
|
+
Requires-Dist: llms-txt ; extra == 'dev'
|
|
41
44
|
|
|
42
45
|
# Getting Started
|
|
43
46
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
nbdev/__init__.py,sha256=zyGebCy5vacGGdDbzVk4ZwbBNwGFaTTApHl3PHrqwOk,90
|
|
2
|
+
nbdev/_modidx.py,sha256=k-21ZZLvVkXodH8hvq7opMoO-lmqXQhgBxHJ0V6wL-I,41145
|
|
3
|
+
nbdev/clean.py,sha256=mVgsW2_g7KIXAVh8mwpj86UwMN6QVM-q33PDzA27nWw,9410
|
|
4
|
+
nbdev/cli.py,sha256=8YWXu9jDiVpTd9mhCealLNAd5Fg3xCpNklpZ6Fc8tD0,7045
|
|
5
|
+
nbdev/config.py,sha256=B_LbvyTLi2jDI53MTWypJhgXD8PoyY0ztRzPhYEnG7s,12225
|
|
6
|
+
nbdev/doclinks.py,sha256=ebSn9-4djFmZHxEQioA5I4rV-fwLeCSxgYaTDvZ9s_s,11175
|
|
7
|
+
nbdev/export.py,sha256=IonpKGYthPgAjEGrm8sK36O2yflQFaxLEXBBrEYe5q4,3955
|
|
8
|
+
nbdev/extract_attachments.py,sha256=O4mS4EFIOXL_yQ3jmsnBStrWxGR_nPNvxLYXHtLeimw,2208
|
|
9
|
+
nbdev/frontmatter.py,sha256=i195bhDLWd-WUEzQT9JBoA4Ee3j6gD1dKMT8yk5fF4Y,2761
|
|
10
|
+
nbdev/imports.py,sha256=f5Ynco14hsJyFCf43-uP_YARMhHADe6lM-20Mc_vXhw,95
|
|
11
|
+
nbdev/maker.py,sha256=JrvvtG23_tgT4i-zzDrUF1GmLhdL_9j4S-dcD-GVui4,9801
|
|
12
|
+
nbdev/merge.py,sha256=xmT7LMY_mQGOGl0ynqkB13M6HwJfUOTis1Xl--YDXR8,4341
|
|
13
|
+
nbdev/migrate.py,sha256=YJTtWC6TPaZpZTcD0Jex6stOSumjju2QrUozF9rvl0Y,7311
|
|
14
|
+
nbdev/process.py,sha256=Vb3SN5YW2gB9rYv5ToeveOeL9qM9AGLRPXCyAFiaE3g,5853
|
|
15
|
+
nbdev/processors.py,sha256=vtby1GBM-iz6axnhPIVU-HTN8jNYA6CzsT-N_EGcUlE,11976
|
|
16
|
+
nbdev/qmd.py,sha256=VAxE-c1sT7y26VdyreB6j9fge-CuLbHWocRE_WbnYXg,2994
|
|
17
|
+
nbdev/quarto.py,sha256=o-fRR5gqWKvIjr-k4f_XfN3LpMIsO0URC9yEtDOJHLs,12053
|
|
18
|
+
nbdev/release.py,sha256=K8Q7CU-fM5TyLy5Q8AswpA3vE5CHa8aHaeKU9LHtlv0,14159
|
|
19
|
+
nbdev/serve.py,sha256=Yn1TqXi3cngCuGGC4iMy9tMRS4ID1lHdjro10LVKtts,3061
|
|
20
|
+
nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
|
|
21
|
+
nbdev/showdoc.py,sha256=v7qUzyr5gMN99jZMzal_ulRLsn617BkRMS1XEq9UqjE,10033
|
|
22
|
+
nbdev/sync.py,sha256=ld-lSOmlX1FdnTOzaSHcxKyIuIguI_SpluqfPSH2BZ8,3201
|
|
23
|
+
nbdev/test.py,sha256=_ECBd5fvfGEICIfkTI2S8w8YatL5CaPltCeDSsiH6yw,4435
|
|
24
|
+
nbdev-2.3.33.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
25
|
+
nbdev-2.3.33.dist-info/METADATA,sha256=pCeE7eIuXL2xLlTqnGCka5jY5cw5XaOKgRDBWioHKRA,10515
|
|
26
|
+
nbdev-2.3.33.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
27
|
+
nbdev-2.3.33.dist-info/entry_points.txt,sha256=P7LtWbUX0nXuV5g7HJtSDdTWjn7cq9a9uv3p6VoYDz8,1400
|
|
28
|
+
nbdev-2.3.33.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
29
|
+
nbdev-2.3.33.dist-info/RECORD,,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
[console_scripts]
|
|
2
|
+
nb_export = nbdev.cli:nb_export_cli
|
|
2
3
|
nbdev_bump_version = nbdev.release:nbdev_bump_version
|
|
3
4
|
nbdev_changelog = nbdev.release:changelog
|
|
4
5
|
nbdev_clean = nbdev.clean:nbdev_clean
|
|
@@ -29,6 +30,7 @@ nbdev_test = nbdev.test:nbdev_test
|
|
|
29
30
|
nbdev_trust = nbdev.clean:nbdev_trust
|
|
30
31
|
nbdev_update = nbdev.sync:nbdev_update
|
|
31
32
|
nbdev_update_license = nbdev.cli:nbdev_update_license
|
|
33
|
+
watch_export = nbdev.cli:watch_export
|
|
32
34
|
|
|
33
35
|
[nbdev]
|
|
34
36
|
nbdev = nbdev._modidx:d
|
nbdev-2.3.31.dist-info/RECORD
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
nbdev/__init__.py,sha256=ReFFjPgrWaySFlsH-cmisBxKdGcxzuymBgY7aQ3OpDs,90
|
|
2
|
-
nbdev/_modidx.py,sha256=7X6o4xjiXIFQHKsVBFE0qOF3Wuo_s2KSxGoPViqFRiM,40681
|
|
3
|
-
nbdev/clean.py,sha256=mVgsW2_g7KIXAVh8mwpj86UwMN6QVM-q33PDzA27nWw,9410
|
|
4
|
-
nbdev/cli.py,sha256=qGNwsrskbVazzyKDpTjwQsQcwEqAZBlFTlehHswasHs,5608
|
|
5
|
-
nbdev/config.py,sha256=vbNR9hUr5kcOTJrah229Wcn8o5sF92LZAEmTE9mJtoE,12345
|
|
6
|
-
nbdev/doclinks.py,sha256=L2KkkpC1h6f80rZ-GKj2wRb7uI8lmkXxcVEsQ7jeeoM,10607
|
|
7
|
-
nbdev/export.py,sha256=P4fzzPFs0VIaWXclfU1i3JtBdMpDNqq8lmV4oKv6n9Y,3574
|
|
8
|
-
nbdev/extract_attachments.py,sha256=O4mS4EFIOXL_yQ3jmsnBStrWxGR_nPNvxLYXHtLeimw,2208
|
|
9
|
-
nbdev/frontmatter.py,sha256=i195bhDLWd-WUEzQT9JBoA4Ee3j6gD1dKMT8yk5fF4Y,2761
|
|
10
|
-
nbdev/imports.py,sha256=f5Ynco14hsJyFCf43-uP_YARMhHADe6lM-20Mc_vXhw,95
|
|
11
|
-
nbdev/maker.py,sha256=JrvvtG23_tgT4i-zzDrUF1GmLhdL_9j4S-dcD-GVui4,9801
|
|
12
|
-
nbdev/merge.py,sha256=xmT7LMY_mQGOGl0ynqkB13M6HwJfUOTis1Xl--YDXR8,4341
|
|
13
|
-
nbdev/migrate.py,sha256=3Z4i170SqtUs7nan_LbKpx-sP1EH9rrbG3BOFrIv58Y,7310
|
|
14
|
-
nbdev/process.py,sha256=Vb3SN5YW2gB9rYv5ToeveOeL9qM9AGLRPXCyAFiaE3g,5853
|
|
15
|
-
nbdev/processors.py,sha256=CtlNBS2SUdP87XaPOXGeAF8yYgsUJURiW5Q7HNR7wt4,11975
|
|
16
|
-
nbdev/qmd.py,sha256=VAxE-c1sT7y26VdyreB6j9fge-CuLbHWocRE_WbnYXg,2994
|
|
17
|
-
nbdev/quarto.py,sha256=PaH3NdwgMAnAqIWM3oo9yhC0_VHvTU4ukpXNhiSOWB0,12051
|
|
18
|
-
nbdev/release.py,sha256=Ucy71GzfOeOyGoeD5IoLvEaMya3-_0otDcD4gnpzCN0,14158
|
|
19
|
-
nbdev/serve.py,sha256=Yn1TqXi3cngCuGGC4iMy9tMRS4ID1lHdjro10LVKtts,3061
|
|
20
|
-
nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
|
|
21
|
-
nbdev/showdoc.py,sha256=sSVyVw-hIIewJ12sxngVpvb_hoHVrmLcuZWjszqMzxE,9169
|
|
22
|
-
nbdev/sync.py,sha256=eykW8weeOqoRLbNRCeKaO8QqD6_CwspOwnwgno44yxY,3088
|
|
23
|
-
nbdev/test.py,sha256=_ECBd5fvfGEICIfkTI2S8w8YatL5CaPltCeDSsiH6yw,4435
|
|
24
|
-
nbdev-2.3.31.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
25
|
-
nbdev-2.3.31.dist-info/METADATA,sha256=ON3bNstEl4GPPHHFFMnLjZoMpopPxOo7qG_OWV2Qqoc,10398
|
|
26
|
-
nbdev-2.3.31.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
27
|
-
nbdev-2.3.31.dist-info/entry_points.txt,sha256=GMherdbuc27OmIuaaom4eNx5sTdCvAdNrZA6XLEZOA8,1326
|
|
28
|
-
nbdev-2.3.31.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
29
|
-
nbdev-2.3.31.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|