nbdev 2.3.32__tar.gz → 2.3.34__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 (39) hide show
  1. {nbdev-2.3.32/nbdev.egg-info → nbdev-2.3.34}/PKG-INFO +3 -2
  2. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/__init__.py +1 -1
  3. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/_modidx.py +3 -1
  4. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/config.py +1 -1
  5. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/doclinks.py +64 -25
  6. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/processors.py +1 -1
  7. {nbdev-2.3.32 → nbdev-2.3.34/nbdev.egg-info}/PKG-INFO +3 -2
  8. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev.egg-info/requires.txt +1 -0
  9. {nbdev-2.3.32 → nbdev-2.3.34}/settings.ini +6 -6
  10. {nbdev-2.3.32 → nbdev-2.3.34}/CONTRIBUTING.md +0 -0
  11. {nbdev-2.3.32 → nbdev-2.3.34}/LICENSE +0 -0
  12. {nbdev-2.3.32 → nbdev-2.3.34}/MANIFEST.in +0 -0
  13. {nbdev-2.3.32 → nbdev-2.3.34}/README.md +0 -0
  14. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/clean.py +0 -0
  15. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/cli.py +0 -0
  16. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/export.py +0 -0
  17. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/extract_attachments.py +0 -0
  18. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/frontmatter.py +0 -0
  19. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/imports.py +0 -0
  20. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/maker.py +0 -0
  21. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/merge.py +0 -0
  22. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/migrate.py +0 -0
  23. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/process.py +0 -0
  24. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/qmd.py +0 -0
  25. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/quarto.py +0 -0
  26. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/release.py +0 -0
  27. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/serve.py +0 -0
  28. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/serve_drv.py +0 -0
  29. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/showdoc.py +0 -0
  30. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/sync.py +0 -0
  31. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev/test.py +0 -0
  32. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev.egg-info/SOURCES.txt +0 -0
  33. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev.egg-info/dependency_links.txt +0 -0
  34. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev.egg-info/entry_points.txt +0 -0
  35. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev.egg-info/not-zip-safe +0 -0
  36. {nbdev-2.3.32 → nbdev-2.3.34}/nbdev.egg-info/top_level.txt +0 -0
  37. {nbdev-2.3.32 → nbdev-2.3.34}/pyproject.toml +0 -0
  38. {nbdev-2.3.32 → nbdev-2.3.34}/setup.cfg +0 -0
  39. {nbdev-2.3.32 → nbdev-2.3.34}/setup.py +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nbdev
3
- Version: 2.3.32
3
+ Version: 2.3.34
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
@@ -41,6 +41,7 @@ Requires-Dist: svg.py; extra == "dev"
41
41
  Requires-Dist: nbclassic; extra == "dev"
42
42
  Requires-Dist: pysymbol_llm; extra == "dev"
43
43
  Requires-Dist: llms-txt; extra == "dev"
44
+ Requires-Dist: sphinx; extra == "dev"
44
45
 
45
46
  # Getting Started
46
47
 
