nbdev 2.4.7__py3-none-any.whl → 2.4.9__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 +7 -0
- nbdev/cli.py +1 -1
- nbdev/diff.py +92 -0
- nbdev/release.py +1 -1
- {nbdev-2.4.7.dist-info → nbdev-2.4.9.dist-info}/METADATA +3 -2
- {nbdev-2.4.7.dist-info → nbdev-2.4.9.dist-info}/RECORD +11 -10
- {nbdev-2.4.7.dist-info → nbdev-2.4.9.dist-info}/WHEEL +0 -0
- {nbdev-2.4.7.dist-info → nbdev-2.4.9.dist-info}/entry_points.txt +0 -0
- {nbdev-2.4.7.dist-info → nbdev-2.4.9.dist-info}/licenses/LICENSE +0 -0
- {nbdev-2.4.7.dist-info → nbdev-2.4.9.dist-info}/top_level.txt +0 -0
nbdev/__init__.py
CHANGED
nbdev/_modidx.py
CHANGED
|
@@ -49,6 +49,13 @@ d = { 'settings': { 'branch': 'main',
|
|
|
49
49
|
'nbdev.config.update_proj': ('api/config.html#update_proj', 'nbdev/config.py'),
|
|
50
50
|
'nbdev.config.update_version': ('api/config.html#update_version', 'nbdev/config.py'),
|
|
51
51
|
'nbdev.config.write_cells': ('api/config.html#write_cells', 'nbdev/config.py')},
|
|
52
|
+
'nbdev.diff': { 'nbdev.diff._cell_changes': ('api/diff.html#_cell_changes', 'nbdev/diff.py'),
|
|
53
|
+
'nbdev.diff._nb_srcdict': ('api/diff.html#_nb_srcdict', 'nbdev/diff.py'),
|
|
54
|
+
'nbdev.diff.cell_diffs': ('api/diff.html#cell_diffs', 'nbdev/diff.py'),
|
|
55
|
+
'nbdev.diff.changed_cells': ('api/diff.html#changed_cells', 'nbdev/diff.py'),
|
|
56
|
+
'nbdev.diff.nbs_pair': ('api/diff.html#nbs_pair', 'nbdev/diff.py'),
|
|
57
|
+
'nbdev.diff.read_nb_from_git': ('api/diff.html#read_nb_from_git', 'nbdev/diff.py'),
|
|
58
|
+
'nbdev.diff.source_diff': ('api/diff.html#source_diff', 'nbdev/diff.py')},
|
|
52
59
|
'nbdev.doclinks': { 'nbdev.doclinks.NbdevLookup': ('api/doclinks.html#nbdevlookup', 'nbdev/doclinks.py'),
|
|
53
60
|
'nbdev.doclinks.NbdevLookup.__getitem__': ( 'api/doclinks.html#nbdevlookup.__getitem__',
|
|
54
61
|
'nbdev/doclinks.py'),
|
nbdev/cli.py
CHANGED
|
@@ -188,7 +188,7 @@ def watch_export(nbs:str=None, # Nb directory to watch for changes
|
|
|
188
188
|
run(f'nbdev_export')
|
|
189
189
|
def _export(e,lib=lib):
|
|
190
190
|
p = e.src_path
|
|
191
|
-
if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith('.~')):
|
|
191
|
+
if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith(('tmp','.~'))):
|
|
192
192
|
if e.event_type == 'modified':
|
|
193
193
|
time.sleep(0.1)
|
|
194
194
|
try: run(f'nb_export --lib_path {lib} "{p}"')
|
nbdev/diff.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Get ipynb diffs by cell"""
|
|
2
|
+
|
|
3
|
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/19_diff.ipynb.
|
|
4
|
+
|
|
5
|
+
# %% auto 0
|
|
6
|
+
__all__ = ['read_nb_from_git', 'nbs_pair', 'changed_cells', 'source_diff', 'cell_diffs']
|
|
7
|
+
|
|
8
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
9
|
+
import json
|
|
10
|
+
from fastcore.utils import *
|
|
11
|
+
from fastcore.meta import delegates
|
|
12
|
+
from difflib import unified_diff
|
|
13
|
+
from fastgit import Git
|
|
14
|
+
from execnb.nbio import *
|
|
15
|
+
|
|
16
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
17
|
+
def read_nb_from_git(
|
|
18
|
+
g:Git, # The git object
|
|
19
|
+
path, # The path to the notebook (absolute or relative to git root)
|
|
20
|
+
ref=None # The git ref to read from (e.g. HEAD); None for working dir
|
|
21
|
+
)->AttrDict: # The notebook
|
|
22
|
+
"Read notebook from git ref (e.g. HEAD) at path, or working dir if ref is None"
|
|
23
|
+
path = Path(path)
|
|
24
|
+
if path.is_absolute(): path = path.relative_to(g.top())
|
|
25
|
+
if ref is None: return read_nb(g.top()/path)
|
|
26
|
+
raw = g.show(f'{ref}:{path}', split=False)
|
|
27
|
+
return dict2nb(json.loads(raw))
|
|
28
|
+
|
|
29
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
30
|
+
def _nb_srcdict(g:Git, nb_path, ref=None, f=noop):
|
|
31
|
+
"Dict of id->source"
|
|
32
|
+
nb = read_nb_from_git(g, nb_path, ref)
|
|
33
|
+
return {c['id']: f(c) for c in nb.cells}
|
|
34
|
+
|
|
35
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
36
|
+
def nbs_pair(
|
|
37
|
+
nb_path, # Path to the notebook
|
|
38
|
+
ref_a='HEAD', # First git ref (None for working dir)
|
|
39
|
+
ref_b=None, # Second git ref (None for working dir)
|
|
40
|
+
f=noop # Function to call on contents
|
|
41
|
+
): # Tuple of two notebooks
|
|
42
|
+
"NBs at two refs; None means working dir. By default provides HEAD and working dir"
|
|
43
|
+
nb_path = Path(nb_path).resolve()
|
|
44
|
+
g = Git(nb_path.parent)
|
|
45
|
+
return _nb_srcdict(g, nb_path, ref_a, f), _nb_srcdict(g, nb_path, ref_b, f)
|
|
46
|
+
|
|
47
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
48
|
+
def _cell_changes(
|
|
49
|
+
nb_path, # Path to the notebook
|
|
50
|
+
fn, # function to call to get dict values
|
|
51
|
+
ref_a='HEAD', # First git ref (None for working dir)
|
|
52
|
+
ref_b=None, # Second git ref (None for working dir)
|
|
53
|
+
adds=True, # Include cells in b but not in a
|
|
54
|
+
changes=True, # Include cells with different content
|
|
55
|
+
dels=False, # Include cells in a but not in b
|
|
56
|
+
metadata=False, # Consider cell metadata when comparing
|
|
57
|
+
outputs=False # Consider cell outputs when comparing
|
|
58
|
+
): # Dict of results
|
|
59
|
+
"Apply fn(cell_id, old_content, new_content) to changed cells between two refs"
|
|
60
|
+
def cell_content(c):
|
|
61
|
+
res = c.get('source', '')
|
|
62
|
+
if metadata: res += '\n# metadata: ' + json.dumps(c.get('metadata', {}), sort_keys=True)
|
|
63
|
+
if outputs: res += '\n# outputs: ' + json.dumps(c.get('outputs', []), sort_keys=True)
|
|
64
|
+
return res
|
|
65
|
+
old,new = nbs_pair(nb_path, ref_a, ref_b, f=cell_content)
|
|
66
|
+
res = {}
|
|
67
|
+
if adds: res |= {cid: fn(cid, '', new[cid]) for cid in new if cid not in old}
|
|
68
|
+
if changes: res |= {cid: fn(cid, old[cid], new[cid]) for cid in new if cid in old and new[cid] != old[cid]}
|
|
69
|
+
if dels: res |= {cid: fn(cid, old[cid], '') for cid in old if cid not in new}
|
|
70
|
+
return res
|
|
71
|
+
|
|
72
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
73
|
+
@delegates(_cell_changes)
|
|
74
|
+
def changed_cells(nb_path, **kwargs):
|
|
75
|
+
"Return set of cell IDs for changed/added/deleted cells between two refs"
|
|
76
|
+
def f(cid,o,n): return cid
|
|
77
|
+
return set(_cell_changes(nb_path, f, **kwargs).keys())
|
|
78
|
+
|
|
79
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
80
|
+
def source_diff(
|
|
81
|
+
old_source, # Original source string
|
|
82
|
+
new_source # New source string
|
|
83
|
+
): # Unified diff string
|
|
84
|
+
"Return unified diff string for source change"
|
|
85
|
+
return '\n'.join(unified_diff(old_source.splitlines(), new_source.splitlines(), lineterm=''))
|
|
86
|
+
|
|
87
|
+
# %% ../nbs/api/19_diff.ipynb
|
|
88
|
+
@delegates(_cell_changes)
|
|
89
|
+
def cell_diffs(nb_path, **kwargs):
|
|
90
|
+
"{cell_id:diff} for changed/added/deleted cells between two refs"
|
|
91
|
+
def f(cid,o,n): return source_diff(o,n)
|
|
92
|
+
return _cell_changes(nb_path, f, **kwargs)
|
nbdev/release.py
CHANGED
|
@@ -63,7 +63,7 @@ class Release:
|
|
|
63
63
|
|
|
64
64
|
def _issues(self, label):
|
|
65
65
|
return self.gh.issues.list_for_repo(state='closed', sort='created', filter='all', since=self.commit_date, labels=label)
|
|
66
|
-
def _issue_groups(self): return parallel(self._issues, self.groups.keys(), progress=False)
|
|
66
|
+
def _issue_groups(self): return parallel(self._issues, self.groups.keys(), progress=False, threadpool=True)
|
|
67
67
|
|
|
68
68
|
# %% ../nbs/api/18_release.ipynb
|
|
69
69
|
@patch
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nbdev
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.9
|
|
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.11.0
|
|
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"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
nbdev/__init__.py,sha256=
|
|
2
|
-
nbdev/_modidx.py,sha256=
|
|
1
|
+
nbdev/__init__.py,sha256=7vbSTKeja1BPakNzYi7kBf0UkrDY5NyXeJturXFBQ2s,89
|
|
2
|
+
nbdev/_modidx.py,sha256=rF0BnQqiieRcqxLs_iBnk2I0LdM3QUJOe4uDyk0hwfg,38987
|
|
3
3
|
nbdev/clean.py,sha256=Ge3Hke1c1ArJ9-6P-Z11dXUfnQ7ZrYRnHHXPTAbJG4I,9412
|
|
4
|
-
nbdev/cli.py,sha256=
|
|
4
|
+
nbdev/cli.py,sha256=S1rZ2ZYNdorRAv-KI7LD_eFARAyYKxujzOb5s7SX3bM,7346
|
|
5
5
|
nbdev/config.py,sha256=KmPAtLwsX819gA7TVJ40v-B4ok978b79pbqMF5WnAJE,13500
|
|
6
|
+
nbdev/diff.py,sha256=gSJNvjqbcuNlGD6d_BOlp7uQ0yLCLEfspCSIxOwnRuE,3713
|
|
6
7
|
nbdev/doclinks.py,sha256=fDnlqKaRHCBCS1CVbmqhGNsiaKeEMF2hS-pNFHc8JYE,12632
|
|
7
8
|
nbdev/export.py,sha256=y3AmFyAZ6gNYDMmxgIooyLkvjx02xU9DDaT0Wur00i8,4061
|
|
8
9
|
nbdev/extract_attachments.py,sha256=O4mS4EFIOXL_yQ3jmsnBStrWxGR_nPNvxLYXHtLeimw,2208
|
|
@@ -15,15 +16,15 @@ nbdev/process.py,sha256=NZlJnGaEoDMNAROktBNbW5BAqX_tMyPOcDF5rP5HeZg,5854
|
|
|
15
16
|
nbdev/processors.py,sha256=fS4WrowC8bi6sFJJUVA9r9IRgmk-gffrJ9zNfb7vpIM,11973
|
|
16
17
|
nbdev/qmd.py,sha256=VAxE-c1sT7y26VdyreB6j9fge-CuLbHWocRE_WbnYXg,2994
|
|
17
18
|
nbdev/quarto.py,sha256=NIgOE_6ykluU5_a5dyGzB_eo8Wl3dEF4FF-h5zaCvTc,13817
|
|
18
|
-
nbdev/release.py,sha256=
|
|
19
|
+
nbdev/release.py,sha256=Oxqz5X61Zgs9DILNn9h0Njr0Q21fc3XTWJQ8jeZ3Y44,14572
|
|
19
20
|
nbdev/serve.py,sha256=HcYoNQiSROdMS1J8YlOlyTya-LmmrR-8v3ho5D9g700,3146
|
|
20
21
|
nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
|
|
21
22
|
nbdev/showdoc.py,sha256=TQCjFYjNmKNz8Evq-HtzWKtjDdWKol5tEw5tWVGVzwk,4357
|
|
22
23
|
nbdev/sync.py,sha256=ld-lSOmlX1FdnTOzaSHcxKyIuIguI_SpluqfPSH2BZ8,3201
|
|
23
24
|
nbdev/test.py,sha256=_ECBd5fvfGEICIfkTI2S8w8YatL5CaPltCeDSsiH6yw,4435
|
|
24
|
-
nbdev-2.4.
|
|
25
|
-
nbdev-2.4.
|
|
26
|
-
nbdev-2.4.
|
|
27
|
-
nbdev-2.4.
|
|
28
|
-
nbdev-2.4.
|
|
29
|
-
nbdev-2.4.
|
|
25
|
+
nbdev-2.4.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
26
|
+
nbdev-2.4.9.dist-info/METADATA,sha256=AHX0gmzQfQmxRD05-KZH8WO18iGasC0_bDj0spJhHmI,10828
|
|
27
|
+
nbdev-2.4.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
nbdev-2.4.9.dist-info/entry_points.txt,sha256=1ADLbIIJxZeLgOD8NpizkPULSsd_fgUQxwAkbGk45b8,1453
|
|
29
|
+
nbdev-2.4.9.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
|
|
30
|
+
nbdev-2.4.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|