Skip to content

Commit cf1aa61

Browse files
committed
fixes #35
1 parent f74fafe commit cf1aa61

File tree

3 files changed

+94
-72
lines changed

3 files changed

+94
-72
lines changed

execnb/_modidx.py

Lines changed: 83 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,88 @@
11
# Autogenerated by nbdev
22

3-
d = { 'settings': { 'allowed_cell_metadata_keys': '',
4-
'allowed_metadata_keys': '',
5-
'audience': 'Developers',
6-
'author': 'Jeremy Howard',
7-
'author_email': '[email protected]',
8-
'black_formatting': 'False',
9-
'branch': 'master',
10-
'clean_ids': 'True',
11-
'console_scripts': 'exec_nb=execnb.shell:exec_nb',
12-
'copyright': 'Put your copyright info here',
13-
'custom_quarto_yml': 'False',
14-
'custom_sidebar': 'False',
15-
'description': 'A description of your project',
16-
'dev_requirements': 'matplotlib Pillow',
3+
d = { 'settings': { 'branch': 'master',
174
'doc_baseurl': '/execnb/',
185
'doc_host': 'https://fastai.github.io',
19-
'doc_path': '_docs',
206
'git_url': 'https://github.com/fastai/execnb/tree/master/',
21-
'host': 'github',
22-
'jupyter_hooks': 'True',
23-
'keywords': 'some keywords',
24-
'language': 'English',
25-
'lib_name': 'execnb',
26-
'lib_path': 'execnb',
27-
'license': 'apache2',
28-
'min_python': '3.7',
29-
'nbs_path': 'nbs',
30-
'readme_nb': 'index.ipynb',
31-
'recursive': 'False',
32-
'requirements': 'fastcore>=1.5.5 ipython',
33-
'status': '2',
34-
'title': 'execnb',
35-
'tst_flags': 'notest',
36-
'user': 'fastai',
37-
'version': '0.1.2'},
38-
'syms': { 'execnb.fastshell': { 'execnb.fastshell.FastInteractiveShell': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell',
39-
'execnb.fastshell.FastInteractiveShell.ask_exit': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.ask_exit',
40-
'execnb.fastshell.FastInteractiveShell.data_pub': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.data_pub',
41-
'execnb.fastshell.FastInteractiveShell.get_parent': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.get_parent',
42-
'execnb.fastshell.FastInteractiveShell.init_data_pub': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.init_data_pub',
43-
'execnb.fastshell.FastInteractiveShell.init_environment': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.init_environment',
44-
'execnb.fastshell.FastInteractiveShell.init_magics': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.init_magics',
45-
'execnb.fastshell.FastInteractiveShell.init_virtualenv': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.init_virtualenv',
46-
'execnb.fastshell.FastInteractiveShell.set_next_input': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.set_next_input',
47-
'execnb.fastshell.FastInteractiveShell.set_parent': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.set_parent',
48-
'execnb.fastshell.FastInteractiveShell.system_piped': 'https://fastai.github.io/execnb/fastshell.html#fastinteractiveshell.system_piped',
49-
'execnb.fastshell.KernelMagics': 'https://fastai.github.io/execnb/fastshell.html#kernelmagics',
50-
'execnb.fastshell.KernelMagics.autosave': 'https://fastai.github.io/execnb/fastshell.html#kernelmagics.autosave',
51-
'execnb.fastshell.KernelMagics.clear': 'https://fastai.github.io/execnb/fastshell.html#kernelmagics.clear',
52-
'execnb.fastshell.KernelMagics.edit': 'https://fastai.github.io/execnb/fastshell.html#kernelmagics.edit',
53-
'execnb.fastshell.KernelMagics.less': 'https://fastai.github.io/execnb/fastshell.html#kernelmagics.less'},
54-
'execnb.nbio': { 'execnb.nbio.NbCell': 'https://fastai.github.io/execnb/nbio.html#nbcell',
55-
'execnb.nbio.NbCell.parsed_': 'https://fastai.github.io/execnb/nbio.html#nbcell.parsed_',
56-
'execnb.nbio.NbCell.set_source': 'https://fastai.github.io/execnb/nbio.html#nbcell.set_source',
57-
'execnb.nbio.dict2nb': 'https://fastai.github.io/execnb/nbio.html#dict2nb',
58-
'execnb.nbio.mk_cell': 'https://fastai.github.io/execnb/nbio.html#mk_cell',
59-
'execnb.nbio.nb2dict': 'https://fastai.github.io/execnb/nbio.html#nb2dict',
60-
'execnb.nbio.nb2str': 'https://fastai.github.io/execnb/nbio.html#nb2str',
61-
'execnb.nbio.new_nb': 'https://fastai.github.io/execnb/nbio.html#new_nb',
62-
'execnb.nbio.read_nb': 'https://fastai.github.io/execnb/nbio.html#read_nb',
63-
'execnb.nbio.write_nb': 'https://fastai.github.io/execnb/nbio.html#write_nb'},
64-
'execnb.shell': { 'execnb.shell.CaptureShell': 'https://fastai.github.io/execnb/shell.html#captureshell',
65-
'execnb.shell.CaptureShell.cell': 'https://fastai.github.io/execnb/shell.html#captureshell.cell',
66-
'execnb.shell.CaptureShell.enable_gui': 'https://fastai.github.io/execnb/shell.html#captureshell.enable_gui',
67-
'execnb.shell.CaptureShell.enable_matplotlib': 'https://fastai.github.io/execnb/shell.html#captureshell.enable_matplotlib',
68-
'execnb.shell.CaptureShell.execute': 'https://fastai.github.io/execnb/shell.html#captureshell.execute',
69-
'execnb.shell.CaptureShell.prettytb': 'https://fastai.github.io/execnb/shell.html#captureshell.prettytb',
70-
'execnb.shell.CaptureShell.run': 'https://fastai.github.io/execnb/shell.html#captureshell.run',
71-
'execnb.shell.CaptureShell.run_all': 'https://fastai.github.io/execnb/shell.html#captureshell.run_all',
72-
'execnb.shell.CaptureShell.set_path': 'https://fastai.github.io/execnb/shell.html#captureshell.set_path',
73-
'execnb.shell.exec_nb': 'https://fastai.github.io/execnb/shell.html#exec_nb'}}}
7+
'lib_path': 'execnb'},
8+
'syms': { 'execnb.fastshell': {},
9+
'execnb.nbio': { 'execnb.nbio.NbCell': ( 'https://fastai.github.io/execnb/nbio.html#nbcell',
10+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L19'),
11+
'execnb.nbio.NbCell.__eq__': ( 'https://fastai.github.io/execnb/nbio.html#__eq__',
12+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L39'),
13+
'execnb.nbio.NbCell.__hash__': ( 'https://fastai.github.io/execnb/nbio.html#__hash__',
14+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L38'),
15+
'execnb.nbio.NbCell.__init__': ( 'https://fastai.github.io/execnb/nbio.html#__init__',
16+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L20'),
17+
'execnb.nbio.NbCell.parsed_': ( 'https://fastai.github.io/execnb/nbio.html#parsed_',
18+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L29'),
19+
'execnb.nbio.NbCell.set_source': ( 'https://fastai.github.io/execnb/nbio.html#set_source',
20+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L25'),
21+
'execnb.nbio._dict2obj': ( 'https://fastai.github.io/execnb/nbio.html#_dict2obj',
22+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L42'),
23+
'execnb.nbio._read_json': ( 'https://fastai.github.io/execnb/nbio.html#_read_json',
24+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L15'),
25+
'execnb.nbio.dict2nb': ( 'https://fastai.github.io/execnb/nbio.html#dict2nb',
26+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L48'),
27+
'execnb.nbio.mk_cell': ( 'https://fastai.github.io/execnb/nbio.html#mk_cell',
28+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L67'),
29+
'execnb.nbio.nb2dict': ( 'https://fastai.github.io/execnb/nbio.html#nb2dict',
30+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L76'),
31+
'execnb.nbio.nb2str': ( 'https://fastai.github.io/execnb/nbio.html#nb2str',
32+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L84'),
33+
'execnb.nbio.new_nb': ( 'https://fastai.github.io/execnb/nbio.html#new_nb',
34+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L62'),
35+
'execnb.nbio.read_nb': ( 'https://fastai.github.io/execnb/nbio.html#read_nb',
36+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L55'),
37+
'execnb.nbio.write_nb': ( 'https://fastai.github.io/execnb/nbio.html#write_nb',
38+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/nbio.py#L90')},
39+
'execnb.shell': { 'execnb.shell.CaptureShell': ( 'https://fastai.github.io/execnb/shell.html#captureshell',
40+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L71'),
41+
'execnb.shell.CaptureShell.__init__': ( 'https://fastai.github.io/execnb/shell.html#__init__',
42+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L73'),
43+
'execnb.shell.CaptureShell._add_exec': ( 'https://fastai.github.io/execnb/shell.html#_add_exec',
44+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L109'),
45+
'execnb.shell.CaptureShell._add_out': ( 'https://fastai.github.io/execnb/shell.html#_add_out',
46+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L104'),
47+
'execnb.shell.CaptureShell._result': ( 'https://fastai.github.io/execnb/shell.html#_result',
48+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L113'),
49+
'execnb.shell.CaptureShell._showtraceback': ( 'https://fastai.github.io/execnb/shell.html#_showtraceback',
50+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L100'),
51+
'execnb.shell.CaptureShell._stream': ( 'https://fastai.github.io/execnb/shell.html#_stream',
52+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L117'),
53+
'execnb.shell.CaptureShell.cell': ( 'https://fastai.github.io/execnb/shell.html#captureshell.cell',
54+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L147'),
55+
'execnb.shell.CaptureShell.enable_gui': ( 'https://fastai.github.io/execnb/shell.html#enable_gui',
56+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L96'),
57+
'execnb.shell.CaptureShell.enable_matplotlib': ( 'https://fastai.github.io/execnb/shell.html#enable_matplotlib',
58+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L84'),
59+
'execnb.shell.CaptureShell.execute': ( 'https://fastai.github.io/execnb/shell.html#captureshell.execute',
60+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L179'),
61+
'execnb.shell.CaptureShell.prettytb': ( 'https://fastai.github.io/execnb/shell.html#captureshell.prettytb',
62+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L200'),
63+
'execnb.shell.CaptureShell.run': ( 'https://fastai.github.io/execnb/shell.html#captureshell.run',
64+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L129'),
65+
'execnb.shell.CaptureShell.run_all': ( 'https://fastai.github.io/execnb/shell.html#captureshell.run_all',
66+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L161'),
67+
'execnb.shell.CaptureShell.set_path': ( 'https://fastai.github.io/execnb/shell.html#set_path',
68+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L90'),
69+
'execnb.shell._CaptureHook': ( 'https://fastai.github.io/execnb/shell.html#_capturehook',
70+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L36'),
71+
'execnb.shell._CaptureHook.__call__': ( 'https://fastai.github.io/execnb/shell.html#__call__',
72+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L47'),
73+
'execnb.shell._CaptureHook.quiet': ( 'https://fastai.github.io/execnb/shell.html#quiet',
74+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L39'),
75+
'execnb.shell._CapturePub': ( 'https://fastai.github.io/execnb/shell.html#_capturepub',
76+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L52'),
77+
'execnb.shell._CapturePub.publish': ( 'https://fastai.github.io/execnb/shell.html#publish',
78+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L54'),
79+
'execnb.shell._false': ( 'https://fastai.github.io/execnb/shell.html#_false',
80+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L158'),
81+
'execnb.shell._format_mimedata': ( 'https://fastai.github.io/execnb/shell.html#_format_mimedata',
82+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L62'),
83+
'execnb.shell._out_exc': ( 'https://fastai.github.io/execnb/shell.html#_out_exc',
84+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L58'),
85+
'execnb.shell._out_stream': ( 'https://fastai.github.io/execnb/shell.html#_out_stream',
86+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L59'),
87+
'execnb.shell.exec_nb': ( 'https://fastai.github.io/execnb/shell.html#exec_nb',
88+
'https://github.com/fastai/execnb/tree/master//blob/master/execnb/shell.py#L212')}}}

execnb/nbio.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,8 @@ def nb2str(nb):
8989
# %% ../nbs/01_nbio.ipynb 37
9090
def write_nb(nb, path):
9191
"Write `nb` to `path`"
92-
with open(path, 'w', encoding='utf-8') as f: f.write(nb2str(nb))
92+
new = nb2str(nb)
93+
path = Path(path)
94+
old = Path(path).read_text() if path.exists() else None
95+
if new!=old:
96+
with open(path, 'w', encoding='utf-8') as f: f.write(new)

nbs/01_nbio.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@
523523
"#|export\n",
524524
"def write_nb(nb, path):\n",
525525
" \"Write `nb` to `path`\"\n",
526-
" with open(path, 'w', encoding='utf-8') as f: f.write(nb2str(nb))"
526+
" new = nb2str(nb)\n",
527+
" path = Path(path)\n",
528+
" old = Path(path).read_text() if path.exists() else None\n",
529+
" if new!=old:\n",
530+
" with open(path, 'w', encoding='utf-8') as f: f.write(new)"
527531
]
528532
},
529533
{
@@ -590,8 +594,7 @@
590594
"outputs": [],
591595
"source": [
592596
"#|hide\n",
593-
"from nbdev import nbdev_export\n",
594-
"nbdev_export()"
597+
"import nbdev; nbdev.nbdev_export()"
595598
]
596599
},
597600
{

0 commit comments

Comments
 (0)