@@ -1,4 +1,4 @@
1
- __version__ = "2.3.32"
1
+ __version__ = "2.3.34"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
@@ -3,7 +3,7 @@
3
3
  d = { 'settings': { 'branch': 'master',
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'),
@@ -58,6 +58,7 @@ d = { 'settings': { 'branch': 'master',
58
58
  'nbdev.doclinks.NbdevLookup.link_line': ('api/doclinks.html#nbdevlookup.link_line', 'nbdev/doclinks.py'),
59
59
  'nbdev.doclinks.NbdevLookup.linkify': ('api/doclinks.html#nbdevlookup.linkify', 'nbdev/doclinks.py'),
60
60
  'nbdev.doclinks._binop_leafs': ('api/doclinks.html#_binop_leafs', 'nbdev/doclinks.py'),
61
+ 'nbdev.doclinks._build_lookup_table': ('api/doclinks.html#_build_lookup_table', 'nbdev/doclinks.py'),
61
62
  'nbdev.doclinks._build_modidx': ('api/doclinks.html#_build_modidx', 'nbdev/doclinks.py'),
62
63
  'nbdev.doclinks._find_mod': ('api/doclinks.html#_find_mod', 'nbdev/doclinks.py'),
63
64
  'nbdev.doclinks._get_exps': ('api/doclinks.html#_get_exps', 'nbdev/doclinks.py'),
@@ -69,6 +70,7 @@ d = { 'settings': { 'branch': 'master',
69
70
  'nbdev.doclinks._qual_sym': ('api/doclinks.html#_qual_sym', 'nbdev/doclinks.py'),
70
71
  'nbdev.doclinks._qual_syms': ('api/doclinks.html#_qual_syms', 'nbdev/doclinks.py'),
71
72
  'nbdev.doclinks._sym_nm': ('api/doclinks.html#_sym_nm', 'nbdev/doclinks.py'),
73
+ 'nbdev.doclinks.create_index': ('api/doclinks.html#create_index', 'nbdev/doclinks.py'),
72
74
  'nbdev.doclinks.nbdev_export': ('api/doclinks.html#nbdev_export', 'nbdev/doclinks.py'),
73
75
  'nbdev.doclinks.nbglob': ('api/doclinks.html#nbglob', 'nbdev/doclinks.py'),
74
76
  'nbdev.doclinks.nbglob_cli': ('api/doclinks.html#nbglob_cli', 'nbdev/doclinks.py'),
@@ -138,7 +138,7 @@ def _cfg2txt(cfg, head, sections, tail=''):
138
138
 
139
139
  # %% ../nbs/api/01_config.ipynb
140
140
  _nbdev_cfg_head = '''# All sections below are required unless otherwise specified.
141
- # See https://github.com/fastai/nbdev/blob/master/settings.ini for examples.
141
+ # See https://github.com/AnswerDotAI/nbdev/blob/main/settings.ini for examples.
142
142
 
143
143
  '''
144
144
  _nbdev_cfg_sections = {'Python library': 'repo lib_name version min_python license black_formatting',
@@ -3,7 +3,7 @@
3
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/05_doclinks.ipynb.
4
4
 
5
5
  # %% auto 0
6
- __all__ = ['patch_name', 'nbglob', 'nbglob_cli', 'nbdev_export', 'NbdevLookup']
6
+ __all__ = ['typs', 'bset', 'patch_name', 'nbglob', 'nbglob_cli', 'nbdev_export', 'create_index', 'NbdevLookup']
7
7
 
8
8
  # %% ../nbs/api/05_doclinks.ipynb
9
9
  from .config import *
@@ -14,14 +14,18 @@ from .imports import *
14
14
  from fastcore.script import *
15
15
  from fastcore.utils import *
16
16
  from fastcore.meta import delegates
17
+ from fastcore.net import urlread
17
18
 
18
- import ast,contextlib
19
+ import ast,builtins,contextlib
19
20
  import pkg_resources,importlib
20
- from astunparse import unparse
21
21
 
22
+ from astunparse import unparse
23
+ from io import BytesIO
24
+ from collections import defaultdict
22
25
  from pprint import pformat
23
26
  from urllib.parse import urljoin
24
27
  from functools import lru_cache
28
+ from types import ModuleType
25
29
 
26
30
  # %% ../nbs/api/05_doclinks.ipynb
27
31
  def _sym_nm(klas, sym): return f'{unparse(klas).strip()}.{sym.name}'
@@ -152,6 +156,28 @@ def nbdev_export(
152
156
  add_init(get_config().lib_path)
153
157
  _build_modidx()
154
158
 
159
+ # %% ../nbs/api/05_doclinks.ipynb
160
+ typs = 'module','class','method','function'
161
+ bset = set(dir(builtins))
162
+
163
+ # %% ../nbs/api/05_doclinks.ipynb
164
+ def create_index(url, pre=None):
165
+ "Create a documentation index from a sphinx inventory file at `url`, with optional prefix `pre`"
166
+ try: from sphinx.util.inventory import InventoryFile
167
+ except ImportError: raise ImportError('`sphinx` is a dependency for building indexes. Run `pip install sphinx` to use `create_index`.')
168
+ pre = ifnone(pre, f"{url}/")
169
+ invs = urlread(f'{url}/objects.inv', decode=False)
170
+ idx = InventoryFile.load(stream=BytesIO(invs), uri=pre, joinfunc=urljoin)
171
+ _get = lambda o: {k:v[2] for k,v in idx[f'py:{o}'].items() if k[0]!='_'}
172
+ d = {o:_get(o) for o in typs}
173
+ syms = defaultdict(dict)
174
+ for o in typs:
175
+ for k,v in d[o].items():
176
+ if k.split('.')[0] in bset: k = 'builtins.' + k
177
+ modparts = k.split(".")[:-2 if o=='method' else -1]
178
+ if modparts: syms['.'.join(modparts)][k] = v
179
+ return syms
180
+
155
181
  # %% ../nbs/api/05_doclinks.ipynb
156
182
  import importlib,ast
157
183
  from functools import lru_cache
@@ -166,6 +192,7 @@ def _find_mod(mod):
166
192
 
167
193
  @lru_cache(None)
168
194
  def _get_exps(mod):
195
+ "Get the line numbers for function and class definitions in module"
169
196
  mf = _find_mod(mod)
170
197
  if not mf: return {}
171
198
  txt = mf.read_text(encoding='utf-8')
@@ -181,6 +208,7 @@ def _lineno(sym, fname): return _get_exps(fname).get(sym, None) if fname else No
181
208
 
182
209
  # %% ../nbs/api/05_doclinks.ipynb
183
210
  def _qual_sym(s, settings):
211
+ "Get qualified nb, py, and github paths for a symbol s"
184
212
  if not isinstance(s,tuple): return s
185
213
  nb,py = s
186
214
  nbbase = urljoin(settings["doc_host"]+'/',settings["doc_baseurl"])
@@ -199,30 +227,41 @@ _re_backticks = re.compile(r'`([^`\s]+?)(?:\(\))?`')
199
227
 
200
228
  # %% ../nbs/api/05_doclinks.ipynb
201
229
  @lru_cache(None)
230
+ def _build_lookup_table(strip_libs=None, incl_libs=None, skip_mods=None):
231
+ cfg = get_config()
232
+ if strip_libs is None:
233
+ try: strip_libs = cfg.get('strip_libs', cfg.get('lib_path', 'nbdev').name).split()
234
+ except FileNotFoundError: strip_libs = 'nbdev'
235
+ skip_mods = setify(skip_mods)
236
+ strip_libs = L(strip_libs)
237
+ if incl_libs is not None: incl_libs = (L(incl_libs)+strip_libs).unique()
238
+ entries = {}
239
+ for o in pkg_resources.iter_entry_points(group='nbdev'):
240
+ if incl_libs is not None and o.dist.key not in incl_libs: continue
241
+ try: entries[o.name] = _qual_syms(o.resolve())
242
+ except Exception: pass
243
+ py_syms = merge(*L(o['syms'].values() for o in entries.values()).concat())
244
+ for m in strip_libs:
245
+ if m in entries:
246
+ _d = entries[m]
247
+ stripped = {remove_prefix(k,f"{mod}."):v
248
+ for mod,dets in _d['syms'].items() if mod not in skip_mods
249
+ for k,v in dets.items()}
250
+ py_syms = merge(stripped, py_syms)
251
+ return entries,py_syms
252
+
253
+ # %% ../nbs/api/05_doclinks.ipynb
202
254
  class NbdevLookup:
203
255
  "Mapping from symbol names to docs and source URLs"
204
- def __init__(self, strip_libs=None, incl_libs=None, skip_mods=None):
205
- cfg = get_config()
206
- if strip_libs is None:
207
- try: strip_libs = cfg.get('strip_libs', cfg.get('lib_path', 'nbdev').name).split()
208
- except FileNotFoundError: strip_libs = 'nbdev'
209
- skip_mods = setify(skip_mods)
210
- strip_libs = L(strip_libs)
211
- if incl_libs is not None: incl_libs = (L(incl_libs)+strip_libs).unique()
212
- # Dict from lib name to _nbdev module for incl_libs (defaults to all)
213
- self.entries = {o.name: _qual_syms(o.resolve()) for o in list(pkg_resources.iter_entry_points(group='nbdev'))
214
- if incl_libs is None or o.dist.key in incl_libs}
215
- py_syms = merge(*L(o['syms'].values() for o in self.entries.values()).concat())
216
- for m in strip_libs:
217
- if m in self.entries:
218
- _d = self.entries[m]
219
- stripped = {remove_prefix(k,f"{mod}."):v
220
- for mod,dets in _d['syms'].items() if mod not in skip_mods
221
- for k,v in dets.items()}
222
- py_syms = merge(stripped, py_syms)
223
- self.syms = py_syms
224
-
225
- def __getitem__(self, s): return self.syms.get(s, None)
256
+ def __init__(self, strip_libs=None, incl_libs=None, skip_mods=None, ns=None):
257
+ self.entries,self.syms = _build_lookup_table(strip_libs, incl_libs, skip_mods)
258
+ self.aliases = {n:o.__name__ for n,o in (ns or {}).items() if isinstance(o, ModuleType)}
259
+
260
+ def __getitem__(self, s):
261
+ if '.' in s:
262
+ pre,post = s.split('.', 1)
263
+ if pre in self.aliases: s = f"{self.aliases[pre]}.{post}"
264
+ return self.syms.get(s, None)
226
265
 
227
266
  def doc(self, sym):
228
267
  "Link to docs for `sym`"
@@ -249,7 +249,7 @@ class exec_show_docs(Processor):
249
249
  if _do_eval(cell): self.k.cell(cell)
250
250
  title = fm.get('title', '')
251
251
  if self.k.exc:
252
- raise Exception(f"Error{' in notebook: '+title if title else ''} in cell {cell.idx_} :\n{cell.source}") from self.k.exc[1]
252
+ raise Exception(f"Error{' in notebook: '+title if title else ''} in cell {cell.idx_} :\n{cell.source}") from self.k.exc
253
253
 
254
254
  def end(self):
255
255
  try: from ipywidgets import Widget
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nbdev
3
- Version: 2.3.32
3
+ Version: 2.3.34
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
@@ -41,6 +41,7 @@ Requires-Dist: svg.py; extra == "dev"
41
41
  Requires-Dist: nbclassic; extra == "dev"
42
42
  Requires-Dist: pysymbol_llm; extra == "dev"
43
43
  Requires-Dist: llms-txt; extra == "dev"
44
+ Requires-Dist: sphinx; extra == "dev"
44
45
 
45
46
  # Getting Started
46
47
 
@@ -19,3 +19,4 @@ svg.py
19
19
  nbclassic
20
20
  pysymbol_llm
21
21
  llms-txt
22
+ sphinx
@@ -4,12 +4,12 @@ repo = nbdev
4
4
  description = Create delightful software with Jupyter Notebooks
5
5
  copyright = 2020 onwards, Jeremy Howard
6
6
  keywords = nbdev fastai jupyter notebook export
7
- user = fastai
7
+ user = AnswerDotAI
8
8
  author = Jeremy Howard and Hamel Husain
9
9
  author_email = j@fast.ai
10
10
  branch = master
11
11
  min_python = 3.7
12
- version = 2.3.32
12
+ version = 2.3.34
13
13
  audience = Developers
14
14
  language = English
15
15
  custom_sidebar = True
@@ -19,7 +19,7 @@ requirements = fastcore>=1.5.27 execnb>=0.1.4 astunparse ghapi>=1.0.3 watchdog a
19
19
  pip_requirements = PyYAML
20
20
  conda_requirements = pyyaml
21
21
  conda_user = fastai
22
- dev_requirements = ipywidgets nbdev-numpy nbdev-stdlib pandas matplotlib black svg.py nbclassic pysymbol_llm llms-txt
22
+ dev_requirements = ipywidgets nbdev-numpy nbdev-stdlib pandas matplotlib black svg.py nbclassic pysymbol_llm llms-txt sphinx
23
23
  console_scripts = nbdev_create_config=nbdev.config:nbdev_create_config
24
24
  nbdev_update=nbdev.sync:nbdev_update
25
25
  nbdev_update_license=nbdev.cli:nbdev_update_license
@@ -50,15 +50,15 @@ console_scripts = nbdev_create_config=nbdev.config:nbdev_create_config
50
50
  nbdev_requirements=nbdev.release:write_requirements
51
51
  nbdev_proc_nbs=nbdev.quarto:nbdev_proc_nbs
52
52
  nbdev_help=nbdev.cli:chelp
53
- nb_export=nbdev.cli:nb_export_cli
54
- watch_export=nbdev.cli:watch_export
53
+ nb_export=nbdev.cli:nb_export_cli
54
+ watch_export=nbdev.cli:watch_export
55
55
  tst_flags = notest
56
56
  nbs_path = nbs
57
57
  doc_path = _docs
58
58
  recursive = True
59
59
  doc_host = https://nbdev.fast.ai
60
60
  doc_baseurl = /
61
- git_url = https://github.com/fastai/nbdev
61
+ git_url = https://github.com/AnswerDotAI/nbdev
62
62
  lib_path = nbdev
63
63
  title = nbdev
64
64
  black_formatting = False
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes