nbdev 2.3.22__tar.gz → 2.4.9__tar.gz

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.
Files changed (41) hide show
  1. {nbdev-2.3.22/nbdev.egg-info → nbdev-2.4.9}/PKG-INFO +32 -10
  2. {nbdev-2.3.22 → nbdev-2.4.9}/README.md +2 -0
  3. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/__init__.py +1 -1
  4. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/_modidx.py +22 -32
  5. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/clean.py +22 -18
  6. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/cli.py +57 -22
  7. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/config.py +66 -38
  8. nbdev-2.4.9/nbdev/diff.py +92 -0
  9. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/doclinks.py +109 -50
  10. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/export.py +33 -18
  11. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/frontmatter.py +5 -3
  12. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/maker.py +35 -33
  13. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/merge.py +11 -9
  14. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/migrate.py +20 -18
  15. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/process.py +17 -15
  16. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/processors.py +43 -30
  17. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/qmd.py +9 -7
  18. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/quarto.py +68 -29
  19. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/release.py +49 -39
  20. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/serve.py +8 -5
  21. nbdev-2.4.9/nbdev/showdoc.py +113 -0
  22. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/sync.py +17 -11
  23. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/test.py +6 -4
  24. {nbdev-2.3.22 → nbdev-2.4.9/nbdev.egg-info}/PKG-INFO +32 -10
  25. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev.egg-info/SOURCES.txt +2 -0
  26. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev.egg-info/entry_points.txt +4 -0
  27. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev.egg-info/requires.txt +9 -2
  28. nbdev-2.4.9/pyproject.toml +11 -0
  29. {nbdev-2.3.22 → nbdev-2.4.9}/settings.ini +15 -8
  30. {nbdev-2.3.22 → nbdev-2.4.9}/setup.py +1 -4
  31. nbdev-2.3.22/nbdev/showdoc.py +0 -230
  32. {nbdev-2.3.22 → nbdev-2.4.9}/CONTRIBUTING.md +0 -0
  33. {nbdev-2.3.22 → nbdev-2.4.9}/LICENSE +0 -0
  34. {nbdev-2.3.22 → nbdev-2.4.9}/MANIFEST.in +0 -0
  35. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/extract_attachments.py +0 -0
  36. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/imports.py +0 -0
  37. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev/serve_drv.py +0 -0
  38. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev.egg-info/dependency_links.txt +0 -0
  39. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev.egg-info/not-zip-safe +0 -0
  40. {nbdev-2.3.22 → nbdev-2.4.9}/nbdev.egg-info/top_level.txt +0 -0
  41. {nbdev-2.3.22 → nbdev-2.4.9}/setup.cfg +0 -0
@@ -1,32 +1,34 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 2.3.22
3
+ Version: 2.4.9
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
- Home-page: https://github.com/fastai/nbdev
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
9
9
  Project-URL: Documentation, https://nbdev.fast.ai/
10
10
  Keywords: nbdev fastai jupyter notebook export
11
- Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python :: 3.7
15
- Classifier: Programming Language :: Python :: 3.8
16
14
  Classifier: Programming Language :: Python :: 3.9
17
15
  Classifier: Programming Language :: Python :: 3.10
18
- Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
19
18
  Classifier: License :: OSI Approved :: Apache Software License
20
- Requires-Python: >=3.7
19
+ Requires-Python: >=3.9
21
20
  Description-Content-Type: text/markdown
22
21
  License-File: LICENSE
23
22
  Requires-Dist: packaging
24
- Requires-Dist: fastcore>=1.5.27
25
- Requires-Dist: execnb>=0.1.4
23
+ Requires-Dist: fastcore>=1.11.0
24
+ Requires-Dist: execnb>=0.1.12
26
25
  Requires-Dist: astunparse
27
26
  Requires-Dist: ghapi>=1.0.3
28
27
  Requires-Dist: watchdog
29
28
  Requires-Dist: asttokens
29
+ Requires-Dist: setuptools
30
+ Requires-Dist: build
31
+ Requires-Dist: fastgit
30
32
  Requires-Dist: PyYAML
31
33
  Provides-Extra: dev
32
34
  Requires-Dist: ipywidgets; extra == "dev"
@@ -37,6 +39,24 @@ Requires-Dist: matplotlib; extra == "dev"
37
39
  Requires-Dist: black; extra == "dev"
38
40
  Requires-Dist: svg.py; extra == "dev"
39
41
  Requires-Dist: nbclassic; extra == "dev"
42
+ Requires-Dist: pysymbol_llm; extra == "dev"
43
+ Requires-Dist: llms-txt; extra == "dev"
44
+ Requires-Dist: sphinx; extra == "dev"
45
+ Requires-Dist: plum-dispatch; extra == "dev"
46
+ Dynamic: author
47
+ Dynamic: author-email
48
+ Dynamic: classifier
49
+ Dynamic: description
50
+ Dynamic: description-content-type
51
+ Dynamic: home-page
52
+ Dynamic: keywords
53
+ Dynamic: license
54
+ Dynamic: license-file
55
+ Dynamic: project-url
56
+ Dynamic: provides-extra
57
+ Dynamic: requires-dist
58
+ Dynamic: requires-python
59
+ Dynamic: summary
40
60
 
41
61
  # Getting Started
42
62
 
@@ -143,10 +163,12 @@ available commands:
143
163
  nbdev_release_both Release both conda and PyPI packages
144
164
  nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
145
165
  nbdev_release_git Tag and create a release in GitHub for the current version
166
+ nbdev_requirements Writes a `requirements.txt` file to `directory` based on settings.ini.
146
167
  nbdev_sidebar Create sidebar.yml
147
168
  nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
148
169
  nbdev_trust Trust notebooks matching `fname`
149
170
  nbdev_update Propagate change in modules matching `fname` to notebooks that created them
171
+ nbdev_update_license Allows you to update the license of your project.
150
172
 
151
173
  ## FAQ
152
174
 
@@ -103,10 +103,12 @@ available commands:
103
103
  nbdev_release_both Release both conda and PyPI packages
104
104
  nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
105
105
  nbdev_release_git Tag and create a release in GitHub for the current version
106
+ nbdev_requirements Writes a `requirements.txt` file to `directory` based on settings.ini.
106
107
  nbdev_sidebar Create sidebar.yml
107
108
  nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
108
109
  nbdev_trust Trust notebooks matching `fname`
109
110
  nbdev_update Propagate change in modules matching `fname` to notebooks that created them
111
+ nbdev_update_license Allows you to update the license of your project.
110
112
 
111
113
  ## FAQ
112
114
 
@@ -1,4 +1,4 @@
1
- __version__ = "2.3.22"
1
+ __version__ = "2.4.9"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
@@ -1,9 +1,9 @@
1
1
  # Autogenerated by nbdev
2
2
 
