nbdev 2.4.9__tar.gz → 3.0.6__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 (42) hide show
  1. {nbdev-2.4.9 → nbdev-3.0.6}/CONTRIBUTING.md +11 -1
  2. {nbdev-2.4.9/nbdev.egg-info → nbdev-3.0.6}/PKG-INFO +38 -37
  3. {nbdev-2.4.9 → nbdev-3.0.6}/README.md +28 -11
  4. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/__init__.py +1 -1
  5. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/_modidx.py +25 -16
  6. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/clean.py +24 -22
  7. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/cli.py +29 -30
  8. nbdev-3.0.6/nbdev/config.py +368 -0
  9. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/diff.py +9 -9
  10. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/doclinks.py +33 -36
  11. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/export.py +10 -12
  12. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/frontmatter.py +4 -4
  13. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/maker.py +22 -22
  14. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/merge.py +10 -10
  15. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/migrate.py +114 -20
  16. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/process.py +15 -15
  17. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/processors.py +26 -26
  18. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/qmd.py +9 -9
  19. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/quarto.py +30 -30
  20. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/release.py +58 -65
  21. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/serve.py +7 -7
  22. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/showdoc.py +9 -55
  23. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/sync.py +14 -11
  24. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/test.py +7 -7
  25. {nbdev-2.4.9 → nbdev-3.0.6/nbdev.egg-info}/PKG-INFO +38 -37
  26. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev.egg-info/SOURCES.txt +0 -3
  27. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev.egg-info/entry_points.txt +1 -0
  28. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev.egg-info/requires.txt +5 -3
  29. nbdev-3.0.6/pyproject.toml +82 -0
  30. nbdev-2.4.9/nbdev/config.py +0 -307
  31. nbdev-2.4.9/nbdev.egg-info/not-zip-safe +0 -1
  32. nbdev-2.4.9/pyproject.toml +0 -11
  33. nbdev-2.4.9/settings.ini +0 -76
  34. nbdev-2.4.9/setup.py +0 -61
  35. {nbdev-2.4.9 → nbdev-3.0.6}/LICENSE +0 -0
  36. {nbdev-2.4.9 → nbdev-3.0.6}/MANIFEST.in +0 -0
  37. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/extract_attachments.py +0 -0
  38. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/imports.py +0 -0
  39. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev/serve_drv.py +0 -0
  40. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev.egg-info/dependency_links.txt +0 -0
  41. {nbdev-2.4.9 → nbdev-3.0.6}/nbdev.egg-info/top_level.txt +0 -0
  42. {nbdev-2.4.9 → nbdev-3.0.6}/setup.cfg +0 -0
@@ -2,11 +2,21 @@
2
2
 
3
3
  ## How to get started
4
4
 
5
- Before anything else, please install the git hooks that run automatic scripts during each commit and merge to strip the notebooks of superfluous metadata (and avoid merge conflicts). After cloning the repository, run the following command inside it:
5
+ Install nbdev in editable mode with development dependencies:
6
+ ```sh
7
+ pip install -e '.[dev]'
6
8
  ```
9
+
10
+ Before anything else, please install the git hooks that run automatic scripts during each commit and merge to strip the notebooks of superfluous metadata (and avoid merge conflicts). After cloning the repository, run the following command inside it:
11
+ ```sh
7
12
  nbdev_install_hooks
8
13
  ```
9
14
 
15
+ Run the test suite to ensure everything is working:
16
+ ```sh
17
+ nbdev_test
18
+ ```
19
+
10
20
  ## Did you find a bug?
11
21
 
12
22
  * Ensure the bug was not already reported by searching on GitHub under Issues.
@@ -1,26 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 2.4.9
3
+ Version: 3.0.6
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
- Home-page: https://github.com/AnswerDotAI/nbdev
6
- Author: Jeremy Howard and Hamel Husain
7
- Author-email: j@fast.ai
8
- License: Apache Software License 2.0
5
+ Author-email: "Jeremy Howard and the fast.ai community" <j@fast.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/AnswerDotAI/nbdev
9
8
  Project-URL: Documentation, https://nbdev.fast.ai/
10
- Keywords: nbdev fastai jupyter notebook export
9
+ Keywords: nbdev,fastai,jupyter,notebook,export
11
10
  Classifier: Development Status :: 5 - Production/Stable
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
18
15
  Classifier: License :: OSI Approved :: Apache Software License
19
16
  Requires-Python: >=3.9
20
17
  Description-Content-Type: text/markdown
21
18
  License-File: LICENSE
22
- Requires-Dist: packaging
23
- Requires-Dist: fastcore>=1.11.0
19
+ Requires-Dist: fastcore>=1.12.3
24
20
  Requires-Dist: execnb>=0.1.12
25
21
  Requires-Dist: astunparse
26
22
  Requires-Dist: ghapi>=1.0.3
