nbdev 2.3.28__py3-none-any.whl → 2.3.29__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 CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2.3.28"
1
+ __version__ = "2.3.29"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
nbdev/_modidx.py CHANGED
@@ -204,6 +204,7 @@ d = { 'settings': { 'branch': 'master',
204
204
  'nbdev.processors.add_show_docs': ('api/processors.html#add_show_docs', 'nbdev/processors.py'),
205
205
  'nbdev.processors.add_show_docs.begin': ( 'api/processors.html#add_show_docs.begin',
206
206
  'nbdev/processors.py'),
207
+ 'nbdev.processors.ai_magics': ('api/processors.html#ai_magics', 'nbdev/processors.py'),
207
208
  'nbdev.processors.boxify': ('api/processors.html#boxify', 'nbdev/processors.py'),
208
209
  'nbdev.processors.cell_lang': ('api/processors.html#cell_lang', 'nbdev/processors.py'),
209
210
  'nbdev.processors.clean_magics': ('api/processors.html#clean_magics', 'nbdev/processors.py'),
nbdev/cli.py CHANGED
@@ -85,30 +85,24 @@ def nbdev_new(**kwargs):
85
85
  nbdev_create_config.__wrapped__(**kwargs)
86
86
  cfg = get_config()
87
87
  _update_repo_meta(cfg)
88
-
89
88
  path = Path()
90
89
 
91
- _ORG_OR_USR = 'fastai'
92
- _REPOSITORY = 'nbdev-template'
90
+ _ORG_OR_USR,_REPOSITORY = 'fastai','nbdev-template'
93
91
  _TEMPLATE = f'{_ORG_OR_USR}/{_REPOSITORY}'
94
92
  template = kwargs.get('template', _TEMPLATE)
95
- try:
96
- org_or_usr, repo = template.split('/')
97
- except ValueError:
98
- org_or_usr, repo = _ORG_OR_USR, _REPOSITORY
99
-
93
+ try: org_or_usr, repo = template.split('/')
94
+ except ValueError: org_or_usr, repo = _ORG_OR_USR, _REPOSITORY
100
95
 
101
96
  tag = kwargs.get('tag', None)
102
97
  if tag is None:
103
98
  with warnings.catch_warnings():
104
99
  warnings.simplefilter('ignore', UserWarning)
105
-
106
100
  tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release(org_or_usr, repo).tag_name
107
101
 
108
102
  url = f"https://github.com/{org_or_usr}/{repo}/archive/{tag}.tar.gz"
109
103
  extract_tgz(url)
110
104
  tmpl_path = path/f'{repo}-{tag}'
111
-
105
+
112
106
  cfg.nbs_path.mkdir(exist_ok=True)
113
107
  nbexists = bool(first(cfg.nbs_path.glob('*.ipynb')))
114
108
  _nbs_path_sufs = ('.ipynb','.css')
@@ -121,7 +115,6 @@ def nbdev_new(**kwargs):
121
115
  rmtree(tmpl_path)
122
116
 
123
117
  refresh_quarto_yml()
124
-
125
118
  nbdev_export.__wrapped__()
126
119
  nbdev_readme.__wrapped__()
127
120
 
nbdev/processors.py CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  # %% auto 0
6
6
  __all__ = ['populate_language', 'insert_warning', 'cell_lang', 'add_show_docs', 'fdiv', 'boxify', 'mv_exports', 'add_links',
7
- 'add_fold', 'strip_ansi', 'strip_hidden_metadata', 'hide_', 'hide_line', 'filter_stream_', 'clean_magics',
8
- 'rm_header_dash', 'rm_export', 'clean_show_doc', 'exec_show_docs', 'FilterDefaults']
7
+ 'add_fold', 'strip_ansi', 'strip_hidden_metadata', 'hide_', 'hide_line', 'filter_stream_', 'ai_magics',
8
+ 'clean_magics', 'rm_header_dash', 'rm_export', 'clean_show_doc', 'exec_show_docs', 'FilterDefaults']
9
9
 
10
10
  # %% ../nbs/api/10_processors.ipynb
11
11
  import ast
@@ -169,6 +169,15 @@ def filter_stream_(cell, *words):
169
169
  if outp.output_type == 'stream':
170
170
  outp['text'] = [l for l in outp.text if not re.search('|'.join(words), l)]
171
171
 
172
+ # %% ../nbs/api/10_processors.ipynb
173
+ _aimagics_pattern = re.compile(r'^\s*(%%ai.? |%%ai.?$)', re.MULTILINE)
174
+
175
+ def ai_magics(cell):
176
+ "A preprocessor to convert AI magics to markdown"
177
+ if cell.cell_type == 'code' and _aimagics_pattern.search(cell.source):
178
+ cell.cell_type ='markdown'
179
+ cell.source = '\n'.join(cell.source.splitlines()[1:])
180
+
172
181
  # %% ../nbs/api/10_processors.ipynb
173
182
  _magics_pattern = re.compile(r'^\s*(%%|%).*', re.MULTILINE)
174
183
 
@@ -268,7 +277,8 @@ class FilterDefaults:
268
277
  def base_procs(self):
269
278
  return [FrontmatterProc, populate_language, add_show_docs, insert_warning,
270
279
  strip_ansi, hide_line, filter_stream_, rm_header_dash,
271
- clean_show_doc, exec_show_docs, rm_export, clean_magics, hide_, add_links, add_fold, mv_exports, strip_hidden_metadata]
280
+ clean_show_doc, exec_show_docs, rm_export, ai_magics, clean_magics, hide_, add_links,
281
+ add_fold, mv_exports, strip_hidden_metadata]
272
282
 
