nbdev 2.4.8__py3-none-any.whl → 2.4.11__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 +1 -7
- nbdev/clean.py +22 -19
- nbdev/cli.py +15 -16
- nbdev/config.py +29 -28
- nbdev/diff.py +9 -9
- nbdev/doclinks.py +29 -31
- nbdev/export.py +7 -7
- nbdev/frontmatter.py +4 -4
- nbdev/maker.py +22 -22
- nbdev/merge.py +10 -10
- nbdev/migrate.py +18 -18
- nbdev/process.py +15 -15
- nbdev/processors.py +26 -26
- nbdev/qmd.py +9 -9
- nbdev/quarto.py +27 -27
- nbdev/release.py +29 -29
- nbdev/serve.py +5 -5
- nbdev/showdoc.py +9 -55
- nbdev/sync.py +14 -11
- nbdev/test.py +5 -5
- {nbdev-2.4.8.dist-info → nbdev-2.4.11.dist-info}/METADATA +3 -2
- nbdev-2.4.11.dist-info/RECORD +30 -0
- nbdev-2.4.8.dist-info/RECORD +0 -30
- {nbdev-2.4.8.dist-info → nbdev-2.4.11.dist-info}/WHEEL +0 -0
- {nbdev-2.4.8.dist-info → nbdev-2.4.11.dist-info}/entry_points.txt +0 -0
- {nbdev-2.4.8.dist-info → nbdev-2.4.11.dist-info}/licenses/LICENSE +0 -0
- {nbdev-2.4.8.dist-info → nbdev-2.4.11.dist-info}/top_level.txt +0 -0
nbdev/release.py
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/18_release.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% auto 0
|
|
5
|
+
# %% auto #0
|
|
6
6
|
__all__ = ['GH_HOST', 'CONDA_WARNING', 'Release', 'changelog', 'release_git', 'release_gh', 'pypi_json', 'latest_pypi',
|
|
7
7
|
'pypi_details', 'conda_output_path', 'write_conda_meta', 'write_requirements', 'anaconda_upload',
|
|
8
8
|
'release_conda', 'chk_conda_rel', 'release_pypi', 'release_both', 'bump_version', 'nbdev_bump_version']
|
|
9
9
|
|
|
10
|
-
# %% ../nbs/api/18_release.ipynb
|
|
10
|
+
# %% ../nbs/api/18_release.ipynb #c35cc2b8
|
|
11
11
|
from fastcore.all import *
|
|
12
12
|
from ghapi.core import *
|
|
13
13
|
|
|
@@ -17,16 +17,16 @@ import shutil,subprocess
|
|
|
17
17
|
|
|
18
18
|
from .doclinks import *
|
|
19
19
|
|
|
20
|
-
# %% ../nbs/api/18_release.ipynb
|
|
20
|
+
# %% ../nbs/api/18_release.ipynb #7e554523
|
|
21
21
|
GH_HOST = "https://api.github.com"
|
|
22
22
|
|
|
23
|
-
# %% ../nbs/api/18_release.ipynb
|
|
23
|
+
# %% ../nbs/api/18_release.ipynb #e220cefa
|
|
24
24
|
def _find_config(cfg_name="settings.ini"):
|
|
25
25
|
cfg_path = Path().absolute()
|
|
26
26
|
while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent
|
|
27
27
|
return Config(cfg_path, cfg_name)
|
|
28
28
|
|
|
29
|
-
# %% ../nbs/api/18_release.ipynb
|
|
29
|
+
# %% ../nbs/api/18_release.ipynb #1972609a
|
|
30
30
|
def _issue_txt(issue):
|
|
31
31
|
res = '- {} ([#{}]({}))'.format(issue.title.strip(), issue.number, issue.html_url)
|
|
32
32
|
if hasattr(issue, 'pull_request'): res += ', thanks to [@{}]({})'.format(issue.user.login, issue.user.html_url)
|
|
@@ -43,7 +43,7 @@ def _load_json(cfg, k):
|
|
|
43
43
|
try: return json.loads(cfg[k])
|
|
44
44
|
except json.JSONDecodeError as e: raise Exception(f"Key: `{k}` in .ini file is not a valid JSON string: {e}")
|
|
45
45
|
|
|
46
|
-
# %% ../nbs/api/18_release.ipynb
|
|
46
|
+
# %% ../nbs/api/18_release.ipynb #0b36471a
|
|
47
47
|
class Release:
|
|
48
48
|
def __init__(self, owner=None, repo=None, token=None, **groups):
|
|
49
49
|
"Create CHANGELOG.md from GitHub issues"
|
|
@@ -65,7 +65,7 @@ class Release:
|
|
|
65
65
|
return self.gh.issues.list_for_repo(state='closed', sort='created', filter='all', since=self.commit_date, labels=label)
|
|
66
66
|
def _issue_groups(self): return parallel(self._issues, self.groups.keys(), progress=False, threadpool=True)
|
|
67
67
|
|
|
68
|
-
# %% ../nbs/api/18_release.ipynb
|
|
68
|
+
# %% ../nbs/api/18_release.ipynb #aa22dfe3
|
|
69
69
|
@patch
|
|
70
70
|
def changelog(self:Release,
|
|
71
71
|
debug=False): # Just print the latest changes, instead of updating file
|
|
@@ -86,7 +86,7 @@ def changelog(self:Release,
|
|
|
86
86
|
self.changefile.write_text(res)
|
|
87
87
|
run(f'git add {self.changefile}')
|
|
88
88
|
|
|
89
|
-
# %% ../nbs/api/18_release.ipynb
|
|
89
|
+
# %% ../nbs/api/18_release.ipynb #068421c6
|
|
90
90
|
@patch
|
|
91
91
|
def release(self:Release):
|
|
92
92
|
"Tag and create a release in GitHub for the current version"
|
|
@@ -95,7 +95,7 @@ def release(self:Release):
|
|
|
95
95
|
self.gh.create_release(ver, branch=self.cfg.branch, body=notes)
|
|
96
96
|
return ver
|
|
97
97
|
|
|
98
|
-
# %% ../nbs/api/18_release.ipynb
|
|
98
|
+
# %% ../nbs/api/18_release.ipynb #22101171
|
|
99
99
|
@patch
|
|
100
100
|
def latest_notes(self:Release):
|
|
101
101
|
"Latest CHANGELOG entry"
|
|
@@ -104,7 +104,7 @@ def latest_notes(self:Release):
|
|
|
104
104
|
if not len(its)>0: return ''
|
|
105
105
|
return '\n'.join(its[1].splitlines()[1:]).strip()
|
|
106
106
|
|
|
107
|
-
# %% ../nbs/api/18_release.ipynb
|
|
107
|
+
# %% ../nbs/api/18_release.ipynb #01cb1ca4
|
|
108
108
|
@call_parse
|
|
109
109
|
def changelog(
|
|
110
110
|
debug:store_true=False, # Print info to be added to CHANGELOG, instead of updating file
|
|
@@ -114,7 +114,7 @@ def changelog(
|
|
|
114
114
|
res = Release(repo=repo).changelog(debug=debug)
|
|
115
115
|
if debug: print(res)
|
|
116
116
|
|
|
117
|
-
# %% ../nbs/api/18_release.ipynb
|
|
117
|
+
# %% ../nbs/api/18_release.ipynb #6d3c5cd8
|
|
118
118
|
@call_parse
|
|
119
119
|
def release_git(
|
|
120
120
|
token:str=None # Optional GitHub token (otherwise `token` file is used)
|
|
@@ -123,7 +123,7 @@ def release_git(
|
|
|
123
123
|
ver = Release(token=token).release()
|
|
124
124
|
print(f"Released {ver}")
|
|
125
125
|
|
|
126
|
-
# %% ../nbs/api/18_release.ipynb
|
|
126
|
+
# %% ../nbs/api/18_release.ipynb #ad73518a
|
|
127
127
|
@call_parse
|
|
128
128
|
def release_gh(
|
|
129
129
|
token:str=None # Optional GitHub token (otherwise `token` file is used)
|
|
@@ -138,7 +138,7 @@ def release_gh(
|
|
|
138
138
|
ver = Release(token=token).release()
|
|
139
139
|
print(f"Released {ver}")
|
|
140
140
|
|
|
141
|
-
# %% ../nbs/api/18_release.ipynb
|
|
141
|
+
# %% ../nbs/api/18_release.ipynb #5b4d4aa2
|
|
142
142
|
from fastcore.all import *
|
|
143
143
|
from .config import *
|
|
144
144
|
from .cli import *
|
|
@@ -150,18 +150,18 @@ except ImportError: from pip._vendor.packaging.version import parse
|
|
|
150
150
|
|
|
151
151
|
_PYPI_URL = 'https://pypi.org/pypi/'
|
|
152
152
|
|
|
153
|
-
# %% ../nbs/api/18_release.ipynb
|
|
153
|
+
# %% ../nbs/api/18_release.ipynb #4070bbef
|
|
154
154
|
def pypi_json(s):
|
|
155
155
|
"Dictionary decoded JSON for PYPI path `s`"
|
|
156
156
|
return urljson(f'{_PYPI_URL}{s}/json')
|
|
157
157
|
|
|
158
|
-
# %% ../nbs/api/18_release.ipynb
|
|
158
|
+
# %% ../nbs/api/18_release.ipynb #1985c8b1
|
|
159
159
|
def latest_pypi(name):
|
|
160
160
|
"Latest version of `name` on pypi"
|
|
161
161
|
return max(parse(r) for r,o in pypi_json(name)['releases'].items()
|
|
162
162
|
if not parse(r).is_prerelease and not nested_idx(o, 0, 'yanked'))
|
|
163
163
|
|
|
164
|
-
# %% ../nbs/api/18_release.ipynb
|
|
164
|
+
# %% ../nbs/api/18_release.ipynb #ab0bfd9a
|
|
165
165
|
def pypi_details(name):
|
|
166
166
|
"Version, URL, and SHA256 for `name` from pypi"
|
|
167
167
|
ver = str(latest_pypi(name))
|
|
@@ -169,7 +169,7 @@ def pypi_details(name):
|
|
|
169
169
|
rel = [o for o in pypi['urls'] if o['packagetype']=='sdist'][0]
|
|
170
170
|
return ver,rel['url'],rel['digests']['sha256']
|
|
171
171
|
|
|
172
|
-
# %% ../nbs/api/18_release.ipynb
|
|
172
|
+
# %% ../nbs/api/18_release.ipynb #431f625b
|
|
173
173
|
import shlex
|
|
174
174
|
from subprocess import Popen, PIPE, CalledProcessError
|
|
175
175
|
|
|
@@ -183,12 +183,12 @@ def _run(cmd):
|
|
|
183
183
|
if p.returncode != 0: raise CalledProcessError(p.returncode, p.args)
|
|
184
184
|
return res
|
|
185
185
|
|
|
186
|
-
# %% ../nbs/api/18_release.ipynb
|
|
186
|
+
# %% ../nbs/api/18_release.ipynb #6a9d34ab
|
|
187
187
|
def conda_output_path(name, build='build'):
|
|
188
188
|
"Output path for conda build"
|
|
189
189
|
return run(f'conda {build} --output {name}').strip().replace('\\', '/')
|
|
190
190
|
|
|
191
|
-
# %% ../nbs/api/18_release.ipynb
|
|
191
|
+
# %% ../nbs/api/18_release.ipynb #99fb71c2
|
|
192
192
|
def _write_yaml(path, name, d1, d2):
|
|
193
193
|
path = Path(path)
|
|
194
194
|
p = path/name
|
|
@@ -198,7 +198,7 @@ def _write_yaml(path, name, d1, d2):
|
|
|
198
198
|
yaml.safe_dump(d1, f)
|
|
199
199
|
yaml.safe_dump(d2, f)
|
|
200
200
|
|
|
201
|
-
# %% ../nbs/api/18_release.ipynb
|
|
201
|
+
# %% ../nbs/api/18_release.ipynb #5c78f115
|
|
202
202
|
def _get_conda_meta():
|
|
203
203
|
cfg = get_config()
|
|
204
204
|
name,ver = cfg.lib_name,cfg.version
|
|
@@ -240,12 +240,12 @@ def _get_conda_meta():
|
|
|
240
240
|
}
|
|
241
241
|
return name,d1,d2
|
|
242
242
|
|
|
243
|
-
# %% ../nbs/api/18_release.ipynb
|
|
243
|
+
# %% ../nbs/api/18_release.ipynb #b911bd4d
|
|
244
244
|
def write_conda_meta(path='conda'):
|
|
245
245
|
"Writes a `meta.yaml` file to the `conda` directory of the current directory"
|
|
246
246
|
_write_yaml(path, *_get_conda_meta())
|
|
247
247
|
|
|
248
|
-
# %% ../nbs/api/18_release.ipynb
|
|
248
|
+
# %% ../nbs/api/18_release.ipynb #7550557f
|
|
249
249
|
@call_parse
|
|
250
250
|
def write_requirements(path:str=''):
|
|
251
251
|
"Writes a `requirements.txt` file to `directory` based on settings.ini."
|
|
@@ -254,7 +254,7 @@ def write_requirements(path:str=''):
|
|
|
254
254
|
req = '\n'.join([cfg.get(k, '').replace(' ', '\n') for k in ['requirements', 'pip_requirements']])
|
|
255
255
|
(d/'requirements.txt').mk_write(req)
|
|
256
256
|
|
|
257
|
-
# %% ../nbs/api/18_release.ipynb
|
|
257
|
+
# %% ../nbs/api/18_release.ipynb #715ae3ac
|
|
258
258
|
CONDA_WARNING='Conda support for nbdev is deprecated and scheduled for removal in a future version.'
|
|
259
259
|
|
|
260
260
|
def anaconda_upload(name, loc=None, user=None, token=None, env_token=None):
|
|
@@ -267,7 +267,7 @@ def anaconda_upload(name, loc=None, user=None, token=None, env_token=None):
|
|
|
267
267
|
if not loc: raise Exception("Failed to find output")
|
|
268
268
|
return _run(f'anaconda {token} upload {user} {loc} --skip-existing')
|
|
269
269
|
|
|
270
|
-
# %% ../nbs/api/18_release.ipynb
|
|
270
|
+
# %% ../nbs/api/18_release.ipynb #952bc33d
|
|
271
271
|
@call_parse
|
|
272
272
|
def release_conda(
|
|
273
273
|
path:str='conda', # Path where package will be created
|
|
@@ -299,7 +299,7 @@ def release_conda(
|
|
|
299
299
|
if 'anaconda upload' not in res: return print(f"{res}\n\nFailed. Check auto-upload not set in .condarc. Try `--do_build False`.")
|
|
300
300
|
return anaconda_upload(name, loc)
|
|
301
301
|
|
|
302
|
-
# %% ../nbs/api/18_release.ipynb
|
|
302
|
+
# %% ../nbs/api/18_release.ipynb #0500d972
|
|
303
303
|
def chk_conda_rel(
|
|
304
304
|
nm:str, # Package name on pypi
|
|
305
305
|
apkg:str=None, # Anaconda Package (defaults to {nm})
|
|
@@ -313,7 +313,7 @@ def chk_conda_rel(
|
|
|
313
313
|
pypitag = latest_pypi(nm)
|
|
314
314
|
if force or not condatag or pypitag > max(condatag): return f'{pypitag}'
|
|
315
315
|
|
|
316
|
-
# %% ../nbs/api/18_release.ipynb
|
|
316
|
+
# %% ../nbs/api/18_release.ipynb #bf55df9b
|
|
317
317
|
@call_parse
|
|
318
318
|
def release_pypi(
|
|
319
319
|
repository:str="pypi" # Respository to upload to (defined in ~/.pypirc)
|
|
@@ -323,7 +323,7 @@ def release_pypi(
|
|
|
323
323
|
system(f'cd {_dir} && rm -rf dist build && python -m build')
|
|
324
324
|
system(f'twine upload --repository {repository} {_dir}/dist/*')
|
|
325
325
|
|
|
326
|
-
# %% ../nbs/api/18_release.ipynb
|
|
326
|
+
# %% ../nbs/api/18_release.ipynb #06edfcb0
|
|
327
327
|
@call_parse
|
|
328
328
|
def release_both(
|
|
329
329
|
path:str='conda', # Path where package will be created
|
|
@@ -339,7 +339,7 @@ def release_both(
|
|
|
339
339
|
release_conda.__wrapped__(path, do_build=do_build, build_args=build_args, skip_upload=skip_upload, mambabuild=mambabuild, upload_user=upload_user)
|
|
340
340
|
nbdev_bump_version.__wrapped__()
|
|
341
341
|
|
|
342
|
-
# %% ../nbs/api/18_release.ipynb
|
|
342
|
+
# %% ../nbs/api/18_release.ipynb #6380dd5a
|
|
343
343
|
def bump_version(version, part=2, unbump=False):
|
|
344
344
|
version = version.split('.')
|
|
345
345
|
incr = -1 if unbump else 1
|
|
@@ -347,7 +347,7 @@ def bump_version(version, part=2, unbump=False):
|
|
|
347
347
|
for i in range(part+1, 3): version[i] = '0'
|
|
348
348
|
return '.'.join(version)
|
|
349
349
|
|
|
350
|
-
# %% ../nbs/api/18_release.ipynb
|
|
350
|
+
# %% ../nbs/api/18_release.ipynb #c0f64b2c
|
|
351
351
|
@call_parse
|
|
352
352
|
def nbdev_bump_version(
|
|
353
353
|
part:int=2, # Part of version to bump
|
nbdev/serve.py
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/17_serve.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% auto 0
|
|
5
|
+
# %% auto #0
|
|
6
6
|
__all__ = ['proc_nbs']
|
|
7
7
|
|
|
8
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
8
|
+
# %% ../nbs/api/17_serve.ipynb #6899a335
|
|
9
9
|
import ast,subprocess,threading,sys
|
|
10
10
|
from shutil import rmtree,copy2
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ from .doclinks import nbglob_cli,nbglob
|
|
|
19
19
|
from .processors import FilterDefaults
|
|
20
20
|
import nbdev.serve_drv
|
|
21
21
|
|
|
22
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
22
|
+
# %% ../nbs/api/17_serve.ipynb #65766a33
|
|
23
23
|
def _is_qpy(path:Path):
|
|
24
24
|
"Is `path` a py script starting with frontmatter?"
|
|
25
25
|
path = Path(path)
|
|
@@ -34,7 +34,7 @@ def _is_qpy(path:Path):
|
|
|
34
34
|
vl = v.splitlines()
|
|
35
35
|
if vl[0]=='---' and vl[-1]=='---': return '\n'.join(vl[1:-1])
|
|
36
36
|
|
|
37
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
37
|
+
# %% ../nbs/api/17_serve.ipynb #abc3835a
|
|
38
38
|
def _proc_file(s, cache, path, mtime=None):
|
|
39
39
|
skips = ('_proc', '_docs', '_site', 'settings.ini')
|
|
40
40
|
if not s.is_file() or any(o[0]=='.' or o in skips for o in s.parts): return
|
|
@@ -51,7 +51,7 @@ def _proc_file(s, cache, path, mtime=None):
|
|
|
51
51
|
if md is not None: return s,d,md.strip()
|
|
52
52
|
else: copy2(s,d)
|
|
53
53
|
|
|
54
|
-
# %% ../nbs/api/17_serve.ipynb
|
|
54
|
+
# %% ../nbs/api/17_serve.ipynb #14463227
|
|
55
55
|
@delegates(nbglob_cli)
|
|
56
56
|
def proc_nbs(
|
|
57
57
|
path:str='', # Path to notebooks
|
nbdev/showdoc.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/08_showdoc.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
5
|
+
# %% ../nbs/api/08_showdoc.ipynb #7f371f15
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
from .doclinks import *
|
|
8
8
|
from .config import get_config
|
|
@@ -16,10 +16,10 @@ from collections import OrderedDict
|
|
|
16
16
|
from textwrap import fill
|
|
17
17
|
from types import FunctionType
|
|
18
18
|
|
|
19
|
-
# %% auto 0
|
|
20
|
-
__all__ = ['BasicMarkdownRenderer', 'show_doc', '
|
|
19
|
+
# %% auto #0
|
|
20
|
+
__all__ = ['BasicMarkdownRenderer', 'show_doc', 'doc', 'showdoc_nm', 'colab_link']
|
|
21
21
|
|
|
22
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
22
|
+
# %% ../nbs/api/08_showdoc.ipynb #abe98f5c
|
|
23
23
|
def _ext_link(url, txt, xtra=""): return f'[{txt}]({url}){{target="_blank" {xtra}}}'
|
|
24
24
|
|
|
25
25
|
class BasicMarkdownRenderer(MarkdownRenderer):
|
|
@@ -32,7 +32,7 @@ class BasicMarkdownRenderer(MarkdownRenderer):
|
|
|
32
32
|
doc += f'{h} {self.nm}\n\n'
|
|
33
33
|
return doc+super()._repr_markdown_()
|
|
34
34
|
|
|
35
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
35
|
+
# %% ../nbs/api/08_showdoc.ipynb #1256ef79
|
|
36
36
|
def show_doc(sym, # Symbol to document
|
|
37
37
|
renderer=None, # Optional renderer (defaults to markdown)
|
|
38
38
|
name:str|None=None, # Optionally override displayed name of `sym`
|
|
@@ -47,63 +47,17 @@ def show_doc(sym, # Symbol to document
|
|
|
47
47
|
elif isinstance_str(sym, "TypeDispatch"): pass # use _str as TypeDispatch will be removed from fastcore
|
|
48
48
|
else:return renderer(sym or show_doc, name=name, title_level=title_level)
|
|
49
49
|
|
|
50
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
51
|
-
def _create_html_table(table_str):
|
|
52
|
-
def split_row(row):
|
|
53
|
-
return re.findall(r'\|(?:(?:\\.|[^|\\])*)', row)
|
|
54
|
-
|
|
55
|
-
def unescape_cell(cell):
|
|
56
|
-
return cell.strip(' *|').replace(r'\|', '|')
|
|
57
|
-
|
|
58
|
-
lines = table_str.strip().split('\n')
|
|
59
|
-
header = [f"<th>{unescape_cell(cell)}</th>" for cell in split_row(lines[0])]
|
|
60
|
-
rows = [[f"<td>{unescape_cell(cell)}</td>" for cell in split_row(line)] for line in lines[2:]]
|
|
61
|
-
|
|
62
|
-
return f'''<table>
|
|
63
|
-
<thead><tr>{' '.join(header)}</tr></thead>
|
|
64
|
-
<tbody>{''.join(f'<tr>{" ".join(row)}</tr>' for row in rows)}</tbody>
|
|
65
|
-
</table>'''
|
|
66
|
-
|
|
67
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
68
|
-
def _html_link(url, txt): return f'<a href="{url}" target="_blank" rel="noreferrer noopener">{txt}</a>'
|
|
69
|
-
|
|
70
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
71
|
-
from fastcore.docments import _fmt_sig
|
|
72
|
-
|
|
73
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
74
|
-
class BasicHtmlRenderer(ShowDocRenderer):
|
|
75
|
-
"HTML renderer for `show_doc`"
|
|
76
|
-
def _repr_html_(self):
|
|
77
|
-
doc = '<hr/>\n'
|
|
78
|
-
src = NbdevLookup().code(self.fn)
|
|
79
|
-
doc += f'<h{self.title_level}>{self.nm}</h{self.title_level}>\n'
|
|
80
|
-
sig = _fmt_sig(self.sig) if self.sig else ''
|
|
81
|
-
# Escape < and > characters in the signature
|
|
82
|
-
sig = sig.replace('<', '<').replace('>', '>')
|
|
83
|
-
doc += f'<blockquote><pre><code>{self.nm} {sig}</code></pre></blockquote>'
|
|
84
|
-
if self.docs:
|
|
85
|
-
doc += f"<p><i>{self.docs}</i></p>"
|
|
86
|
-
if src: doc += f"<br/>{_html_link(src, 'source')}"
|
|
87
|
-
if self.dm.has_docment: doc += _create_html_table(str(self.dm))
|
|
88
|
-
return doc
|
|
89
|
-
|
|
90
|
-
def doc(self):
|
|
91
|
-
"Show `show_doc` info along with link to docs"
|
|
92
|
-
from IPython.display import display,HTML
|
|
93
|
-
res = self._repr_html_()
|
|
94
|
-
display(HTML(res))
|
|
95
|
-
|
|
96
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
50
|
+
# %% ../nbs/api/08_showdoc.ipynb #eb1f0530
|
|
97
51
|
def doc(elt):
|
|
98
52
|
"Show `show_doc` info along with link to docs"
|
|
99
|
-
|
|
53
|
+
return BasicMarkdownRenderer(elt)
|
|
100
54
|
|
|
101
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
55
|
+
# %% ../nbs/api/08_showdoc.ipynb #35043aa7-6b60-4ddf-8949-39a78577f23d
|
|
102
56
|
def showdoc_nm(tree):
|
|
103
57
|
"Get the fully qualified name for showdoc."
|
|
104
58
|
return ifnone(patch_name(tree), tree.name)
|
|
105
59
|
|
|
106
|
-
# %% ../nbs/api/08_showdoc.ipynb
|
|
60
|
+
# %% ../nbs/api/08_showdoc.ipynb #e947414d
|
|
107
61
|
def colab_link(path):
|
|
108
62
|
"Get a link to the notebook at `path` on Colab"
|
|
109
63
|
from IPython.display import Markdown
|
nbdev/sync.py
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/06_sync.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% auto 0
|
|
5
|
+
# %% auto #0
|
|
6
6
|
__all__ = ['absolute_import', 'nbdev_update']
|
|
7
7
|
|
|
8
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
8
|
+
# %% ../nbs/api/06_sync.ipynb #ea6a935c
|
|
9
9
|
from .imports import *
|
|
10
10
|
from .config import *
|
|
11
11
|
from .maker import *
|
|
@@ -21,7 +21,7 @@ from fastcore.xtras import *
|
|
|
21
21
|
import ast
|
|
22
22
|
import importlib
|
|
23
23
|
|
|
24
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
24
|
+
# %% ../nbs/api/06_sync.ipynb #fde5667d
|
|
25
25
|
def absolute_import(name, fname, level):
|
|
26
26
|
"Unwarps a relative import in `name` according to `fname`"
|
|
27
27
|
if not level: return name
|
|
@@ -29,7 +29,7 @@ def absolute_import(name, fname, level):
|
|
|
29
29
|
if not name: return '.'.join(mods)
|
|
30
30
|
return '.'.join(mods[:len(mods)-level+1]) + f".{name}"
|
|
31
31
|
|
|
32
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
32
|
+
# %% ../nbs/api/06_sync.ipynb #54ab1e17
|
|
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")
|
|
@@ -38,41 +38,44 @@ def _mod_files():
|
|
|
38
38
|
|
|
39
39
|
return L(files for mod in midx.d['syms'].values() for _,files in mod.values()).unique()
|
|
40
40
|
|
|
41
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
41
|
+
# %% ../nbs/api/06_sync.ipynb #64d51ab6
|
|
42
42
|
_re_import = re.compile(r"from\s+\S+\s+import\s+\S")
|
|
43
43
|
|
|
44
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
44
|
+
# %% ../nbs/api/06_sync.ipynb #9075f993
|
|
45
45
|
def _to_absolute(code, py_path, lib_dir):
|
|
46
46
|
if not _re_import.search(code): return code
|
|
47
47
|
res = update_import(code, ast.parse(code).body, str(py_path.relative_to(lib_dir).parent), absolute_import)
|
|
48
48
|
return ''.join(res) if res else code
|
|
49
49
|
|
|
50
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
50
|
+
# %% ../nbs/api/06_sync.ipynb #27ae8834
|
|
51
51
|
def _update_nb(nb_path, cells, lib_dir):
|
|
52
52
|
"Update notebook `nb_path` with contents from `cells`"
|
|
53
53
|
nbp = NBProcessor(nb_path, ExportModuleProc(), rm_directives=False)
|
|
54
54
|
nbp.process()
|
|
55
|
+
# Build a dict of cell_id -> cell for fast lookup
|
|
56
|
+
nb_cells_by_id = {c['id']: c for c in nbp.nb.cells if c.get('id')}
|
|
55
57
|
for cell in cells:
|
|
56
58
|
assert cell.nb_path == nb_path
|
|
57
|
-
nbcell =
|
|
59
|
+
nbcell = nb_cells_by_id.get(cell.cell_id)
|
|
60
|
+
if nbcell is None:
|
|
61
|
+
raise ValueError(f"Cell ID '{cell.cell_id}' not found in notebook '{nb_path}'")
|
|
58
62
|
dirs,_ = _partition_cell(nbcell, 'python')
|
|
59
63
|
nbcell.source = ''.join(dirs) + _to_absolute(cell.code, cell.py_path, lib_dir)
|
|
60
64
|
write_nb(nbp.nb, nb_path)
|
|
61
65
|
|
|
62
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
66
|
+
# %% ../nbs/api/06_sync.ipynb #46c9e605
|
|
63
67
|
def _update_mod(py_path, lib_dir):
|
|
64
68
|
"Propagate changes from cells in module `py_path` to corresponding notebooks"
|
|
65
69
|
py_cells = L(_iter_py_cells(py_path)).filter(lambda o: o.nb != 'auto')
|
|
66
70
|
for nb_path,cells in groupby(py_cells, 'nb_path').items(): _update_nb(nb_path, cells, lib_dir)
|
|
67
71
|
|
|
68
|
-
# %% ../nbs/api/06_sync.ipynb
|
|
72
|
+
# %% ../nbs/api/06_sync.ipynb #60b5b528
|
|
69
73
|
@call_parse
|
|
70
74
|
def nbdev_update(fname:str=None): # A Python file name to update
|
|
71
75
|
"Propagate change in modules matching `fname` to notebooks that created them"
|
|
72
76
|
if fname and fname.endswith('.ipynb'): raise ValueError("`nbdev_update` operates on .py files. If you wish to convert notebooks instead, see `nbdev_export`.")
|
|
73
77
|
if os.environ.get('IN_TEST',0): return
|
|
74
78
|
cfg = get_config()
|
|
75
|
-
if not cfg.cell_number: raise ValueError("`nbdev_update` does not support without cell_number in .py files. Please check your settings.ini")
|
|
76
79
|
fname = Path(fname or cfg.lib_path)
|
|
77
80
|
lib_dir = cfg.lib_path.parent
|
|
78
81
|
files = globtastic(fname, file_glob='*.py', skip_folder_re='^[_.]').filter(lambda x: str(Path(x).absolute().relative_to(lib_dir) in _mod_files()))
|
nbdev/test.py
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/12_test.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% auto 0
|
|
5
|
+
# %% auto #0
|
|
6
6
|
__all__ = ['test_nb', 'nbdev_test']
|
|
7
7
|
|
|
8
|
-
# %% ../nbs/api/12_test.ipynb
|
|
8
|
+
# %% ../nbs/api/12_test.ipynb #45e10c3f
|
|
9
9
|
import time,os,sys,traceback,contextlib, inspect
|
|
10
10
|
from fastcore.basics import *
|
|
11
11
|
from fastcore.imports import *
|
|
@@ -22,7 +22,7 @@ from .frontmatter import FrontmatterProc
|
|
|
22
22
|
from execnb.nbio import *
|
|
23
23
|
from execnb.shell import *
|
|
24
24
|
|
|
25
|
-
# %% ../nbs/api/12_test.ipynb
|
|
25
|
+
# %% ../nbs/api/12_test.ipynb #3f4fa1ad
|
|
26
26
|
def test_nb(fn, # file name of notebook to test
|
|
27
27
|
skip_flags=None, # list of flags marking cells to skip
|
|
28
28
|
force_flags=None, # list of flags marking cells to always run
|
|
@@ -57,7 +57,7 @@ def test_nb(fn, # file name of notebook to test
|
|
|
57
57
|
if do_print: print(f'- Completed {fn}')
|
|
58
58
|
return res,time.time()-start
|
|
59
59
|
|
|
60
|
-
# %% ../nbs/api/12_test.ipynb
|
|
60
|
+
# %% ../nbs/api/12_test.ipynb #d8bf1f1b-935d-4b69-ba96-827c5d7213f0
|
|
61
61
|
def _keep_file(p:Path, # filename for which to check for `indicator_fname`
|
|
62
62
|
ignore_fname:str # filename that will result in siblings being ignored
|
|
63
63
|
) -> bool:
|
|
@@ -65,7 +65,7 @@ def _keep_file(p:Path, # filename for which to check for `indicator_fname`
|
|
|
65
65
|
if p.exists(): return not bool(p.parent.ls().attrgot('name').filter(lambda x: x == ignore_fname))
|
|
66
66
|
else: True
|
|
67
67
|
|
|
68
|
-
# %% ../nbs/api/12_test.ipynb
|
|
68
|
+
# %% ../nbs/api/12_test.ipynb #f8cc6a61-a48e-4ab1-89a9-18316ca795d6
|
|
69
69
|
@call_parse
|
|
70
70
|
@delegates(nbglob_cli)
|
|
71
71
|
def nbdev_test(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nbdev
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.11
|
|
4
4
|
Summary: Create delightful software with Jupyter Notebooks
|
|
5
5
|
Home-page: https://github.com/AnswerDotAI/nbdev
|
|
6
6
|
Author: Jeremy Howard and Hamel Husain
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.9
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: packaging
|
|
23
|
-
Requires-Dist: fastcore>=1.
|
|
23
|
+
Requires-Dist: fastcore>=1.12.1
|
|
24
24
|
Requires-Dist: execnb>=0.1.12
|
|
25
25
|
Requires-Dist: astunparse
|
|
26
26
|
Requires-Dist: ghapi>=1.0.3
|
|
@@ -28,6 +28,7 @@ Requires-Dist: watchdog
|
|
|
28
28
|
Requires-Dist: asttokens
|
|
29
29
|
Requires-Dist: setuptools
|
|
30
30
|
Requires-Dist: build
|
|
31
|
+
Requires-Dist: fastgit
|
|
31
32
|
Requires-Dist: PyYAML
|
|
32
33
|
Provides-Extra: dev
|
|
33
34
|
Requires-Dist: ipywidgets; extra == "dev"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
nbdev/__init__.py,sha256=J2Letp-iJ2O9J0Nr85o0VRKtRZTWJLYFrkJUjQqlWsg,90
|
|
2
|
+
nbdev/_modidx.py,sha256=v15TNw1xI8HShoTH1aNwH-Rt_c5-uYfcmf2nlNuSGFI,38256
|
|
3
|
+
nbdev/clean.py,sha256=rTLJsz_gNqd9TdTBLmEuexXN6lZPCq6PVS_Xd4JGMZ0,9748
|
|
4
|
+
nbdev/cli.py,sha256=csOPIFIz8fouyjTx-OX_0it1Fts-Z_c72dnIOxXxGDc,7588
|
|
5
|
+
nbdev/config.py,sha256=01DWLwkfdsn7TkYklO52LagvzI8UenfEga1GwyAxc-o,13760
|
|
6
|
+
nbdev/diff.py,sha256=8vzFbmk8jmn4LW66wXEDJVxsJTf4eegNMbBVV4jI708,3794
|
|
7
|
+
nbdev/doclinks.py,sha256=_t7frF7hdboJLJmYoPfjOiSvkSBtTKlh4AcjyTeD3XQ,12806
|
|
8
|
+
nbdev/export.py,sha256=CVJGQ8suzO2LZHqVCzJKjmoR42R5yTRWA76KY1sWnQA,4122
|
|
9
|
+
nbdev/extract_attachments.py,sha256=O4mS4EFIOXL_yQ3jmsnBStrWxGR_nPNvxLYXHtLeimw,2208
|
|
10
|
+
nbdev/frontmatter.py,sha256=CdJj6B1NyodH--uOCfWhGK0vI7gnKp-i2EzKce47kQQ,2820
|
|
11
|
+
nbdev/imports.py,sha256=f5Ynco14hsJyFCf43-uP_YARMhHADe6lM-20Mc_vXhw,95
|
|
12
|
+
nbdev/maker.py,sha256=OG0l-L-_zzErA5boWpt-0Ozi8eZU_2SSbY_-peo13_E,10011
|
|
13
|
+
nbdev/merge.py,sha256=WOjbqKwDfNK16L9P-eZ-IPUTgC1brOWg6jaKfDziDIc,4432
|
|
14
|
+
nbdev/migrate.py,sha256=uhmkStmHPb082VDKnAPlD2vOVUi1iYOYdKzqHwF12cc,7902
|
|
15
|
+
nbdev/process.py,sha256=cSKAdQ-KDPv6UNLqii61SnmFsw8qmcY-YwBPUbwRd18,6163
|
|
16
|
+
nbdev/processors.py,sha256=SL4Y4ha1ZQU-dV1nZyyb68viq0X2tE2PfBX26_LEzYY,12364
|
|
17
|
+
nbdev/qmd.py,sha256=4_paV81SjRh2TmDS5tyu8Y2TW1X_yg0PYGAi6fOw3ek,3129
|
|
18
|
+
nbdev/quarto.py,sha256=Hfxj_bCrm0OlKGh6S954d1E2BCfPL1q0901RRvC4bCA,14119
|
|
19
|
+
nbdev/release.py,sha256=UCG6zB1NdUUwyLNIDaLoRvHwOiVq25fQdwm7MHNFVhM,14853
|
|
20
|
+
nbdev/serve.py,sha256=XqTB9Mjgs_X3U5VNJ-vPbx2rs8ayBog5cfPiFumBPt4,3187
|
|
21
|
+
nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
|
|
22
|
+
nbdev/showdoc.py,sha256=rgVpHGVQi14RBdLYnh3ukPPG9EEKGyTMW_zGAH7HM7o,2657
|
|
23
|
+
nbdev/sync.py,sha256=eMYZYzu3RMDWjY-apr2TyzB7cTEB9v5-svF_Z--xyj8,3391
|
|
24
|
+
nbdev/test.py,sha256=74rkaOEY4KOeosB84V3DYvUsv-klVDdubuw_SWL7-vo,4532
|
|
25
|
+
nbdev-2.4.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
26
|
+
nbdev-2.4.11.dist-info/METADATA,sha256=6lemdUkJxTvClniEgJJEE9rrQvmDZJhm2wfe2GQ9BWo,10829
|
|
27
|
+
nbdev-2.4.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
nbdev-2.4.11.dist-info/entry_points.txt,sha256=1ADLbIIJxZeLgOD8NpizkPULSsd_fgUQxwAkbGk45b8,1453
|
|
29
|
+
nbdev-2.4.11.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
30
|
+
nbdev-2.4.11.dist-info/RECORD,,
|
nbdev-2.4.8.dist-info/RECORD
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
nbdev/__init__.py,sha256=MQFGPpfGNKL_cMonf8o6dNSa0OXIgQorHCob4NzjLv4,89
|
|
2
|
-
nbdev/_modidx.py,sha256=rF0BnQqiieRcqxLs_iBnk2I0LdM3QUJOe4uDyk0hwfg,38987
|
|
3
|
-
nbdev/clean.py,sha256=Ge3Hke1c1ArJ9-6P-Z11dXUfnQ7ZrYRnHHXPTAbJG4I,9412
|
|
4
|
-
nbdev/cli.py,sha256=S1rZ2ZYNdorRAv-KI7LD_eFARAyYKxujzOb5s7SX3bM,7346
|
|
5
|
-
nbdev/config.py,sha256=KmPAtLwsX819gA7TVJ40v-B4ok978b79pbqMF5WnAJE,13500
|
|
6
|
-
nbdev/diff.py,sha256=gSJNvjqbcuNlGD6d_BOlp7uQ0yLCLEfspCSIxOwnRuE,3713
|
|
7
|
-
nbdev/doclinks.py,sha256=fDnlqKaRHCBCS1CVbmqhGNsiaKeEMF2hS-pNFHc8JYE,12632
|
|
8
|
-
nbdev/export.py,sha256=y3AmFyAZ6gNYDMmxgIooyLkvjx02xU9DDaT0Wur00i8,4061
|
|
9
|
-
nbdev/extract_attachments.py,sha256=O4mS4EFIOXL_yQ3jmsnBStrWxGR_nPNvxLYXHtLeimw,2208
|
|
10
|
-
nbdev/frontmatter.py,sha256=i195bhDLWd-WUEzQT9JBoA4Ee3j6gD1dKMT8yk5fF4Y,2761
|
|
11
|
-
nbdev/imports.py,sha256=f5Ynco14hsJyFCf43-uP_YARMhHADe6lM-20Mc_vXhw,95
|
|
12
|
-
nbdev/maker.py,sha256=oDs5jOZBcGWRcj6hy7zhKpSfASZqQrni_d8pIjDmFYE,9859
|
|
13
|
-
nbdev/merge.py,sha256=xmT7LMY_mQGOGl0ynqkB13M6HwJfUOTis1Xl--YDXR8,4341
|
|
14
|
-
nbdev/migrate.py,sha256=YJTtWC6TPaZpZTcD0Jex6stOSumjju2QrUozF9rvl0Y,7311
|
|
15
|
-
nbdev/process.py,sha256=NZlJnGaEoDMNAROktBNbW5BAqX_tMyPOcDF5rP5HeZg,5854
|
|
16
|
-
nbdev/processors.py,sha256=fS4WrowC8bi6sFJJUVA9r9IRgmk-gffrJ9zNfb7vpIM,11973
|
|
17
|
-
nbdev/qmd.py,sha256=VAxE-c1sT7y26VdyreB6j9fge-CuLbHWocRE_WbnYXg,2994
|
|
18
|
-
nbdev/quarto.py,sha256=NIgOE_6ykluU5_a5dyGzB_eo8Wl3dEF4FF-h5zaCvTc,13817
|
|
19
|
-
nbdev/release.py,sha256=Oxqz5X61Zgs9DILNn9h0Njr0Q21fc3XTWJQ8jeZ3Y44,14572
|
|
20
|
-
nbdev/serve.py,sha256=HcYoNQiSROdMS1J8YlOlyTya-LmmrR-8v3ho5D9g700,3146
|
|
21
|
-
nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
|
|
22
|
-
nbdev/showdoc.py,sha256=TQCjFYjNmKNz8Evq-HtzWKtjDdWKol5tEw5tWVGVzwk,4357
|
|
23
|
-
nbdev/sync.py,sha256=ld-lSOmlX1FdnTOzaSHcxKyIuIguI_SpluqfPSH2BZ8,3201
|
|
24
|
-
nbdev/test.py,sha256=_ECBd5fvfGEICIfkTI2S8w8YatL5CaPltCeDSsiH6yw,4435
|
|
25
|
-
nbdev-2.4.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
26
|
-
nbdev-2.4.8.dist-info/METADATA,sha256=Ywe6coBvLkxFmKf5x9fKQWaHeQ8nv7GOLP8Ggh5XuGE,10805
|
|
27
|
-
nbdev-2.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
-
nbdev-2.4.8.dist-info/entry_points.txt,sha256=1ADLbIIJxZeLgOD8NpizkPULSsd_fgUQxwAkbGk45b8,1453
|
|
29
|
-
nbdev-2.4.8.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
30
|
-
nbdev-2.4.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|