@@ -29,7 +25,8 @@ Requires-Dist: asttokens
29
25
  Requires-Dist: setuptools
30
26
  Requires-Dist: build
31
27
  Requires-Dist: fastgit
32
- Requires-Dist: PyYAML
28
+ Requires-Dist: pyyaml
29
+ Requires-Dist: tomli; python_version < "3.11"
33
30
  Provides-Extra: dev
34
31
  Requires-Dist: ipywidgets; extra == "dev"
35
32
  Requires-Dist: nbdev-numpy; extra == "dev"
@@ -43,20 +40,7 @@ Requires-Dist: pysymbol_llm; extra == "dev"
43
40
  Requires-Dist: llms-txt; extra == "dev"
44
41
  Requires-Dist: sphinx; extra == "dev"
45
42
  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
43
  Dynamic: license-file
55
- Dynamic: project-url
56
- Dynamic: provides-extra
57
- Dynamic: requires-dist
58
- Dynamic: requires-python
59
- Dynamic: summary
60
44
 
61
45
  # Getting Started
62
46
 
@@ -65,6 +49,22 @@ Dynamic: summary
65
49
 
66
50
  ![CI](https://github.com/fastai/nbdev/actions/workflows/test.yaml/badge.svg)
67
51
 
52
+ ## 🛑**Jan 2026 Major Version Update – Breaking Change**🛑
53
+
54
+ **nbdev3 is here!** As many of you have been requesting, configuration
55
+ has moved from `settings.ini` to `pyproject.toml`, following modern
56
+ Python packaging standards ([PEP
57
+ 621](https://peps.python.org/pep-0621/)). Your project metadata now
58
+ lives in the standard `[project]` section, while nbdev-specific settings
59
+ go in `[tool.nbdev]`.
60
+
61
+ **Migrating from nbdev2:** Run
62
+ [`nbdev_migrate_config`](https://nbdev.fast.ai/api/migrate.html#nbdev_migrate_config)
63
+ in your project root to automatically convert your `settings.ini` to
64
+ `pyproject.toml` and update your GitHub Actions workflows to use
65
+ nbdev3-compatible versions. Your existing notebooks and code don’t need
66
+ any changes.
67
+
68
68
  `nbdev` is a notebook-driven development platform. Simply write
69
69
  notebooks with lightweight markup and get high-quality documentation,
70
70
  tests, continuous integration, and packaging for free!
@@ -84,7 +84,10 @@ practices because tests and documentation are first class.
84
84
  package releases. Python best practices are automatically followed,
85
85
  for example, only exported objects are included in `__all__`
86
86
  - **Two-way sync between notebooks and plaintext source code** allowing
87
- you to use your IDE for code navigation or quick edits
87
+ you to use your IDE for code navigation or quick edits. Sync is
88
+ robust: each exported cell is tagged with its unique notebook cell ID,
89
+ so [`nbdev_update`](https://nbdev.fast.ai/api/sync.html#nbdev_update)
90
+ always updates the correct cell
88
91
  - **Tests** written as ordinary notebook cells are run in parallel with
89
92
  a single command
90
93
  - **Continuous integration** out-of-the-box with [GitHub
@@ -107,12 +110,6 @@ You can install nbdev with pip:
107
110
  pip install nbdev
108
111
  ```
109
112
 
110
- … or with conda (or mamba):
111
-
112
- ``` sh
113
- conda install -c fastai nbdev
114
- ```
115
-
116
113
  Note that `nbdev` must be installed into the same Python environment
117
114
  that you use for both Jupyter and your project.
118
115
 
@@ -139,11 +136,13 @@ available commands:
139
136
  !nbdev_help
140
137
  ```
141
138
 
142
- nbdev_bump_version Increment version in settings.ini by one
139
+ nb_export Export a single nbdev notebook to a python script.
140
+ nbdev_bump_version Increment version in __init__.py by one
143
141
  nbdev_changelog Create a CHANGELOG.md file from closed and labeled GitHub issues
144
142
  nbdev_clean Clean all notebooks in `fname` to avoid merge conflicts
145
143
  nbdev_conda Create a `meta.yaml` file ready to be built into a package, and optionally build and upload it
146
- nbdev_create_config Create a config file.
144
+ nbdev_contributing Create CONTRIBUTING.md from contributing_nb (defaults to 'contributing.ipynb' if present). Skips if the file doesn't exist.
145
+ nbdev_create_config Create a pyproject.toml config file.
147
146
  nbdev_docs Create Quarto docs and README.md
148
147
  nbdev_export Export notebooks in `path` to Python modules
149
148
  nbdev_filter A notebook filter for Quarto
@@ -154,6 +153,7 @@ available commands:
154
153
  nbdev_install_quarto Install latest Quarto on macOS or Linux, prints instructions for Windows
155
154
  nbdev_merge Git merge driver for notebooks
156
155
  nbdev_migrate Convert all markdown and notebook files in `path` from v1 to v2
156
+ nbdev_migrate_config Migrate settings.ini to pyproject.toml
157
157
  nbdev_new Create an nbdev project.
158
158
  nbdev_prepare Export, test, and clean notebooks, and render README if needed
159
159
  nbdev_preview Preview docs locally
@@ -163,12 +163,13 @@ available commands:
163
163
  nbdev_release_both Release both conda and PyPI packages
164
164
  nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
165
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.
166
+ nbdev_requirements Writes a `requirements.txt` file to `directory` based on pyproject.toml.
167
167
  nbdev_sidebar Create sidebar.yml
168
168
  nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
169
- nbdev_trust Trust notebooks matching `fname`
169
+ nbdev_trust Trust notebooks matching `fname`.
170
170
  nbdev_update Propagate change in modules matching `fname` to notebooks that created them
171
171
  nbdev_update_license Allows you to update the license of your project.
172
+ watch_export Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available
172
173
 
173
174
  ## FAQ
174
175
 
@@ -5,6 +5,22 @@
5
5
 
6
6
  ![CI](https://github.com/fastai/nbdev/actions/workflows/test.yaml/badge.svg)
7
7
 
8
+ ## 🛑**Jan 2026 Major Version Update – Breaking Change**🛑
9
+
10
+ **nbdev3 is here!** As many of you have been requesting, configuration
11
+ has moved from `settings.ini` to `pyproject.toml`, following modern
12
+ Python packaging standards ([PEP
13
+ 621](https://peps.python.org/pep-0621/)). Your project metadata now
14
+ lives in the standard `[project]` section, while nbdev-specific settings
15
+ go in `[tool.nbdev]`.
16
+
17
+ **Migrating from nbdev2:** Run
18
+ [`nbdev_migrate_config`](https://nbdev.fast.ai/api/migrate.html#nbdev_migrate_config)
19
+ in your project root to automatically convert your `settings.ini` to
20
+ `pyproject.toml` and update your GitHub Actions workflows to use
21
+ nbdev3-compatible versions. Your existing notebooks and code don’t need
22
+ any changes.
23
+
8
24
  `nbdev` is a notebook-driven development platform. Simply write
9
25
  notebooks with lightweight markup and get high-quality documentation,
10
26
  tests, continuous integration, and packaging for free!
@@ -24,7 +40,10 @@ practices because tests and documentation are first class.
24
40
  package releases. Python best practices are automatically followed,
25
41
  for example, only exported objects are included in `__all__`
26
42
  - **Two-way sync between notebooks and plaintext source code** allowing
27
- you to use your IDE for code navigation or quick edits
43
+ you to use your IDE for code navigation or quick edits. Sync is
44
+ robust: each exported cell is tagged with its unique notebook cell ID,
45
+ so [`nbdev_update`](https://nbdev.fast.ai/api/sync.html#nbdev_update)
46
+ always updates the correct cell
28
47
  - **Tests** written as ordinary notebook cells are run in parallel with
29
48
  a single command
30
49
  - **Continuous integration** out-of-the-box with [GitHub
@@ -47,12 +66,6 @@ You can install nbdev with pip:
47
66
  pip install nbdev
48
67
  ```
49
68
 
50
- … or with conda (or mamba):
51
-
52
- ``` sh
53
- conda install -c fastai nbdev
54
- ```
55
-
56
69
  Note that `nbdev` must be installed into the same Python environment
57
70
  that you use for both Jupyter and your project.
58
71
 
@@ -79,11 +92,13 @@ available commands:
79
92
  !nbdev_help
80
93
  ```
81
94
 
82
- nbdev_bump_version Increment version in settings.ini by one
95
+ nb_export Export a single nbdev notebook to a python script.
96
+ nbdev_bump_version Increment version in __init__.py by one
83
97
  nbdev_changelog Create a CHANGELOG.md file from closed and labeled GitHub issues
84
98
  nbdev_clean Clean all notebooks in `fname` to avoid merge conflicts
85
99
  nbdev_conda Create a `meta.yaml` file ready to be built into a package, and optionally build and upload it
86
- nbdev_create_config Create a config file.
100
+ nbdev_contributing Create CONTRIBUTING.md from contributing_nb (defaults to 'contributing.ipynb' if present). Skips if the file doesn't exist.
101
+ nbdev_create_config Create a pyproject.toml config file.
87
102
  nbdev_docs Create Quarto docs and README.md
88
103
  nbdev_export Export notebooks in `path` to Python modules
89
104
  nbdev_filter A notebook filter for Quarto
@@ -94,6 +109,7 @@ available commands:
94
109
  nbdev_install_quarto Install latest Quarto on macOS or Linux, prints instructions for Windows
95
110
  nbdev_merge Git merge driver for notebooks
96
111
  nbdev_migrate Convert all markdown and notebook files in `path` from v1 to v2
112
+ nbdev_migrate_config Migrate settings.ini to pyproject.toml
97
113
  nbdev_new Create an nbdev project.
98
114
  nbdev_prepare Export, test, and clean notebooks, and render README if needed
99
115
  nbdev_preview Preview docs locally
@@ -103,12 +119,13 @@ available commands:
103
119
  nbdev_release_both Release both conda and PyPI packages
104
120
  nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
105
121
  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.
122
+ nbdev_requirements Writes a `requirements.txt` file to `directory` based on pyproject.toml.
107
123
  nbdev_sidebar Create sidebar.yml
108
124
  nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
109
- nbdev_trust Trust notebooks matching `fname`
125
+ nbdev_trust Trust notebooks matching `fname`.
110
126
  nbdev_update Propagate change in modules matching `fname` to notebooks that created them
111
127
  nbdev_update_license Allows you to update the license of your project.
128
+ watch_export Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available
112
129
 
113
130
  ## FAQ
114
131
 
@@ -1,4 +1,4 @@
1
- __version__ = "2.4.9"
1
+ __version__ = "3.0.6"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
@@ -28,23 +28,31 @@ d = { 'settings': { 'branch': 'main',
28
28
  'nbdev.cli.nbdev_new': ('api/cli.html#nbdev_new', 'nbdev/cli.py'),
29
29
  'nbdev.cli.nbdev_update_license': ('api/cli.html#nbdev_update_license', 'nbdev/cli.py'),
30
30
  'nbdev.cli.watch_export': ('api/cli.html#watch_export', 'nbdev/cli.py')},
31
- 'nbdev.config': { 'nbdev.config._apply_defaults': ('api/config.html#_apply_defaults', 'nbdev/config.py'),
31
+ 'nbdev.config': { 'nbdev.config.ConfigToml': ('api/config.html#configtoml', 'nbdev/config.py'),
32
+ 'nbdev.config.ConfigToml.__getattr__': ('api/config.html#configtoml.__getattr__', 'nbdev/config.py'),
33
+ 'nbdev.config.ConfigToml.__getitem__': ('api/config.html#configtoml.__getitem__', 'nbdev/config.py'),
34
+ 'nbdev.config.ConfigToml.__init__': ('api/config.html#configtoml.__init__', 'nbdev/config.py'),
35
+ 'nbdev.config.ConfigToml.d': ('api/config.html#configtoml.d', 'nbdev/config.py'),
36
+ 'nbdev.config.ConfigToml.get': ('api/config.html#configtoml.get', 'nbdev/config.py'),
37
+ 'nbdev.config.ConfigToml.path': ('api/config.html#configtoml.path', 'nbdev/config.py'),
38
+ 'nbdev.config.ConfigToml.version': ('api/config.html#configtoml.version', 'nbdev/config.py'),
32
39
  'nbdev.config._basic_export_nb': ('api/config.html#_basic_export_nb', 'nbdev/config.py'),
33
- 'nbdev.config._cfg2txt': ('api/config.html#_cfg2txt', 'nbdev/config.py'),
34
40
  'nbdev.config._fetch_from_git': ('api/config.html#_fetch_from_git', 'nbdev/config.py'),
41
+ 'nbdev.config._find_nbdev_pyproject': ('api/config.html#_find_nbdev_pyproject', 'nbdev/config.py'),
35
42
  'nbdev.config._get_info': ('api/config.html#_get_info', 'nbdev/config.py'),
36
43
  'nbdev.config._git_repo': ('api/config.html#_git_repo', 'nbdev/config.py'),
44
+ 'nbdev.config._has_nbdev': ('api/config.html#_has_nbdev', 'nbdev/config.py'),
37
45
  'nbdev.config._has_py': ('api/config.html#_has_py', 'nbdev/config.py'),
38
- 'nbdev.config._nbdev_config_file': ('api/config.html#_nbdev_config_file', 'nbdev/config.py'),
39
- 'nbdev.config._prompt_user': ('api/config.html#_prompt_user', 'nbdev/config.py'),
40
- 'nbdev.config._type': ('api/config.html#_type', 'nbdev/config.py'),
41
- 'nbdev.config._xdg_config_paths': ('api/config.html#_xdg_config_paths', 'nbdev/config.py'),
46
+ 'nbdev.config._load_toml': ('api/config.html#_load_toml', 'nbdev/config.py'),
47
+ 'nbdev.config._user_config': ('api/config.html#_user_config', 'nbdev/config.py'),
42
48
  'nbdev.config.add_init': ('api/config.html#add_init', 'nbdev/config.py'),
43
- 'nbdev.config.config_key': ('api/config.html#config_key', 'nbdev/config.py'),
49
+ 'nbdev.config.bump_version': ('api/config.html#bump_version', 'nbdev/config.py'),
44
50
  'nbdev.config.create_output': ('api/config.html#create_output', 'nbdev/config.py'),
45
51
  'nbdev.config.get_config': ('api/config.html#get_config', 'nbdev/config.py'),
46
52
  'nbdev.config.is_nbdev': ('api/config.html#is_nbdev', 'nbdev/config.py'),
47
53
  'nbdev.config.nbdev_create_config': ('api/config.html#nbdev_create_config', 'nbdev/config.py'),
54
+ 'nbdev.config.read_version': ('api/config.html#read_version', 'nbdev/config.py'),
55
+ 'nbdev.config.set_version': ('api/config.html#set_version', 'nbdev/config.py'),
48
56
  'nbdev.config.show_src': ('api/config.html#show_src', 'nbdev/config.py'),
49
57
  'nbdev.config.update_proj': ('api/config.html#update_proj', 'nbdev/config.py'),
50
58
  'nbdev.config.update_version': ('api/config.html#update_version', 'nbdev/config.py'),
@@ -145,15 +153,20 @@ d = { 'settings': { 'branch': 'main',
145
153
  'nbdev.merge.unpatch': ('api/merge.html#unpatch', 'nbdev/merge.py')},
146
154
  'nbdev.migrate': { 'nbdev.migrate.MigrateProc': ('api/migrate.html#migrateproc', 'nbdev/migrate.py'),
147
155
  'nbdev.migrate.MigrateProc.begin': ('api/migrate.html#migrateproc.begin', 'nbdev/migrate.py'),
156
+ 'nbdev.migrate._build_classifiers': ('api/migrate.html#_build_classifiers', 'nbdev/migrate.py'),
148
157
  'nbdev.migrate._cat_slug': ('api/migrate.html#_cat_slug', 'nbdev/migrate.py'),
149
158
  'nbdev.migrate._co': ('api/migrate.html#_co', 'nbdev/migrate.py'),
150
159
  'nbdev.migrate._convert_callout': ('api/migrate.html#_convert_callout', 'nbdev/migrate.py'),
151
160
  'nbdev.migrate._convert_video': ('api/migrate.html#_convert_video', 'nbdev/migrate.py'),
152
161
  'nbdev.migrate._file_slug': ('api/migrate.html#_file_slug', 'nbdev/migrate.py'),
162
+ 'nbdev.migrate._fmt_script': ('api/migrate.html#_fmt_script', 'nbdev/migrate.py'),
153
163
  'nbdev.migrate._fp_convert': ('api/migrate.html#_fp_convert', 'nbdev/migrate.py'),
154
164
  'nbdev.migrate._fp_fm': ('api/migrate.html#_fp_fm', 'nbdev/migrate.py'),
155
165
  'nbdev.migrate._fp_image': ('api/migrate.html#_fp_image', 'nbdev/migrate.py'),
156
166
  'nbdev.migrate._is_jekyll_post': ('api/migrate.html#_is_jekyll_post', 'nbdev/migrate.py'),
167
+ 'nbdev.migrate._migrate_workflows': ('api/migrate.html#_migrate_workflows', 'nbdev/migrate.py'),
168
+ 'nbdev.migrate._nbdev_migrate_config': ('api/migrate.html#_nbdev_migrate_config', 'nbdev/migrate.py'),
169
+ 'nbdev.migrate._py_val': ('api/migrate.html#_py_val', 'nbdev/migrate.py'),
157
170
  'nbdev.migrate._re_v1': ('api/migrate.html#_re_v1', 'nbdev/migrate.py'),
158
171
  'nbdev.migrate._repl_directives': ('api/migrate.html#_repl_directives', 'nbdev/migrate.py'),
159
172
  'nbdev.migrate._repl_v1dir': ('api/migrate.html#_repl_v1dir', 'nbdev/migrate.py'),
@@ -161,11 +174,13 @@ d = { 'settings': { 'branch': 'main',
161
174
  'nbdev.migrate._replace_fm': ('api/migrate.html#_replace_fm', 'nbdev/migrate.py'),
162
175
  'nbdev.migrate._rm_quote': ('api/migrate.html#_rm_quote', 'nbdev/migrate.py'),
163
176
  'nbdev.migrate._subv1': ('api/migrate.html#_subv1', 'nbdev/migrate.py'),
177
+ 'nbdev.migrate._toml_val': ('api/migrate.html#_toml_val', 'nbdev/migrate.py'),
164
178
  'nbdev.migrate._v': ('api/migrate.html#_v', 'nbdev/migrate.py'),
165
179
  'nbdev.migrate.fp_md_fm': ('api/migrate.html#fp_md_fm', 'nbdev/migrate.py'),
166
180
  'nbdev.migrate.migrate_md': ('api/migrate.html#migrate_md', 'nbdev/migrate.py'),
167
181
  'nbdev.migrate.migrate_nb': ('api/migrate.html#migrate_nb', 'nbdev/migrate.py'),
168
- 'nbdev.migrate.nbdev_migrate': ('api/migrate.html#nbdev_migrate', 'nbdev/migrate.py')},
182
+ 'nbdev.migrate.nbdev_migrate': ('api/migrate.html#nbdev_migrate', 'nbdev/migrate.py'),
183
+ 'nbdev.migrate.nbdev_migrate_config': ('api/migrate.html#nbdev_migrate_config', 'nbdev/migrate.py')},
169
184
  'nbdev.process': { 'nbdev.process.NBProcessor': ('api/process.html#nbprocessor', 'nbdev/process.py'),
170
185
  'nbdev.process.NBProcessor.__init__': ('api/process.html#nbprocessor.__init__', 'nbdev/process.py'),
171
186
  'nbdev.process.NBProcessor._proc': ('api/process.html#nbprocessor._proc', 'nbdev/process.py'),
@@ -303,12 +318,12 @@ d = { 'settings': { 'branch': 'main',
303
318
  'nbdev.release._run': ('api/release.html#_run', 'nbdev/release.py'),
304
319
  'nbdev.release._write_yaml': ('api/release.html#_write_yaml', 'nbdev/release.py'),
305
320
  'nbdev.release.anaconda_upload': ('api/release.html#anaconda_upload', 'nbdev/release.py'),
306
- 'nbdev.release.bump_version': ('api/release.html#bump_version', 'nbdev/release.py'),
307
321
  'nbdev.release.changelog': ('api/release.html#changelog', 'nbdev/release.py'),
308
322
  'nbdev.release.chk_conda_rel': ('api/release.html#chk_conda_rel', 'nbdev/release.py'),
309
323
  'nbdev.release.conda_output_path': ('api/release.html#conda_output_path', 'nbdev/release.py'),
310
324
  'nbdev.release.latest_pypi': ('api/release.html#latest_pypi', 'nbdev/release.py'),
311
325
  'nbdev.release.nbdev_bump_version': ('api/release.html#nbdev_bump_version', 'nbdev/release.py'),
326
+ 'nbdev.release.push_release': ('api/release.html#push_release', 'nbdev/release.py'),
312
327
  'nbdev.release.pypi_details': ('api/release.html#pypi_details', 'nbdev/release.py'),
313
328
  'nbdev.release.pypi_json': ('api/release.html#pypi_json', 'nbdev/release.py'),
314
329
  'nbdev.release.release_both': ('api/release.html#release_both', 'nbdev/release.py'),
@@ -322,16 +337,10 @@ d = { 'settings': { 'branch': 'main',
322
337
  'nbdev.serve._proc_file': ('api/serve.html#_proc_file', 'nbdev/serve.py'),
323
338
  'nbdev.serve.proc_nbs': ('api/serve.html#proc_nbs', 'nbdev/serve.py')},
324
339
  'nbdev.serve_drv': {},
325
- 'nbdev.showdoc': { 'nbdev.showdoc.BasicHtmlRenderer': ('api/showdoc.html#basichtmlrenderer', 'nbdev/showdoc.py'),
326
- 'nbdev.showdoc.BasicHtmlRenderer._repr_html_': ( 'api/showdoc.html#basichtmlrenderer._repr_html_',
327
- 'nbdev/showdoc.py'),
328
- 'nbdev.showdoc.BasicHtmlRenderer.doc': ('api/showdoc.html#basichtmlrenderer.doc', 'nbdev/showdoc.py'),
329
- 'nbdev.showdoc.BasicMarkdownRenderer': ('api/showdoc.html#basicmarkdownrenderer', 'nbdev/showdoc.py'),
340
+ 'nbdev.showdoc': { 'nbdev.showdoc.BasicMarkdownRenderer': ('api/showdoc.html#basicmarkdownrenderer', 'nbdev/showdoc.py'),
330
341
  'nbdev.showdoc.BasicMarkdownRenderer._repr_markdown_': ( 'api/showdoc.html#basicmarkdownrenderer._repr_markdown_',
331
342
  'nbdev/showdoc.py'),
332
- 'nbdev.showdoc._create_html_table': ('api/showdoc.html#_create_html_table', 'nbdev/showdoc.py'),
333
343
  'nbdev.showdoc._ext_link': ('api/showdoc.html#_ext_link', 'nbdev/showdoc.py'),
334
- 'nbdev.showdoc._html_link': ('api/showdoc.html#_html_link', 'nbdev/showdoc.py'),
335
344
  'nbdev.showdoc.colab_link': ('api/showdoc.html#colab_link', 'nbdev/showdoc.py'),
336
345
  'nbdev.showdoc.doc': ('api/showdoc.html#doc', 'nbdev/showdoc.py'),
337
346
  'nbdev.showdoc.show_doc': ('api/showdoc.html#show_doc', 'nbdev/showdoc.py'),
@@ -2,31 +2,31 @@
2
2
 
3
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/11_clean.ipynb.
4
4
 
5
- # %% auto 0
5
+ # %% auto #0
6
6
  __all__ = ['nbdev_trust', 'clean_nb', 'process_write', 'nbdev_clean', 'clean_jupyter', 'nbdev_install_hooks']
7
7
 
8
- # %% ../nbs/api/11_clean.ipynb
8
+ # %% ../nbs/api/11_clean.ipynb #07637414
9
9
  import ast,warnings,stat
10
10
  from astunparse import unparse
11
11
  from textwrap import indent
12
12
 
13
13
  from execnb.nbio import *
14
14
  from fastcore.script import *
15
- from fastcore.basics import *
16
- from fastcore.imports import *
15
+ from fastcore.utils import *
16
+ from fastcore.xtras import *
17
17
 
18
18
  from .imports import *
19
19
  from .config import *
20
20
  from .sync import *
21
21
  from .process import first_code_ln
22
22
 
23
- # %% ../nbs/api/11_clean.ipynb
23
+ # %% ../nbs/api/11_clean.ipynb #4259f92c
24
24
  @call_parse
25
25
  def nbdev_trust(
26
26
  fname:str=None, # A notebook name or glob to trust
27
27
  force_all:bool=False # Also trust notebooks that haven't changed
28
28
  ):
29
- "Trust notebooks matching `fname`"
29
+ "Trust notebooks matching `fname`."
30
30
  try: from nbformat.sign import NotebookNotary
31
31
  except:
32
32
  import warnings
@@ -47,7 +47,7 @@ def nbdev_trust(
47
47
  if not NotebookNotary().check_signature(nb): NotebookNotary().sign(nb)
48
48
  check_fname.touch(exist_ok=True)
49
49
 
50
- # %% ../nbs/api/11_clean.ipynb
50
+ # %% ../nbs/api/11_clean.ipynb #a2ba2b4c
51
51
  _repr_id_re = re.compile('(<.*?)( at 0x[0-9a-fA-F]+)(>)')
52
52
 
53
53
  _sub = partial(_repr_id_re.sub, r'\1\3')
@@ -57,7 +57,7 @@ def _skip_or_sub(x): return _sub(x) if "at 0x" in x else x
57
57
  def _clean_cell_output_id(lines):
58
58
  return _skip_or_sub(lines) if isinstance(lines,str) else [_skip_or_sub(o) for o in lines]
59
59
 
60
- # %% ../nbs/api/11_clean.ipynb
60
+ # %% ../nbs/api/11_clean.ipynb #b4cde615
61
61
  def _clean_cell_output(cell, clean_ids):
62
62
  "Remove `cell` output execution count and optionally ids from text reprs"
63
63
  outputs = cell.get('outputs', [])
@@ -71,7 +71,7 @@ def _clean_cell_output(cell, clean_ids):
71
71
  if 'text' in o and clean_ids: o['text'] = _clean_cell_output_id(o['text'])
72
72
  # o.get('metadata', {}).pop('tags', None)
73
73
 
74
- # %% ../nbs/api/11_clean.ipynb
74
+ # %% ../nbs/api/11_clean.ipynb #2ba79c93
75
75
  def _clean_cell(cell, clear_all, allowed_metadata_keys, clean_ids):
76
76
  "Clean `cell` by removing superfluous metadata or everything except the input if `clear_all`"
77
77
  if 'execution_count' in cell: cell['execution_count'] = None
@@ -81,8 +81,9 @@ def _clean_cell(cell, clear_all, allowed_metadata_keys, clean_ids):
81
81
  if cell['source'] == ['']: cell['source'] = []
82
82
  cell['metadata'] = {} if clear_all else {
83
83
  k:v for k,v in cell['metadata'].items() if k in allowed_metadata_keys}
84
+ if 'id' not in cell: cell['id'] = rtoken_hex(4)
84
85
 
85
- # %% ../nbs/api/11_clean.ipynb
86
+ # %% ../nbs/api/11_clean.ipynb #e8101222
86
87
  def clean_nb(
87
88
  nb, # The notebook to clean
88
89
  clear_all=False, # Remove all cell metadata and cell outputs?
@@ -99,13 +100,15 @@ def clean_nb(
99
100
  if nb.get('metadata', {}).get('kernelspec', {}).get('name', None):
100
101
  nb['metadata']['kernelspec']['display_name'] = nb["metadata"]["kernelspec"]["name"]
101
102
  nb['metadata'] = {k:v for k,v in nb['metadata'].items() if k in metadata_keys}
103
+ # Cell IDs were added in nbformat 4.5
104
+ if nb.get('nbformat') == 4 and nb.get('nbformat_minor', 0) < 5: nb['nbformat_minor'] = 5
102
105
 
103
- # %% ../nbs/api/11_clean.ipynb
106
+ # %% ../nbs/api/11_clean.ipynb #604d83e6
104
107
  def _reconfigure(*strms):
105
108
  for s in strms:
106
109
  if hasattr(s,'reconfigure'): s.reconfigure(encoding='utf-8')
107
110
 
108
- # %% ../nbs/api/11_clean.ipynb
111
+ # %% ../nbs/api/11_clean.ipynb #d251837f
109
112
  def process_write(warn_msg, proc_nb, f_in, f_out=None, disp=False):
110
113
  if not f_out: f_out = f_in
111
114
  if isinstance(f_in, (str,Path)): f_in = Path(f_in).open(encoding="utf-8")
@@ -118,16 +121,16 @@ def process_write(warn_msg, proc_nb, f_in, f_out=None, disp=False):
118
121
  warn(f'{warn_msg}')
119
122
  warn(e)
120
123
 
121
- # %% ../nbs/api/11_clean.ipynb
124
+ # %% ../nbs/api/11_clean.ipynb #714357ce
122
125
  def _nbdev_clean(nb, path=None, clear_all=None):
123
126
  cfg = get_config(path=path)
124
127
  clear_all = clear_all or cfg.clear_all
125
- allowed_metadata_keys = cfg.get("allowed_metadata_keys").split()
126
- allowed_cell_metadata_keys = cfg.get("allowed_cell_metadata_keys").split()
128
+ allowed_metadata_keys = cfg.get("allowed_metadata_keys") or []
129
+ allowed_cell_metadata_keys = cfg.get("allowed_cell_metadata_keys") or []
127
130
  clean_nb(nb, clear_all, allowed_metadata_keys, allowed_cell_metadata_keys, cfg.clean_ids)
128
131
  if path: nbdev_trust.__wrapped__(path)
129
132
 
130
- # %% ../nbs/api/11_clean.ipynb
133
+ # %% ../nbs/api/11_clean.ipynb #6af3b9d4
131
134
  @call_parse
132
135
  def nbdev_clean(
133
136
  fname:str=None, # A notebook name or glob to clean
@@ -143,15 +146,14 @@ def nbdev_clean(
143
146
  if fname is None: fname = get_config().nbs_path
144
147
  for f in globtastic(fname, file_glob='*.ipynb', skip_folder_re='^[_.]'): _write(f_in=f, disp=disp)
145
148
 
146
- # %% ../nbs/api/11_clean.ipynb
149
+ # %% ../nbs/api/11_clean.ipynb #f84289fc
147
150
  def clean_jupyter(path, model, **kwargs):
148
151
  "Clean Jupyter `model` pre save to `path`"
149
152
  if not (model['type']=='notebook' and model['content']['nbformat']==4): return
150
- get_config.cache_clear() # Allow config changes without restarting Jupyter
151
153
  jupyter_hooks = get_config(path=path).jupyter_hooks
152
154
  if jupyter_hooks: _nbdev_clean(model['content'], path=path)
153
155
 
154
- # %% ../nbs/api/11_clean.ipynb
156
+ # %% ../nbs/api/11_clean.ipynb #b7c19563
155
157
  _pre_save_hook_src = '''
156
158
  def nbdev_clean_jupyter(**kwargs):
157
159
  try: from nbdev.clean import clean_jupyter
@@ -161,7 +163,7 @@ def nbdev_clean_jupyter(**kwargs):
161
163
  c.ContentsManager.pre_save_hook = nbdev_clean_jupyter'''.strip()
162
164
  _pre_save_hook_re = re.compile(r'c\.(File)?ContentsManager\.pre_save_hook')
163
165
 
164
- # %% ../nbs/api/11_clean.ipynb
166
+ # %% ../nbs/api/11_clean.ipynb #fcb8df4b
165
167
  def _add_jupyter_hooks(src, path):
166
168
  if _pre_save_hook_src in src: return
167
169
  mod = ast.parse(src)
@@ -179,12 +181,12 @@ def _add_jupyter_hooks(src, path):
179
181
  if src: src+='\n\n'
180
182
  return src+_pre_save_hook_src
181
183
 
182
- # %% ../nbs/api/11_clean.ipynb
184
+ # %% ../nbs/api/11_clean.ipynb #cc677e44
183
185
  def _git_root():
184
186
  try: return Path(run('git rev-parse --show-toplevel'))
185
187
  except OSError: return None
186
188
 
187
- # %% ../nbs/api/11_clean.ipynb
189
+ # %% ../nbs/api/11_clean.ipynb #e6083614
188
190
  @call_parse
189
191
  def nbdev_install_hooks():
190
192
  "Install Jupyter and git hooks to automatically clean, trust, and fix merge conflicts in notebooks"