nbdev 2.3.27__py3-none-any.whl → 2.3.29__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 +2 -0
- nbdev/clean.py +17 -15
- nbdev/cli.py +14 -19
- nbdev/config.py +21 -26
- nbdev/doclinks.py +16 -14
- nbdev/export.py +22 -15
- nbdev/frontmatter.py +5 -3
- nbdev/maker.py +28 -26
- nbdev/merge.py +11 -9
- nbdev/migrate.py +19 -17
- nbdev/process.py +16 -14
- nbdev/processors.py +39 -27
- nbdev/qmd.py +9 -7
- nbdev/quarto.py +25 -21
- nbdev/release.py +30 -28
- nbdev/serve.py +6 -4
- nbdev/showdoc.py +17 -15
- nbdev/sync.py +10 -8
- nbdev/test.py +6 -4
- {nbdev-2.3.27.dist-info → nbdev-2.3.29.dist-info}/METADATA +3 -2
- nbdev-2.3.29.dist-info/RECORD +29 -0
- nbdev-2.3.27.dist-info/RECORD +0 -29
- {nbdev-2.3.27.dist-info → nbdev-2.3.29.dist-info}/LICENSE +0 -0
- {nbdev-2.3.27.dist-info → nbdev-2.3.29.dist-info}/WHEEL +0 -0
- {nbdev-2.3.27.dist-info → nbdev-2.3.29.dist-info}/entry_points.txt +0 -0
- {nbdev-2.3.27.dist-info → nbdev-2.3.29.dist-info}/top_level.txt +0 -0
nbdev/release.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""Auto-generated tagged releases and release notes from GitHub issues"""
|
|
2
|
+
|
|
1
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/18_release.ipynb.
|
|
2
4
|
|
|
3
5
|
# %% auto 0
|
|
@@ -5,7 +7,7 @@ __all__ = ['GH_HOST', 'Release', 'changelog', 'release_git', 'release_gh', 'pypi
|
|
|
5
7
|
'conda_output_path', 'write_conda_meta', 'write_requirements', 'anaconda_upload', 'release_conda',
|
|
6
8
|
'chk_conda_rel', 'release_pypi', 'release_both', 'bump_version', 'nbdev_bump_version']
|
|
7
9
|
|
|
8
|
-
# %% ../nbs/api/18_release.ipynb
|
|
10
|
+
# %% ../nbs/api/18_release.ipynb
|
|
9
11
|
from fastcore.all import *
|
|
10
12
|
from ghapi.core import *
|
|
11
13
|
|
|
@@ -14,16 +16,16 @@ import shutil,subprocess
|
|
|
14
16
|
|
|
15
17
|
from .doclinks import *
|
|
16
18
|
|
|
17
|
-
# %% ../nbs/api/18_release.ipynb
|
|
19
|
+
# %% ../nbs/api/18_release.ipynb
|
|
18
20
|
GH_HOST = "https://api.github.com"
|
|
19
21
|
|
|
20
|
-
# %% ../nbs/api/18_release.ipynb
|
|
22
|
+
# %% ../nbs/api/18_release.ipynb
|
|
21
23
|
def _find_config(cfg_name="settings.ini"):
|
|
22
24
|
cfg_path = Path().absolute()
|
|
23
25
|
while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent
|
|
24
26
|
return Config(cfg_path, cfg_name)
|
|
25
27
|
|
|
26
|
-
# %% ../nbs/api/18_release.ipynb
|
|
28
|
+
# %% ../nbs/api/18_release.ipynb
|
|
27
29
|
def _issue_txt(issue):
|
|
28
30
|
res = '- {} ([#{}]({}))'.format(issue.title.strip(), issue.number, issue.html_url)
|
|
29
31
|
if hasattr(issue, 'pull_request'): res += ', thanks to [@{}]({})'.format(issue.user.login, issue.user.html_url)
|
|
@@ -40,7 +42,7 @@ def _load_json(cfg, k):
|
|
|
40
42
|
try: return json.loads(cfg[k])
|
|
41
43
|
except json.JSONDecodeError as e: raise Exception(f"Key: `{k}` in .ini file is not a valid JSON string: {e}")
|
|
42
44
|
|
|
43
|
-
# %% ../nbs/api/18_release.ipynb
|
|
45
|
+
# %% ../nbs/api/18_release.ipynb
|
|
44
46
|
class Release:
|
|
45
47
|
def __init__(self, owner=None, repo=None, token=None, **groups):
|
|
46
48
|
"Create CHANGELOG.md from GitHub issues"
|
|
@@ -62,7 +64,7 @@ class Release:
|
|
|
62
64
|
return self.gh.issues.list_for_repo(state='closed', sort='created', filter='all', since=self.commit_date, labels=label)
|
|
63
65
|
def _issue_groups(self): return parallel(self._issues, self.groups.keys(), progress=False)
|
|
64
66
|
|
|
65
|
-
# %% ../nbs/api/18_release.ipynb
|
|
67
|
+
# %% ../nbs/api/18_release.ipynb
|
|
66
68
|
@patch
|
|
67
69
|
def changelog(self:Release,
|
|
68
70
|
debug=False): # Just print the latest changes, instead of updating file
|
|
@@ -80,7 +82,7 @@ def changelog(self:Release,
|
|
|
80
82
|
self.changefile.write_text(res)
|
|
81
83
|
run(f'git add {self.changefile}')
|
|
82
84
|
|
|
83
|
-
# %% ../nbs/api/18_release.ipynb
|
|
85
|
+
# %% ../nbs/api/18_release.ipynb
|
|
84
86
|
@patch
|
|
85
87
|
def release(self:Release):
|
|
86
88
|
"Tag and create a release in GitHub for the current version"
|
|
@@ -89,7 +91,7 @@ def release(self:Release):
|
|
|
89
91
|
self.gh.create_release(ver, branch=self.cfg.branch, body=notes)
|
|
90
92
|
return ver
|
|
91
93
|
|
|
92
|
-
# %% ../nbs/api/18_release.ipynb
|
|
94
|
+
# %% ../nbs/api/18_release.ipynb
|
|
93
95
|
@patch
|
|
94
96
|
def latest_notes(self:Release):
|
|
95
97
|
"Latest CHANGELOG entry"
|
|
@@ -98,7 +100,7 @@ def latest_notes(self:Release):
|
|
|
98
100
|
if not len(its)>0: return ''
|
|
99
101
|
return '\n'.join(its[1].splitlines()[1:]).strip()
|
|
100
102
|
|
|
101
|
-
# %% ../nbs/api/18_release.ipynb
|
|
103
|
+
# %% ../nbs/api/18_release.ipynb
|
|
102
104
|
@call_parse
|
|
103
105
|
def changelog(
|
|
104
106
|
debug:store_true=False, # Print info to be added to CHANGELOG, instead of updating file
|
|
@@ -108,7 +110,7 @@ def changelog(
|
|
|
108
110
|
res = Release(repo=repo).changelog(debug=debug)
|
|
109
111
|
if debug: print(res)
|
|
110
112
|
|
|
111
|
-
# %% ../nbs/api/18_release.ipynb
|
|
113
|
+
# %% ../nbs/api/18_release.ipynb
|
|
112
114
|
@call_parse
|
|
113
115
|
def release_git(
|
|
114
116
|
token:str=None # Optional GitHub token (otherwise `token` file is used)
|
|
@@ -117,7 +119,7 @@ def release_git(
|
|
|
117
119
|
ver = Release(token=token).release()
|
|
118
120
|
print(f"Released {ver}")
|
|
119
121
|
|
|
120
|
-
# %% ../nbs/api/18_release.ipynb
|
|
122
|
+
# %% ../nbs/api/18_release.ipynb
|
|
121
123
|
@call_parse
|
|
122
124
|
def release_gh(
|
|
123
125
|
token:str=None # Optional GitHub token (otherwise `token` file is used)
|
|
@@ -132,7 +134,7 @@ def release_gh(
|
|
|
132
134
|
ver = Release(token=token).release()
|
|
133
135
|
print(f"Released {ver}")
|
|
134
136
|
|
|
135
|
-
# %% ../nbs/api/18_release.ipynb
|
|
137
|
+
# %% ../nbs/api/18_release.ipynb
|
|
136
138
|
from fastcore.all import *
|
|
137
139
|
from .config import *
|
|
138
140
|
from .cli import *
|
|
@@ -144,18 +146,18 @@ except ImportError: from pip._vendor.packaging.version import parse
|
|
|
144
146
|
|
|
145
147
|
_PYPI_URL = 'https://pypi.org/pypi/'
|
|
146
148
|
|
|
147
|
-
# %% ../nbs/api/18_release.ipynb
|
|
149
|
+
# %% ../nbs/api/18_release.ipynb
|
|
148
150
|
def pypi_json(s):
|
|
149
151
|
"Dictionary decoded JSON for PYPI path `s`"
|
|
150
152
|
return urljson(f'{_PYPI_URL}{s}/json')
|
|
151
153
|
|
|
152
|
-
# %% ../nbs/api/18_release.ipynb
|
|
154
|
+
# %% ../nbs/api/18_release.ipynb
|
|
153
155
|
def latest_pypi(name):
|
|
154
156
|
"Latest version of `name` on pypi"
|
|
155
157
|
return max(parse(r) for r,o in pypi_json(name)['releases'].items()
|
|
156
158
|
if not parse(r).is_prerelease and not nested_idx(o, 0, 'yanked'))
|
|
157
159
|
|
|
158
|
-
# %% ../nbs/api/18_release.ipynb
|
|
160
|
+
# %% ../nbs/api/18_release.ipynb
|
|
159
161
|
def pypi_details(name):
|
|
160
162
|
"Version, URL, and SHA256 for `name` from pypi"
|
|
161
163
|
ver = str(latest_pypi(name))
|
|
@@ -163,7 +165,7 @@ def pypi_details(name):
|
|
|
163
165
|
rel = [o for o in pypi['urls'] if o['packagetype']=='sdist'][0]
|
|
164
166
|
return ver,rel['url'],rel['digests']['sha256']
|
|
165
167
|
|
|
166
|
-
# %% ../nbs/api/18_release.ipynb
|
|
168
|
+
# %% ../nbs/api/18_release.ipynb
|
|
167
169
|
import shlex
|
|
168
170
|
from subprocess import Popen, PIPE, CalledProcessError
|
|
169
171
|
|
|
@@ -177,12 +179,12 @@ def _run(cmd):
|
|
|
177
179
|
if p.returncode != 0: raise CalledProcessError(p.returncode, p.args)
|
|
178
180
|
return res
|
|
179
181
|
|
|
180
|
-
# %% ../nbs/api/18_release.ipynb
|
|
182
|
+
# %% ../nbs/api/18_release.ipynb
|
|
181
183
|
def conda_output_path(name, build='build'):
|
|
182
184
|
"Output path for conda build"
|
|
183
185
|
return run(f'conda {build} --output {name}').strip().replace('\\', '/')
|
|
184
186
|
|
|
185
|
-
# %% ../nbs/api/18_release.ipynb
|
|
187
|
+
# %% ../nbs/api/18_release.ipynb
|
|
186
188
|
def _write_yaml(path, name, d1, d2):
|
|
187
189
|
path = Path(path)
|
|
188
190
|
p = path/name
|
|
@@ -192,7 +194,7 @@ def _write_yaml(path, name, d1, d2):
|
|
|
192
194
|
yaml.safe_dump(d1, f)
|
|
193
195
|
yaml.safe_dump(d2, f)
|
|
194
196
|
|
|
195
|
-
# %% ../nbs/api/18_release.ipynb
|
|
197
|
+
# %% ../nbs/api/18_release.ipynb
|
|
196
198
|
def _get_conda_meta():
|
|
197
199
|
cfg = get_config()
|
|
198
200
|
name,ver = cfg.lib_name,cfg.version
|
|
@@ -234,12 +236,12 @@ def _get_conda_meta():
|
|
|
234
236
|
}
|
|
235
237
|
return name,d1,d2
|
|
236
238
|
|
|
237
|
-
# %% ../nbs/api/18_release.ipynb
|
|
239
|
+
# %% ../nbs/api/18_release.ipynb
|
|
238
240
|
def write_conda_meta(path='conda'):
|
|
239
241
|
"Writes a `meta.yaml` file to the `conda` directory of the current directory"
|
|
240
242
|
_write_yaml(path, *_get_conda_meta())
|
|
241
243
|
|
|
242
|
-
# %% ../nbs/api/18_release.ipynb
|
|
244
|
+
# %% ../nbs/api/18_release.ipynb
|
|
243
245
|
@call_parse
|
|
244
246
|
def write_requirements(path:str=''):
|
|
245
247
|
"Writes a `requirements.txt` file to `directory` based on settings.ini."
|
|
@@ -248,7 +250,7 @@ def write_requirements(path:str=''):
|
|
|
248
250
|
req = '\n'.join([cfg.get(k, '').replace(' ', '\n') for k in ['requirements', 'pip_requirements']])
|
|
249
251
|
(d/'requirements.txt').mk_write(req)
|
|
250
252
|
|
|
251
|
-
# %% ../nbs/api/18_release.ipynb
|
|
253
|
+
# %% ../nbs/api/18_release.ipynb
|
|
252
254
|
def anaconda_upload(name, loc=None, user=None, token=None, env_token=None):
|
|
253
255
|
"Upload `name` to anaconda"
|
|
254
256
|
user = f'-u {user} ' if user else ''
|
|
@@ -258,7 +260,7 @@ def anaconda_upload(name, loc=None, user=None, token=None, env_token=None):
|
|
|
258
260
|
if not loc: raise Exception("Failed to find output")
|
|
259
261
|
return _run(f'anaconda {token} upload {user} {loc} --skip-existing')
|
|
260
262
|
|
|
261
|
-
# %% ../nbs/api/18_release.ipynb
|
|
263
|
+
# %% ../nbs/api/18_release.ipynb
|
|
262
264
|
@call_parse
|
|
263
265
|
def release_conda(
|
|
264
266
|
path:str='conda', # Path where package will be created
|
|
@@ -289,7 +291,7 @@ def release_conda(
|
|
|
289
291
|
if 'anaconda upload' not in res: return print(f"{res}\n\Failed. Check auto-upload not set in .condarc. Try `--do_build False`.")
|
|
290
292
|
return anaconda_upload(name, loc)
|
|
291
293
|
|
|
292
|
-
# %% ../nbs/api/18_release.ipynb
|
|
294
|
+
# %% ../nbs/api/18_release.ipynb
|
|
293
295
|
def chk_conda_rel(
|
|
294
296
|
nm:str, # Package name on pypi
|
|
295
297
|
apkg:str=None, # Anaconda Package (defaults to {nm})
|
|
@@ -303,7 +305,7 @@ def chk_conda_rel(
|
|
|
303
305
|
pypitag = latest_pypi(nm)
|
|
304
306
|
if force or not condatag or pypitag > max(condatag): return f'{pypitag}'
|
|
305
307
|
|
|
306
|
-
# %% ../nbs/api/18_release.ipynb
|
|
308
|
+
# %% ../nbs/api/18_release.ipynb
|
|
307
309
|
@call_parse
|
|
308
310
|
def release_pypi(
|
|
309
311
|
repository:str="pypi" # Respository to upload to (defined in ~/.pypirc)
|
|
@@ -313,7 +315,7 @@ def release_pypi(
|
|
|
313
315
|
system(f'cd {_dir} && rm -rf dist build && python setup.py sdist bdist_wheel')
|
|
314
316
|
system(f'twine upload --repository {repository} {_dir}/dist/*')
|
|
315
317
|
|
|
316
|
-
# %% ../nbs/api/18_release.ipynb
|
|
318
|
+
# %% ../nbs/api/18_release.ipynb
|
|
317
319
|
@call_parse
|
|
318
320
|
def release_both(
|
|
319
321
|
path:str='conda', # Path where package will be created
|
|
@@ -329,7 +331,7 @@ def release_both(
|
|
|
329
331
|
release_conda.__wrapped__(path, do_build=do_build, build_args=build_args, skip_upload=skip_upload, mambabuild=mambabuild, upload_user=upload_user)
|
|
330
332
|
nbdev_bump_version.__wrapped__()
|
|
331
333
|
|
|
332
|
-
# %% ../nbs/api/18_release.ipynb
|
|
334
|
+
# %% ../nbs/api/18_release.ipynb
|
|
333
335
|
def bump_version(version, part=2, unbump=False):
|
|
334
336
|
version = version.split('.')
|
|
335
337
|
incr = -1 if unbump else 1
|
|
@@ -337,7 +339,7 @@ def bump_version(version, part=2, unbump=False):
|
|
|
337
339
|
for i in range(part+1, 3): version[i] = '0'
|
|
338
340
|
return '.'.join(version)
|
|
339
341
|
|
|
340
|
-
# %% ../nbs/api/18_release.ipynb
|
|
342
|
+
# %% ../nbs/api/18_release.ipynb
|
|
341
343
|
@call_parse
|
|
342
344
|
def nbdev_bump_version(
|
|
343
345
|
part:int=2, # Part of version to bump
|
nbdev/serve.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"""A parallel ipynb processor (experimental)"""
|
|
2
|
+
|
|
1
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/17_serve.ipynb.
|
|
2
4
|
|
|
3
5
|
# %% auto 0
|
|
4
6
|
__all__ = ['proc_nbs']
|
|
5
7
|
|
|
6
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
8
|
+
# %% ../nbs/api/17_serve.ipynb
|
|
7
9
|
import ast,subprocess,threading,sys
|
|
8
10
|
from shutil import rmtree,copy2
|
|
9
11
|
|
|
@@ -17,7 +19,7 @@ from .doclinks import nbglob_cli,nbglob
|
|
|
17
19
|
from .processors import FilterDefaults
|
|
18
20
|
import nbdev.serve_drv
|
|
19
21
|
|
|
20
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
22
|
+
# %% ../nbs/api/17_serve.ipynb
|
|
21
23
|
def _is_qpy(path:Path):
|
|
22
24
|
"Is `path` a py script starting with frontmatter?"
|
|
23
25
|
path = Path(path)
|
|
@@ -32,7 +34,7 @@ def _is_qpy(path:Path):
|
|
|
32
34
|
vl = v.splitlines()
|
|
33
35
|
if vl[0]=='---' and vl[-1]=='---': return '\n'.join(vl[1:-1])
|
|
34
36
|
|
|
35
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
37
|
+
# %% ../nbs/api/17_serve.ipynb
|
|
36
38
|
def _proc_file(s, cache, path, mtime=None):
|
|
37
39
|
skips = ('_proc', '_docs', '_site')
|
|
38
40
|
if not s.is_file() or any(o[0]=='.' or o in skips for o in s.parts): return
|
|
@@ -49,7 +51,7 @@ def _proc_file(s, cache, path, mtime=None):
|
|
|
49
51
|
if md is not None: return s,d,md.strip()
|
|
50
52
|
else: copy2(s,d)
|
|
51
53
|
|
|
52
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
54
|
+
# %% ../nbs/api/17_serve.ipynb
|
|
53
55
|
@delegates(nbglob_cli)
|
|
54
56
|
def proc_nbs(
|
|
55
57
|
path:str='', # Path to notebooks
|
nbdev/showdoc.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""Display symbol documentation in notebook and website"""
|
|
2
|
+
|
|
1
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/08_showdoc.ipynb.
|
|
2
4
|
|
|
3
5
|
# %% ../nbs/api/08_showdoc.ipynb 2
|
|
@@ -19,24 +21,24 @@ from types import FunctionType
|
|
|
19
21
|
__all__ = ['DocmentTbl', 'ShowDocRenderer', 'BasicMarkdownRenderer', 'show_doc', 'BasicHtmlRenderer', 'doc', 'showdoc_nm',
|
|
20
22
|
'colab_link']
|
|
21
23
|
|
|
22
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
24
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
23
25
|
def _non_empty_keys(d:dict): return L([k for k,v in d.items() if v != inspect._empty])
|
|
24
26
|
def _bold(s): return f'**{s}**' if s.strip() else s
|
|
25
27
|
|
|
26
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
28
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
27
29
|
def _escape_markdown(s):
|
|
28
30
|
for c in '|^': s = re.sub(rf'\\?\{c}', rf'\{c}', s)
|
|
29
31
|
return s.replace('\n', '<br>')
|
|
30
32
|
|
|
31
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
33
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
32
34
|
def _maybe_nm(o):
|
|
33
35
|
if (o == inspect._empty): return ''
|
|
34
36
|
else: return o.__name__ if hasattr(o, '__name__') else _escape_markdown(str(o))
|
|
35
37
|
|
|
36
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
38
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
37
39
|
def _list2row(l:list): return '| '+' | '.join([_maybe_nm(o) for o in l]) + ' |'
|
|
38
40
|
|
|
39
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
41
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
40
42
|
class DocmentTbl:
|
|
41
43
|
# this is the column order we want these items to appear
|
|
42
44
|
_map = OrderedDict({'anno':'Type', 'default':'Default', 'docment':'Details'})
|
|
@@ -106,12 +108,12 @@ class DocmentTbl:
|
|
|
106
108
|
__str__ = _repr_markdown_
|
|
107
109
|
__repr__ = basic_repr()
|
|
108
110
|
|
|
109
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
111
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
110
112
|
def _docstring(sym):
|
|
111
113
|
npdoc = parse_docstring(sym)
|
|
112
114
|
return '\n\n'.join([npdoc['Summary'], npdoc['Extended']]).strip()
|
|
113
115
|
|
|
114
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
116
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
115
117
|
def _fullname(o):
|
|
116
118
|
module,name = getattr(o, "__module__", None),qual_name(o)
|
|
117
119
|
return name if module is None or module in ('__main__','builtins') else module + '.' + name
|
|
@@ -132,7 +134,7 @@ class ShowDocRenderer:
|
|
|
132
134
|
|
|
133
135
|
__repr__ = basic_repr()
|
|
134
136
|
|
|
135
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
137
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
136
138
|
def _f_name(o): return f'<function {o.__name__}>' if isinstance(o, FunctionType) else None
|
|
137
139
|
def _fmt_anno(o): return inspect.formatannotation(o).strip("'").replace(' ','')
|
|
138
140
|
|
|
@@ -145,7 +147,7 @@ def _show_param(param):
|
|
|
145
147
|
if default is not inspect._empty: res += f'={_f_name(default) or repr(default)}'
|
|
146
148
|
return res
|
|
147
149
|
|
|
148
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
150
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
149
151
|
def _fmt_sig(sig):
|
|
150
152
|
if sig is None: return ''
|
|
151
153
|
p = {k:v for k,v in sig.parameters.items()}
|
|
@@ -158,7 +160,7 @@ def _wrap_sig(s):
|
|
|
158
160
|
indent = pad + ' ' * (s.find('(') + 1)
|
|
159
161
|
return fill(s, width=80, initial_indent=pad, subsequent_indent=indent)
|
|
160
162
|
|
|
161
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
163
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
162
164
|
def _ext_link(url, txt, xtra=""): return f'[{txt}]({url}){{target="_blank" {xtra}}}'
|
|
163
165
|
|
|
164
166
|
class BasicMarkdownRenderer(ShowDocRenderer):
|
|
@@ -176,7 +178,7 @@ class BasicMarkdownRenderer(ShowDocRenderer):
|
|
|
176
178
|
return doc
|
|
177
179
|
__repr__=__str__=_repr_markdown_
|
|
178
180
|
|
|
179
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
181
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
180
182
|
def show_doc(sym, # Symbol to document
|
|
181
183
|
renderer=None, # Optional renderer (defaults to markdown)
|
|
182
184
|
name:str|None=None, # Optionally override displayed name of `sym`
|
|
@@ -190,7 +192,7 @@ def show_doc(sym, # Symbol to document
|
|
|
190
192
|
if isinstance(sym, TypeDispatch): pass
|
|
191
193
|
else:return renderer(sym or show_doc, name=name, title_level=title_level)
|
|
192
194
|
|
|
193
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
195
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
194
196
|
def _html_link(url, txt): return f'<a href="{url}" target="_blank" rel="noreferrer noopener">{txt}</a>'
|
|
195
197
|
|
|
196
198
|
class BasicHtmlRenderer(ShowDocRenderer):
|
|
@@ -210,17 +212,17 @@ class BasicHtmlRenderer(ShowDocRenderer):
|
|
|
210
212
|
if docs is not None: res += '\n<p>' +_html_link(docs, "Show in docs") + '</p>'
|
|
211
213
|
display(HTML(res))
|
|
212
214
|
|
|
213
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
215
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
214
216
|
def doc(elt):
|
|
215
217
|
"Show `show_doc` info along with link to docs"
|
|
216
218
|
BasicHtmlRenderer(elt).doc()
|
|
217
219
|
|
|
218
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
220
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
219
221
|
def showdoc_nm(tree):
|
|
220
222
|
"Get the fully qualified name for showdoc."
|
|
221
223
|
return ifnone(patch_name(tree), tree.name)
|
|
222
224
|
|
|
223
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
225
|
+
# %% ../nbs/api/08_showdoc.ipynb
|
|
224
226
|
def colab_link(path):
|
|
225
227
|
"Get a link to the notebook at `path` on Colab"
|
|
226
228
|
from IPython.display import Markdown
|
nbdev/sync.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"""Propagate small changes in the library back to notebooks"""
|
|
2
|
+
|
|
1
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/06_sync.ipynb.
|
|
2
4
|
|
|
3
5
|
# %% auto 0
|
|
4
6
|
__all__ = ['absolute_import', 'nbdev_update']
|
|
5
7
|
|
|
6
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
8
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
7
9
|
from .imports import *
|
|
8
10
|
from .config import *
|
|
9
11
|
from .maker import *
|
|
@@ -19,7 +21,7 @@ from fastcore.xtras import *
|
|
|
19
21
|
import ast
|
|
20
22
|
from importlib import import_module
|
|
21
23
|
|
|
22
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
24
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
23
25
|
def absolute_import(name, fname, level):
|
|
24
26
|
"Unwarps a relative import in `name` according to `fname`"
|
|
25
27
|
if not level: return name
|
|
@@ -27,22 +29,22 @@ def absolute_import(name, fname, level):
|
|
|
27
29
|
if not name: return '.'.join(mods)
|
|
28
30
|
return '.'.join(mods[:len(mods)-level+1]) + f".{name}"
|
|
29
31
|
|
|
30
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
32
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
31
33
|
@functools.lru_cache(maxsize=None)
|
|
32
34
|
def _mod_files():
|
|
33
35
|
midx = import_module(f'{get_config().lib_path.name}._modidx')
|
|
34
36
|
return L(files for mod in midx.d['syms'].values() for _,files in mod.values()).unique()
|
|
35
37
|
|
|
36
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
38
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
37
39
|
_re_import = re.compile(r"from\s+\S+\s+import\s+\S")
|
|
38
40
|
|
|
39
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
41
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
40
42
|
def _to_absolute(code, py_path, lib_dir):
|
|
41
43
|
if not _re_import.search(code): return code
|
|
42
44
|
res = update_import(code, ast.parse(code).body, str(py_path.relative_to(lib_dir).parent), absolute_import)
|
|
43
45
|
return ''.join(res) if res else code
|
|
44
46
|
|
|
45
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
47
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
46
48
|
def _update_nb(nb_path, cells, lib_dir):
|
|
47
49
|
"Update notebook `nb_path` with contents from `cells`"
|
|
48
50
|
nbp = NBProcessor(nb_path, ExportModuleProc(), rm_directives=False)
|
|
@@ -54,13 +56,13 @@ def _update_nb(nb_path, cells, lib_dir):
|
|
|
54
56
|
nbcell.source = ''.join(dirs) + _to_absolute(cell.code, cell.py_path, lib_dir)
|
|
55
57
|
write_nb(nbp.nb, nb_path)
|
|
56
58
|
|
|
57
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
59
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
58
60
|
def _update_mod(py_path, lib_dir):
|
|
59
61
|
"Propagate changes from cells in module `py_path` to corresponding notebooks"
|
|
60
62
|
py_cells = L(_iter_py_cells(py_path)).filter(lambda o: o.nb != 'auto')
|
|
61
63
|
for nb_path,cells in groupby(py_cells, 'nb_path').items(): _update_nb(nb_path, cells, lib_dir)
|
|
62
64
|
|
|
63
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
65
|
+
# %% ../nbs/api/06_sync.ipynb
|
|
64
66
|
@call_parse
|
|
65
67
|
def nbdev_update(fname:str=None): # A Python file name to update
|
|
66
68
|
"Propagate change in modules matching `fname` to notebooks that created them"
|
nbdev/test.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"""Run unit tests on notebooks in parallel"""
|
|
2
|
+
|
|
1
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/12_test.ipynb.
|
|
2
4
|
|
|
3
5
|
# %% auto 0
|
|
4
6
|
__all__ = ['test_nb', 'nbdev_test']
|
|
5
7
|
|
|
6
|
-
# %% ../nbs/api/12_test.ipynb
|
|
8
|
+
# %% ../nbs/api/12_test.ipynb
|
|
7
9
|
import time,os,sys,traceback,contextlib, inspect
|
|
8
10
|
from fastcore.basics import *
|
|
9
11
|
from fastcore.imports import *
|
|
@@ -20,7 +22,7 @@ from .frontmatter import FrontmatterProc
|
|
|
20
22
|
from execnb.nbio import *
|
|
21
23
|
from execnb.shell import *
|
|
22
24
|
|
|
23
|
-
# %% ../nbs/api/12_test.ipynb
|
|
25
|
+
# %% ../nbs/api/12_test.ipynb
|
|
24
26
|
def test_nb(fn, # file name of notebook to test
|
|
25
27
|
skip_flags=None, # list of flags marking cells to skip
|
|
26
28
|
force_flags=None, # list of flags marking cells to always run
|
|
@@ -55,7 +57,7 @@ def test_nb(fn, # file name of notebook to test
|
|
|
55
57
|
if do_print: print(f'- Completed {fn}')
|
|
56
58
|
return res,time.time()-start
|
|
57
59
|
|
|
58
|
-
# %% ../nbs/api/12_test.ipynb
|
|
60
|
+
# %% ../nbs/api/12_test.ipynb
|
|
59
61
|
def _keep_file(p:Path, # filename for which to check for `indicator_fname`
|
|
60
62
|
ignore_fname:str # filename that will result in siblings being ignored
|
|
61
63
|
) -> bool:
|
|
@@ -63,7 +65,7 @@ def _keep_file(p:Path, # filename for which to check for `indicator_fname`
|
|
|
63
65
|
if p.exists(): return not bool(p.parent.ls().attrgot('name').filter(lambda x: x == ignore_fname))
|
|
64
66
|
else: True
|
|
65
67
|
|
|
66
|
-
# %% ../nbs/api/12_test.ipynb
|
|
68
|
+
# %% ../nbs/api/12_test.ipynb
|
|
67
69
|
@call_parse
|
|
68
70
|
@delegates(nbglob_cli)
|
|
69
71
|
def nbdev_test(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nbdev
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.29
|
|
4
4
|
Summary: Create delightful software with Jupyter Notebooks
|
|
5
5
|
Home-page: https://github.com/fastai/nbdev
|
|
6
6
|
Author: Jeremy Howard and Hamel Husain
|
|
@@ -15,7 +15,8 @@ Classifier: Programming Language :: Python :: 3.7
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.8
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
20
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
20
21
|
Requires-Python: >=3.7
|
|
21
22
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
nbdev/__init__.py,sha256=V0AkJoHiqkyoyngP3lLqQY3LjIUxTN1xBVL2pvMmm48,90
|
|
2
|
+
nbdev/_modidx.py,sha256=Pa-Ve3zq0R4qkykuda25oQ5Jw0YXa5u0ds6QK_siSmk,40577
|
|
3
|
+
nbdev/clean.py,sha256=mVgsW2_g7KIXAVh8mwpj86UwMN6QVM-q33PDzA27nWw,9410
|
|
4
|
+
nbdev/cli.py,sha256=qGNwsrskbVazzyKDpTjwQsQcwEqAZBlFTlehHswasHs,5608
|
|
5
|
+
nbdev/config.py,sha256=s2H8IYB6Fv3Pe7hZjC10TtF5OM_SvDM-TEHNwcTD4xs,12163
|
|
6
|
+
nbdev/doclinks.py,sha256=t6tbISN4R-WyDCmXJeGjYadpc5kBGQnAIxBEsWw3kBw,10490
|
|
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=_tqCPskcfR9-DpBrcAgueLux8acdz3B9t6gQqKuMYLc,11858
|
|
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.29.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
25
|
+
nbdev-2.3.29.dist-info/METADATA,sha256=F-eXE1W3BJB_BdC-rNuc08fKiPNcsjl9Lxc-NxP_8Qw,10398
|
|
26
|
+
nbdev-2.3.29.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
27
|
+
nbdev-2.3.29.dist-info/entry_points.txt,sha256=GMherdbuc27OmIuaaom4eNx5sTdCvAdNrZA6XLEZOA8,1326
|
|
28
|
+
nbdev-2.3.29.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
29
|
+
nbdev-2.3.29.dist-info/RECORD,,
|
nbdev-2.3.27.dist-info/RECORD
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
nbdev/__init__.py,sha256=OUd4jv5-2fmcS5hhF6s7pflP4AwA1ORVTI7quBcuPFo,90
|
|
2
|
-
nbdev/_modidx.py,sha256=cfvhKryWwys106hchXzhcUqC37lQHHAKJKk6vrUiRAs,40317
|
|
3
|
-
nbdev/clean.py,sha256=RLhM4-joJNpxauTy33HYb3gaUHaKtCOaWfrKWec5Zd4,9403
|
|
4
|
-
nbdev/cli.py,sha256=OAEdAqGdgHbUFYjHmn8ZmFNbBCxJjwvtDwgYatjmh1U,5639
|
|
5
|
-
nbdev/config.py,sha256=CdaimA7eSdWHYYw7q07QA5j4q_pzMyOhG0BRHw3D2Qk,12387
|
|
6
|
-
nbdev/doclinks.py,sha256=zqhEyOXFBfGNZ6HSIQihwofoLzxjgGqzikaBI-EnSc4,10475
|
|
7
|
-
nbdev/export.py,sha256=LEhn7UpfMSm9QKrC31q91Bsw-ZHd68DNv7MjhsNi15A,3275
|
|
8
|
-
nbdev/extract_attachments.py,sha256=O4mS4EFIOXL_yQ3jmsnBStrWxGR_nPNvxLYXHtLeimw,2208
|
|
9
|
-
nbdev/frontmatter.py,sha256=L9XbOPA99XuHSWU6eJfRIR4mBU4-NhDIQSP80EIk51g,2708
|
|
10
|
-
nbdev/imports.py,sha256=f5Ynco14hsJyFCf43-uP_YARMhHADe6lM-20Mc_vXhw,95
|
|
11
|
-
nbdev/maker.py,sha256=Q8K3lFMcLIxJ1OptGQcD6mjSSFz_UZwPKE6JIvKfnhQ,9767
|
|
12
|
-
nbdev/merge.py,sha256=QrP8tdlPRfZZ-TH5dTRwj9jXr7jWEsrLwgcIVPSHJSs,4319
|
|
13
|
-
nbdev/migrate.py,sha256=l2hO2Ymkjm1C3_JmFDsM-DN6bxgFeLjj-pBr1xNqunI,7317
|
|
14
|
-
nbdev/process.py,sha256=7dl9U7JLL9wbJta-KKTTnkMktBVsK5s-y8OBxtfk68I,5863
|
|
15
|
-
nbdev/processors.py,sha256=O5r2gXOCQlHI6aX0UFl_4PdaYV0fKPy6joYov_T7V88,11492
|
|
16
|
-
nbdev/qmd.py,sha256=3Cskd8ynm25Hh7bo-_t0hxCMF6jqXxgq_VfkpLBKu_w,2958
|
|
17
|
-
nbdev/quarto.py,sha256=SYqJyElI6KMP4g16fZ87SmhK7NTYdnDIi1f1Y4GKO1I,12020
|
|
18
|
-
nbdev/release.py,sha256=6lwSBn9HkTNSl9jWIkYcKdBtWGo-LWl3YBjhQREuI2k,14167
|
|
19
|
-
nbdev/serve.py,sha256=8q2qa82-osuIOpQamJ13Q_WEnnVZycxb8Vj467PGias,3020
|
|
20
|
-
nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
|
|
21
|
-
nbdev/showdoc.py,sha256=ZyT1HX9IXNl1hXRzzQ6XYu3NK6yLgPweatiItQbulbk,9151
|
|
22
|
-
nbdev/sync.py,sha256=BsdWf-1rw1WIPszL3Sw93U3Q5El2A-_9VnQz9_iP5Cw,3044
|
|
23
|
-
nbdev/test.py,sha256=74db-sK_rnc69Q3beztibXDSZUeOk6M9nIiIORLHzlo,4397
|
|
24
|
-
nbdev-2.3.27.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
25
|
-
nbdev-2.3.27.dist-info/METADATA,sha256=9qbtdGzl_VFCQFbnP8XZnP_rD1YK-jn8iIcYYYJNemE,10347
|
|
26
|
-
nbdev-2.3.27.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
27
|
-
nbdev-2.3.27.dist-info/entry_points.txt,sha256=GMherdbuc27OmIuaaom4eNx5sTdCvAdNrZA6XLEZOA8,1326
|
|
28
|
-
nbdev-2.3.27.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
29
|
-
nbdev-2.3.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|