3
- d = { 'settings': { 'branch': 'master',
3
+ d = { 'settings': { 'branch': 'main',
4
4
  'doc_baseurl': '/',
5
5
  'doc_host': 'https://nbdev.fast.ai',
6
- 'git_url': 'https://github.com/fastai/nbdev',
6
+ 'git_url': 'https://github.com/AnswerDotAI/nbdev',
7
7
  'lib_path': 'nbdev'},
8
8
  'syms': { 'nbdev.clean': { 'nbdev.clean._add_jupyter_hooks': ('api/clean.html#_add_jupyter_hooks', 'nbdev/clean.py'),
9
9
  'nbdev.clean._clean_cell': ('api/clean.html#_clean_cell', 'nbdev/clean.py'),
@@ -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'),
@@ -41,10 +43,19 @@ d = { 'settings': { 'branch': 'master',
41
43
  'nbdev.config.config_key': ('api/config.html#config_key', 'nbdev/config.py'),
42
44
  'nbdev.config.create_output': ('api/config.html#create_output', 'nbdev/config.py'),
43
45
  'nbdev.config.get_config': ('api/config.html#get_config', 'nbdev/config.py'),
46
+ 'nbdev.config.is_nbdev': ('api/config.html#is_nbdev', 'nbdev/config.py'),
44
47
  'nbdev.config.nbdev_create_config': ('api/config.html#nbdev_create_config', 'nbdev/config.py'),
45
48
  'nbdev.config.show_src': ('api/config.html#show_src', 'nbdev/config.py'),
49
+ 'nbdev.config.update_proj': ('api/config.html#update_proj', 'nbdev/config.py'),
46
50
  'nbdev.config.update_version': ('api/config.html#update_version', 'nbdev/config.py'),
47
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')},
48
59
  'nbdev.doclinks': { 'nbdev.doclinks.NbdevLookup': ('api/doclinks.html#nbdevlookup', 'nbdev/doclinks.py'),
49
60
  'nbdev.doclinks.NbdevLookup.__getitem__': ( 'api/doclinks.html#nbdevlookup.__getitem__',
50
61
  'nbdev/doclinks.py'),
@@ -55,6 +66,7 @@ d = { 'settings': { 'branch': 'master',
55
66
  'nbdev.doclinks.NbdevLookup.link_line': ('api/doclinks.html#nbdevlookup.link_line', 'nbdev/doclinks.py'),
56
67
  'nbdev.doclinks.NbdevLookup.linkify': ('api/doclinks.html#nbdevlookup.linkify', 'nbdev/doclinks.py'),
57
68
  'nbdev.doclinks._binop_leafs': ('api/doclinks.html#_binop_leafs', 'nbdev/doclinks.py'),
69
+ 'nbdev.doclinks._build_lookup_table': ('api/doclinks.html#_build_lookup_table', 'nbdev/doclinks.py'),
58
70
  'nbdev.doclinks._build_modidx': ('api/doclinks.html#_build_modidx', 'nbdev/doclinks.py'),
59
71
  'nbdev.doclinks._find_mod': ('api/doclinks.html#_find_mod', 'nbdev/doclinks.py'),
60
72
  'nbdev.doclinks._get_exps': ('api/doclinks.html#_get_exps', 'nbdev/doclinks.py'),
@@ -66,11 +78,13 @@ d = { 'settings': { 'branch': 'master',
66
78
  'nbdev.doclinks._qual_sym': ('api/doclinks.html#_qual_sym', 'nbdev/doclinks.py'),
67
79
  'nbdev.doclinks._qual_syms': ('api/doclinks.html#_qual_syms', 'nbdev/doclinks.py'),
68
80
  'nbdev.doclinks._sym_nm': ('api/doclinks.html#_sym_nm', 'nbdev/doclinks.py'),
81
+ 'nbdev.doclinks.create_index': ('api/doclinks.html#create_index', 'nbdev/doclinks.py'),
69
82
  'nbdev.doclinks.nbdev_export': ('api/doclinks.html#nbdev_export', 'nbdev/doclinks.py'),
70
83
  'nbdev.doclinks.nbglob': ('api/doclinks.html#nbglob', 'nbdev/doclinks.py'),
71
84
  'nbdev.doclinks.nbglob_cli': ('api/doclinks.html#nbglob_cli', 'nbdev/doclinks.py'),
72
85
  'nbdev.doclinks.patch_name': ('api/doclinks.html#patch_name', 'nbdev/doclinks.py')},
73
86
  'nbdev.export': { 'nbdev.export.ExportModuleProc': ('api/export.html#exportmoduleproc', 'nbdev/export.py'),
87
+ 'nbdev.export.ExportModuleProc.__call__': ('api/export.html#exportmoduleproc.__call__', 'nbdev/export.py'),
74
88
  'nbdev.export.ExportModuleProc._default_exp_': ( 'api/export.html#exportmoduleproc._default_exp_',
75
89
  'nbdev/export.py'),
76
90
  'nbdev.export.ExportModuleProc._export_': ('api/export.html#exportmoduleproc._export_', 'nbdev/export.py'),
@@ -203,6 +217,7 @@ d = { 'settings': { 'branch': 'master',
203
217
  'nbdev.processors.add_show_docs': ('api/processors.html#add_show_docs', 'nbdev/processors.py'),
204
218
  'nbdev.processors.add_show_docs.begin': ( 'api/processors.html#add_show_docs.begin',
205
219
  'nbdev/processors.py'),
220
+ 'nbdev.processors.ai_magics': ('api/processors.html#ai_magics', 'nbdev/processors.py'),
206
221
  'nbdev.processors.boxify': ('api/processors.html#boxify', 'nbdev/processors.py'),
207
222
  'nbdev.processors.cell_lang': ('api/processors.html#cell_lang', 'nbdev/processors.py'),
208
223
  'nbdev.processors.clean_magics': ('api/processors.html#clean_magics', 'nbdev/processors.py'),
@@ -250,20 +265,22 @@ d = { 'settings': { 'branch': 'master',
250
265
  'nbdev.quarto._SidebarYmlRemoved.__init__': ( 'api/quarto.html#_sidebarymlremoved.__init__',
251
266
  'nbdev/quarto.py'),
252
267
  'nbdev.quarto._copytree': ('api/quarto.html#_copytree', 'nbdev/quarto.py'),
268
+ 'nbdev.quarto._doc_mtime_not_older': ('api/quarto.html#_doc_mtime_not_older', 'nbdev/quarto.py'),
253
269
  'nbdev.quarto._ensure_quarto': ('api/quarto.html#_ensure_quarto', 'nbdev/quarto.py'),
254
270
  'nbdev.quarto._install_linux': ('api/quarto.html#_install_linux', 'nbdev/quarto.py'),
255
271
  'nbdev.quarto._install_mac': ('api/quarto.html#_install_mac', 'nbdev/quarto.py'),
256
272
  'nbdev.quarto._nbglob_docs': ('api/quarto.html#_nbglob_docs', 'nbdev/quarto.py'),
257
273
  'nbdev.quarto._pre': ('api/quarto.html#_pre', 'nbdev/quarto.py'),
258
274
  'nbdev.quarto._pre_docs': ('api/quarto.html#_pre_docs', 'nbdev/quarto.py'),
259
- 'nbdev.quarto._readme_mtime_not_older': ('api/quarto.html#_readme_mtime_not_older', 'nbdev/quarto.py'),
260
275
  'nbdev.quarto._recursive_parser': ('api/quarto.html#_recursive_parser', 'nbdev/quarto.py'),
276
+ 'nbdev.quarto._save_cached_contributing': ('api/quarto.html#_save_cached_contributing', 'nbdev/quarto.py'),
261
277
  'nbdev.quarto._save_cached_readme': ('api/quarto.html#_save_cached_readme', 'nbdev/quarto.py'),
262
278
  'nbdev.quarto._sort': ('api/quarto.html#_sort', 'nbdev/quarto.py'),
263
279
  'nbdev.quarto._sprun': ('api/quarto.html#_sprun', 'nbdev/quarto.py'),
264
280
  'nbdev.quarto.fs_watchdog': ('api/quarto.html#fs_watchdog', 'nbdev/quarto.py'),
265
281
  'nbdev.quarto.install': ('api/quarto.html#install', 'nbdev/quarto.py'),
266
282
  'nbdev.quarto.install_quarto': ('api/quarto.html#install_quarto', 'nbdev/quarto.py'),
283
+ 'nbdev.quarto.nbdev_contributing': ('api/quarto.html#nbdev_contributing', 'nbdev/quarto.py'),
267
284
  'nbdev.quarto.nbdev_docs': ('api/quarto.html#nbdev_docs', 'nbdev/quarto.py'),
268
285
  'nbdev.quarto.nbdev_preview': ('api/quarto.html#nbdev_preview', 'nbdev/quarto.py'),
269
286
  'nbdev.quarto.nbdev_proc_nbs': ('api/quarto.html#nbdev_proc_nbs', 'nbdev/quarto.py'),
@@ -312,36 +329,9 @@ d = { 'settings': { 'branch': 'master',
312
329
  'nbdev.showdoc.BasicMarkdownRenderer': ('api/showdoc.html#basicmarkdownrenderer', 'nbdev/showdoc.py'),
313
330
  'nbdev.showdoc.BasicMarkdownRenderer._repr_markdown_': ( 'api/showdoc.html#basicmarkdownrenderer._repr_markdown_',
314
331
  'nbdev/showdoc.py'),
315
- 'nbdev.showdoc.DocmentTbl': ('api/showdoc.html#docmenttbl', 'nbdev/showdoc.py'),
316
- 'nbdev.showdoc.DocmentTbl.__eq__': ('api/showdoc.html#docmenttbl.__eq__', 'nbdev/showdoc.py'),
317
- 'nbdev.showdoc.DocmentTbl.__init__': ('api/showdoc.html#docmenttbl.__init__', 'nbdev/showdoc.py'),
318
- 'nbdev.showdoc.DocmentTbl._columns': ('api/showdoc.html#docmenttbl._columns', 'nbdev/showdoc.py'),
319
- 'nbdev.showdoc.DocmentTbl._hdr_list': ('api/showdoc.html#docmenttbl._hdr_list', 'nbdev/showdoc.py'),
320
- 'nbdev.showdoc.DocmentTbl._repr_markdown_': ( 'api/showdoc.html#docmenttbl._repr_markdown_',
321
- 'nbdev/showdoc.py'),
322
- 'nbdev.showdoc.DocmentTbl._row': ('api/showdoc.html#docmenttbl._row', 'nbdev/showdoc.py'),
323
- 'nbdev.showdoc.DocmentTbl._row_list': ('api/showdoc.html#docmenttbl._row_list', 'nbdev/showdoc.py'),
324
- 'nbdev.showdoc.DocmentTbl.has_docment': ('api/showdoc.html#docmenttbl.has_docment', 'nbdev/showdoc.py'),
325
- 'nbdev.showdoc.DocmentTbl.has_return': ('api/showdoc.html#docmenttbl.has_return', 'nbdev/showdoc.py'),
326
- 'nbdev.showdoc.DocmentTbl.hdr_str': ('api/showdoc.html#docmenttbl.hdr_str', 'nbdev/showdoc.py'),
327
- 'nbdev.showdoc.DocmentTbl.params_str': ('api/showdoc.html#docmenttbl.params_str', 'nbdev/showdoc.py'),
328
- 'nbdev.showdoc.DocmentTbl.return_str': ('api/showdoc.html#docmenttbl.return_str', 'nbdev/showdoc.py'),
329
- 'nbdev.showdoc.ShowDocRenderer': ('api/showdoc.html#showdocrenderer', 'nbdev/showdoc.py'),
330
- 'nbdev.showdoc.ShowDocRenderer.__init__': ('api/showdoc.html#showdocrenderer.__init__', 'nbdev/showdoc.py'),
331
- 'nbdev.showdoc._bold': ('api/showdoc.html#_bold', 'nbdev/showdoc.py'),
332
- 'nbdev.showdoc._docstring': ('api/showdoc.html#_docstring', 'nbdev/showdoc.py'),
333
- 'nbdev.showdoc._escape_markdown': ('api/showdoc.html#_escape_markdown', 'nbdev/showdoc.py'),
332
+ 'nbdev.showdoc._create_html_table': ('api/showdoc.html#_create_html_table', 'nbdev/showdoc.py'),
334
333
  'nbdev.showdoc._ext_link': ('api/showdoc.html#_ext_link', 'nbdev/showdoc.py'),
335
- 'nbdev.showdoc._f_name': ('api/showdoc.html#_f_name', 'nbdev/showdoc.py'),
336
- 'nbdev.showdoc._fmt_anno': ('api/showdoc.html#_fmt_anno', 'nbdev/showdoc.py'),
337
- 'nbdev.showdoc._fmt_sig': ('api/showdoc.html#_fmt_sig', 'nbdev/showdoc.py'),
338
- 'nbdev.showdoc._fullname': ('api/showdoc.html#_fullname', 'nbdev/showdoc.py'),
339
334
  'nbdev.showdoc._html_link': ('api/showdoc.html#_html_link', 'nbdev/showdoc.py'),
340
- 'nbdev.showdoc._list2row': ('api/showdoc.html#_list2row', 'nbdev/showdoc.py'),
341
- 'nbdev.showdoc._maybe_nm': ('api/showdoc.html#_maybe_nm', 'nbdev/showdoc.py'),
342
- 'nbdev.showdoc._non_empty_keys': ('api/showdoc.html#_non_empty_keys', 'nbdev/showdoc.py'),
343
- 'nbdev.showdoc._show_param': ('api/showdoc.html#_show_param', 'nbdev/showdoc.py'),
344
- 'nbdev.showdoc._wrap_sig': ('api/showdoc.html#_wrap_sig', 'nbdev/showdoc.py'),
345
335
  'nbdev.showdoc.colab_link': ('api/showdoc.html#colab_link', 'nbdev/showdoc.py'),
346
336
  'nbdev.showdoc.doc': ('api/showdoc.html#doc', 'nbdev/showdoc.py'),
347
337
  'nbdev.showdoc.show_doc': ('api/showdoc.html#show_doc', 'nbdev/showdoc.py'),
@@ -1,9 +1,11 @@
1
+ """Strip superfluous metadata from notebooks"""
2
+
1
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/11_clean.ipynb.
2
4
 
3
5
  # %% auto 0
4
6
  __all__ = ['nbdev_trust', 'clean_nb', 'process_write', 'nbdev_clean', 'clean_jupyter', 'nbdev_install_hooks']
5
7
 
6
- # %% ../nbs/api/11_clean.ipynb 2
8
+ # %% ../nbs/api/11_clean.ipynb
7
9
  import ast,warnings,stat
8
10
  from astunparse import unparse
9
11
  from textwrap import indent
@@ -18,7 +20,7 @@ from .config import *
18
20
  from .sync import *
19
21
  from .process import first_code_ln
20
22
 
21
- # %% ../nbs/api/11_clean.ipynb 6
23
+ # %% ../nbs/api/11_clean.ipynb
22
24
  @call_parse
23
25
  def nbdev_trust(
24
26
  fname:str=None, # A notebook name or glob to trust
@@ -30,6 +32,7 @@ def nbdev_trust(
30
32
  import warnings
31
33
  warnings.warn("Please install jupyter and try again")
32
34
  return
35
+ from nbformat import read
33
36
 
34
37
  fname = Path(fname if fname else get_config().nbs_path)
35
38
  path = fname if fname.is_dir() else fname.parent
@@ -40,11 +43,11 @@ def nbdev_trust(
40
43
  if last_checked and not force_all:
41
44
  last_changed = os.path.getmtime(fn)
42
45
  if last_changed < last_checked: continue
43
- nb = read_nb(fn)
46
+ with open(fn, 'r', encoding='utf-8') as f: nb = read(f, as_version=4)
44
47
  if not NotebookNotary().check_signature(nb): NotebookNotary().sign(nb)
45
48
  check_fname.touch(exist_ok=True)
46
49
 
47
- # %% ../nbs/api/11_clean.ipynb 9
50
+ # %% ../nbs/api/11_clean.ipynb
48
51
  _repr_id_re = re.compile('(<.*?)( at 0x[0-9a-fA-F]+)(>)')
49
52
 
50
53
  _sub = partial(_repr_id_re.sub, r'\1\3')
@@ -54,7 +57,7 @@ def _skip_or_sub(x): return _sub(x) if "at 0x" in x else x
54
57
  def _clean_cell_output_id(lines):
55
58
  return _skip_or_sub(lines) if isinstance(lines,str) else [_skip_or_sub(o) for o in lines]
56
59
 
57
- # %% ../nbs/api/11_clean.ipynb 11
60
+ # %% ../nbs/api/11_clean.ipynb
58
61
  def _clean_cell_output(cell, clean_ids):
59
62
  "Remove `cell` output execution count and optionally ids from text reprs"
60
63
  outputs = cell.get('outputs', [])
@@ -66,9 +69,9 @@ def _clean_cell_output(cell, clean_ids):
66
69
  if k.startswith('text') and clean_ids: data[k] = _clean_cell_output_id(data[k])
67
70
  if k.startswith('image') and "svg" not in k: data[k] = data[k].rstrip()
68
71
  if 'text' in o and clean_ids: o['text'] = _clean_cell_output_id(o['text'])
69
- o.get('metadata', {}).pop('tags', None)
72
+ # o.get('metadata', {}).pop('tags', None)
70
73
 
71
- # %% ../nbs/api/11_clean.ipynb 12
74
+ # %% ../nbs/api/11_clean.ipynb
72
75
  def _clean_cell(cell, clear_all, allowed_metadata_keys, clean_ids):
73
76
  "Clean `cell` by removing superfluous metadata or everything except the input if `clear_all`"
74
77
  if 'execution_count' in cell: cell['execution_count'] = None
@@ -79,7 +82,7 @@ def _clean_cell(cell, clear_all, allowed_metadata_keys, clean_ids):
79
82
  cell['metadata'] = {} if clear_all else {
80
83
  k:v for k,v in cell['metadata'].items() if k in allowed_metadata_keys}
81
84
 
82
- # %% ../nbs/api/11_clean.ipynb 13
85
+ # %% ../nbs/api/11_clean.ipynb
83
86
  def clean_nb(
84
87
  nb, # The notebook to clean
85
88
  clear_all=False, # Remove all cell metadata and cell outputs?
@@ -97,12 +100,12 @@ def clean_nb(
97
100
  nb['metadata']['kernelspec']['display_name'] = nb["metadata"]["kernelspec"]["name"]
98
101
  nb['metadata'] = {k:v for k,v in nb['metadata'].items() if k in metadata_keys}
99
102
 
100
- # %% ../nbs/api/11_clean.ipynb 26
103
+ # %% ../nbs/api/11_clean.ipynb
101
104
  def _reconfigure(*strms):
102
105
  for s in strms:
103
106
  if hasattr(s,'reconfigure'): s.reconfigure(encoding='utf-8')
104
107
 
105
- # %% ../nbs/api/11_clean.ipynb 27
108
+ # %% ../nbs/api/11_clean.ipynb
106
109
  def process_write(warn_msg, proc_nb, f_in, f_out=None, disp=False):
107
110
  if not f_out: f_out = f_in
108
111
  if isinstance(f_in, (str,Path)): f_in = Path(f_in).open(encoding="utf-8")
@@ -115,15 +118,16 @@ def process_write(warn_msg, proc_nb, f_in, f_out=None, disp=False):
115
118
  warn(f'{warn_msg}')
116
119
  warn(e)
117
120
 
118
- # %% ../nbs/api/11_clean.ipynb 28
121
+ # %% ../nbs/api/11_clean.ipynb
119
122
  def _nbdev_clean(nb, path=None, clear_all=None):
120
123
  cfg = get_config(path=path)
121
124
  clear_all = clear_all or cfg.clear_all
122
125
  allowed_metadata_keys = cfg.get("allowed_metadata_keys").split()
123
126
  allowed_cell_metadata_keys = cfg.get("allowed_cell_metadata_keys").split()
124
- return clean_nb(nb, clear_all, allowed_metadata_keys, allowed_cell_metadata_keys, cfg.clean_ids)
127
+ clean_nb(nb, clear_all, allowed_metadata_keys, allowed_cell_metadata_keys, cfg.clean_ids)
128
+ if path: nbdev_trust.__wrapped__(path)
125
129
 
126
- # %% ../nbs/api/11_clean.ipynb 29
130
+ # %% ../nbs/api/11_clean.ipynb
127
131
  @call_parse
128
132
  def nbdev_clean(
129
133
  fname:str=None, # A notebook name or glob to clean
@@ -139,7 +143,7 @@ def nbdev_clean(
139
143
  if fname is None: fname = get_config().nbs_path
140
144
  for f in globtastic(fname, file_glob='*.ipynb', skip_folder_re='^[_.]'): _write(f_in=f, disp=disp)
141
145
 
142
- # %% ../nbs/api/11_clean.ipynb 32
146
+ # %% ../nbs/api/11_clean.ipynb
143
147
  def clean_jupyter(path, model, **kwargs):
144
148
  "Clean Jupyter `model` pre save to `path`"
145
149
  if not (model['type']=='notebook' and model['content']['nbformat']==4): return
@@ -147,7 +151,7 @@ def clean_jupyter(path, model, **kwargs):
147
151
  jupyter_hooks = get_config(path=path).jupyter_hooks
148
152
  if jupyter_hooks: _nbdev_clean(model['content'], path=path)
149
153
 
150
- # %% ../nbs/api/11_clean.ipynb 35
154
+ # %% ../nbs/api/11_clean.ipynb
151
155
  _pre_save_hook_src = '''
152
156
  def nbdev_clean_jupyter(**kwargs):
153
157
  try: from nbdev.clean import clean_jupyter
@@ -157,7 +161,7 @@ def nbdev_clean_jupyter(**kwargs):
157
161
  c.ContentsManager.pre_save_hook = nbdev_clean_jupyter'''.strip()
158
162
  _pre_save_hook_re = re.compile(r'c\.(File)?ContentsManager\.pre_save_hook')
159
163
 
160
- # %% ../nbs/api/11_clean.ipynb 36
164
+ # %% ../nbs/api/11_clean.ipynb
161
165
  def _add_jupyter_hooks(src, path):
162
166
  if _pre_save_hook_src in src: return
163
167
  mod = ast.parse(src)
@@ -175,12 +179,12 @@ def _add_jupyter_hooks(src, path):
175
179
  if src: src+='\n\n'
176
180
  return src+_pre_save_hook_src
177
181
 
178
- # %% ../nbs/api/11_clean.ipynb 40
182
+ # %% ../nbs/api/11_clean.ipynb
179
183
  def _git_root():
180
184
  try: return Path(run('git rev-parse --show-toplevel'))
181
185
  except OSError: return None
182
186
 
183
- # %% ../nbs/api/11_clean.ipynb 43
187
+ # %% ../nbs/api/11_clean.ipynb
184
188
  @call_parse
185
189
  def nbdev_install_hooks():
186
190
  "Install Jupyter and git hooks to automatically clean, trust, and fix merge conflicts in notebooks"
@@ -1,8 +1,11 @@
1
+ """CLI commands"""
2
+
1
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/13_cli.ipynb.
2
4
 
3
5
  # %% ../nbs/api/13_cli.ipynb 2
4
6
  from __future__ import annotations
5
7
  import warnings
8
+ import time
6
9
 
7
10
  from .config import *
8
11
  from .process import *
@@ -10,9 +13,11 @@ from .processors import *
10
13
  from .doclinks import *
11
14
  from .test import *
12
15
  from .clean import *
13
- from .quarto import nbdev_readme, refresh_quarto_yml
16
+ from .quarto import nbdev_readme, nbdev_contributing, refresh_quarto_yml, fs_watchdog
17
+ from .export import nb_export
14
18
  from .frontmatter import FrontmatterProc
15
19
 
20
+ from fastcore.xtras import run
16
21
  from execnb.nbio import *
17
22
  from fastcore.meta import *
18
23
  from fastcore.utils import *
@@ -25,9 +30,10 @@ from contextlib import redirect_stdout
25
30
  import os, tarfile, sys
26
31
 
27
32
  # %% auto 0
28
- __all__ = ['mapping', 'nbdev_filter', 'extract_tgz', 'nbdev_new', 'nbdev_update_license', 'chelp']
33
+ __all__ = ['mapping', 'nbdev_filter', 'extract_tgz', 'nbdev_new', 'nbdev_update_license', 'nb_export_cli', 'watch_export',
34
+ 'chelp']
29
35
 
30
- # %% ../nbs/api/13_cli.ipynb 5
36
+ # %% ../nbs/api/13_cli.ipynb
31
37
  @call_parse
32
38
  def nbdev_filter(
33
39
  nb_txt:str=None, # Notebook text (uses stdin if not provided)
@@ -50,12 +56,12 @@ def nbdev_filter(
50
56
  if printit: print(res, flush=True)
51
57
  else: return res
52
58
 
53
- # %% ../nbs/api/13_cli.ipynb 8
59
+ # %% ../nbs/api/13_cli.ipynb
54
60
  def extract_tgz(url, dest='.'):
55
61
  from fastcore.net import urlopen
56
62
  with urlopen(url) as u: tarfile.open(mode='r:gz', fileobj=u).extractall(dest)
57
63
 
58
- # %% ../nbs/api/13_cli.ipynb 9
64
+ # %% ../nbs/api/13_cli.ipynb
59
65
  def _render_nb(fn, cfg):
60
66
  "Render templated values like `{{lib_name}}` in notebook at `fn` from `cfg`"
61
67
  txt = fn.read_text()
@@ -63,7 +69,7 @@ def _render_nb(fn, cfg):
63
69
  for k,v in cfg.d.items(): txt = txt.replace('{{'+k+'}}', v)
64
70
  fn.write_text(txt)
65
71
 
66
- # %% ../nbs/api/13_cli.ipynb 10
72
+ # %% ../nbs/api/13_cli.ipynb
67
73
  def _update_repo_meta(cfg):
68
74
  "Enable gh pages and update the homepage and description in your GitHub repo."
69
75
  token=os.getenv('GITHUB_TOKEN')
@@ -74,7 +80,7 @@ def _update_repo_meta(cfg):
74
80
  except HTTPError:print(f"Could not update the description & URL on the repo: {cfg.user}/{cfg.repo} using $GITHUB_TOKEN.\n"
75
81
  "Use a token with the correction permissions or perform these steps manually.")
76
82
 
77
- # %% ../nbs/api/13_cli.ipynb 11
83
+ # %% ../nbs/api/13_cli.ipynb
78
84
  @call_parse
79
85
  @delegates(nbdev_create_config)
80
86
  def nbdev_new(**kwargs):
@@ -83,30 +89,25 @@ def nbdev_new(**kwargs):
83
89
  nbdev_create_config.__wrapped__(**kwargs)
84
90
  cfg = get_config()
85
91
  _update_repo_meta(cfg)
86
-
87
92
  path = Path()
88
93
 
89
- _ORG_OR_USR = 'fastai'
90
- _REPOSITORY = 'nbdev-template'
94
+ _ORG_OR_USR,_REPOSITORY = 'answerdotai','nbdev-template'
91
95
  _TEMPLATE = f'{_ORG_OR_USR}/{_REPOSITORY}'
92
96
  template = kwargs.get('template', _TEMPLATE)
93
- try:
94
- org_or_usr, repo = template.split('/')
95
- except ValueError:
96
- org_or_usr, repo = _ORG_OR_USR, _REPOSITORY
97
-
97
+ try: org_or_usr, repo = template.split('/')
98
+ except ValueError: org_or_usr, repo = _ORG_OR_USR, _REPOSITORY
98
99
 
99
100
  tag = kwargs.get('tag', None)
100
101
  if tag is None:
101
102
  with warnings.catch_warnings():
102
103
  warnings.simplefilter('ignore', UserWarning)
103
-
104
- tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release(org_or_usr, repo).tag_name
104
+ tag = GhApi(gh_host='https://api.github.com', authenticate=False
105
+ ).repos.get_latest_release(org_or_usr, repo).tag_name
105
106
 
106
107
  url = f"https://github.com/{org_or_usr}/{repo}/archive/{tag}.tar.gz"
107
108
  extract_tgz(url)
108
109
  tmpl_path = path/f'{repo}-{tag}'
109
-
110
+
110
111
  cfg.nbs_path.mkdir(exist_ok=True)
111
112
  nbexists = bool(first(cfg.nbs_path.glob('*.ipynb')))
112
113
  _nbs_path_sufs = ('.ipynb','.css')
@@ -119,11 +120,11 @@ def nbdev_new(**kwargs):
119
120
  rmtree(tmpl_path)
120
121
 
121
122
  refresh_quarto_yml()
122
-
123
123
  nbdev_export.__wrapped__()
124
124
  nbdev_readme.__wrapped__()
125
+ nbdev_contributing.__wrapped__()
125
126
 
126
- # %% ../nbs/api/13_cli.ipynb 13
127
+ # %% ../nbs/api/13_cli.ipynb
127
128
  mapping = {
128
129
  'mit': 'mit',
129
130
  'apache2': 'apache-2.0',
@@ -132,7 +133,7 @@ mapping = {
132
133
  'bsd3': 'bsd-3-clause'
133
134
  }
134
135
 
135
- # %% ../nbs/api/13_cli.ipynb 14
136
+ # %% ../nbs/api/13_cli.ipynb
136
137
  @call_parse
137
138
  def nbdev_update_license(
138
139
  to: str=None, # update license to
@@ -163,7 +164,41 @@ def nbdev_update_license(
163
164
  lic.write(body)
164
165
  print(f"License updated from {curr_lic} to {to}")
165
166
 
166
- # %% ../nbs/api/13_cli.ipynb 17
167
+ # %% ../nbs/api/13_cli.ipynb
168
+ @call_parse
169
+ @delegates(nb_export, but=['procs', 'mod_maker'])
170
+ def nb_export_cli(nbname,
171
+ debug:store_true=False, # Debug flag
172
+ **kwargs):
173
+ "Export a single nbdev notebook to a python script."
174
+ return nb_export(nbname=nbname, debug=debug, **kwargs)
175
+
176
+ # %% ../nbs/api/13_cli.ipynb
177
+ @call_parse
178
+ def watch_export(nbs:str=None, # Nb directory to watch for changes
179
+ lib:str=None, # Export directory to write py files to
180
+ force:bool=False # Ignore nbdev config if in nbdev project
181
+ ):
182
+ '''Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available'''
183
+ cfg = get_config() if is_nbdev() else None
184
+ nbs = nbs or (cfg.nbs_path if cfg else '.')
185
+ lib = lib or (cfg.lib_path if cfg else '.')
186
+ if cfg and (nbs != cfg.nbs_path or lib != cfg.lib_path) and not force:
187
+ raise ValueError("In nbdev project. Use --force to override config.")
188
+ run(f'nbdev_export')
189
+ def _export(e,lib=lib):
190
+ p = e.src_path
191
+ if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith(('tmp','.~'))):
192
+ if e.event_type == 'modified':
193
+ time.sleep(0.1)
194
+ try: run(f'nb_export --lib_path {lib} "{p}"')
195
+ except IOError:
196
+ time.sleep(0.3)
197
+ run(f'nb_export --lib_path {lib} "{p}"')
198
+ with fs_watchdog(_export, nbs):
199
+ while True: time.sleep(1)
200
+
201
+ # %% ../nbs/api/13_cli.ipynb
167
202
  @call_parse
168
203
  def chelp():
169
204
  "Show help for all console scripts"