273
283
  def procs(self):
274
284
  "Processors for export"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nbdev
3
- Version: 2.3.28
3
+ Version: 2.3.29
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
5
  Home-page: https://github.com/fastai/nbdev
6
6
  Author: Jeremy Howard and Hamel Husain
@@ -1,7 +1,7 @@
1
- nbdev/__init__.py,sha256=LZ6llAOIRZoQz_OhrYDg5PXdl6yInK0pfXpWXavwLQ4,90
2
- nbdev/_modidx.py,sha256=IeLqn-x3lCNqz3AVJRnI_Mg0H7IuL6ExlUVcEHdmtjQ,40455
1
+ nbdev/__init__.py,sha256=V0AkJoHiqkyoyngP3lLqQY3LjIUxTN1xBVL2pvMmm48,90
2
+ nbdev/_modidx.py,sha256=Pa-Ve3zq0R4qkykuda25oQ5Jw0YXa5u0ds6QK_siSmk,40577
3
3
  nbdev/clean.py,sha256=mVgsW2_g7KIXAVh8mwpj86UwMN6QVM-q33PDzA27nWw,9410
4
- nbdev/cli.py,sha256=RDiX70nwmXcfu6bkLlT3YcF7uQi0HcCkLmGOLE71o4w,5638
4
+ nbdev/cli.py,sha256=qGNwsrskbVazzyKDpTjwQsQcwEqAZBlFTlehHswasHs,5608
5
5
  nbdev/config.py,sha256=s2H8IYB6Fv3Pe7hZjC10TtF5OM_SvDM-TEHNwcTD4xs,12163
6
6
  nbdev/doclinks.py,sha256=t6tbISN4R-WyDCmXJeGjYadpc5kBGQnAIxBEsWw3kBw,10490
7
7
  nbdev/export.py,sha256=P4fzzPFs0VIaWXclfU1i3JtBdMpDNqq8lmV4oKv6n9Y,3574
@@ -12,7 +12,7 @@ nbdev/maker.py,sha256=JrvvtG23_tgT4i-zzDrUF1GmLhdL_9j4S-dcD-GVui4,9801
12
12
  nbdev/merge.py,sha256=xmT7LMY_mQGOGl0ynqkB13M6HwJfUOTis1Xl--YDXR8,4341
13
13
  nbdev/migrate.py,sha256=3Z4i170SqtUs7nan_LbKpx-sP1EH9rrbG3BOFrIv58Y,7310
14
14
  nbdev/process.py,sha256=Vb3SN5YW2gB9rYv5ToeveOeL9qM9AGLRPXCyAFiaE3g,5853
15
- nbdev/processors.py,sha256=JDqPAuNrVfoRzwWQ_XiATvxVjt8kXCJ5qiYiPXR8sJ4,11462
15
+ nbdev/processors.py,sha256=_tqCPskcfR9-DpBrcAgueLux8acdz3B9t6gQqKuMYLc,11858
16
16
  nbdev/qmd.py,sha256=VAxE-c1sT7y26VdyreB6j9fge-CuLbHWocRE_WbnYXg,2994
17
17
  nbdev/quarto.py,sha256=PaH3NdwgMAnAqIWM3oo9yhC0_VHvTU4ukpXNhiSOWB0,12051
18
18
  nbdev/release.py,sha256=Ucy71GzfOeOyGoeD5IoLvEaMya3-_0otDcD4gnpzCN0,14158
@@ -21,9 +21,9 @@ nbdev/serve_drv.py,sha256=IZ2acem_KKsXYYe0iUECiR_orkYLBkT1ZG_258ZS7SQ,657
21
21
  nbdev/showdoc.py,sha256=sSVyVw-hIIewJ12sxngVpvb_hoHVrmLcuZWjszqMzxE,9169
22
22
  nbdev/sync.py,sha256=eykW8weeOqoRLbNRCeKaO8QqD6_CwspOwnwgno44yxY,3088
23
23
  nbdev/test.py,sha256=_ECBd5fvfGEICIfkTI2S8w8YatL5CaPltCeDSsiH6yw,4435
24
- nbdev-2.3.28.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- nbdev-2.3.28.dist-info/METADATA,sha256=RehUDO0uv9ku3gpSSEmQwiu5E9yJfBMdsYiPnjpQEXk,10398
26
- nbdev-2.3.28.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
27
- nbdev-2.3.28.dist-info/entry_points.txt,sha256=GMherdbuc27OmIuaaom4eNx5sTdCvAdNrZA6XLEZOA8,1326
28
- nbdev-2.3.28.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
29
- nbdev-2.3.28.dist-info/RECORD,,
24
+ nbdev-2.3.29.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ nbdev-2.3.29.dist-info/METADATA,sha256=F-eXE1W3BJB_BdC-rNuc08fKiPNcsjl9Lxc-NxP_8Qw,10398
26
+ nbdev-2.3.29.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
27
+ nbdev-2.3.29.dist-info/entry_points.txt,sha256=GMherdbuc27OmIuaaom4eNx5sTdCvAdNrZA6XLEZOA8,1326
28
+ nbdev-2.3.29.dist-info/top_level.txt,sha256=3cWYLMuaXsZjz3TQRGEkWGs9Z8ieEDmYcq8TZS3y3vU,6
29
+ nbdev-2.3.29.dist-info/RECORD,,
File without changes