nbdev 3.3.11__tar.gz → 3.3.12__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 (40) hide show
  1. {nbdev-3.3.11/nbdev.egg-info → nbdev-3.3.12}/PKG-INFO +1 -1
  2. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/__init__.py +1 -1
  3. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/config.py +9 -4
  4. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/diff.py +7 -6
  5. {nbdev-3.3.11 → nbdev-3.3.12/nbdev.egg-info}/PKG-INFO +1 -1
  6. {nbdev-3.3.11 → nbdev-3.3.12}/CONTRIBUTING.md +0 -0
  7. {nbdev-3.3.11 → nbdev-3.3.12}/LICENSE +0 -0
  8. {nbdev-3.3.11 → nbdev-3.3.12}/MANIFEST.in +0 -0
  9. {nbdev-3.3.11 → nbdev-3.3.12}/README.md +0 -0
  10. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/_modidx.py +0 -0
  11. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/clean.py +0 -0
  12. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/cli.py +0 -0
  13. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/doclinks.py +0 -0
  14. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/export.py +0 -0
  15. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/extract_attachments.py +0 -0
  16. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/frontmatter.py +0 -0
  17. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/imports.py +0 -0
  18. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/maker.py +0 -0
  19. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/merge.py +0 -0
  20. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/migrate.py +0 -0
  21. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/moddocs.py +0 -0
  22. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/process.py +0 -0
  23. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/processors.py +0 -0
  24. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/qmd.py +0 -0
  25. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/quarto.py +0 -0
  26. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/release.py +0 -0
  27. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/scrubmagics.py +0 -0
  28. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/serve.py +0 -0
  29. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/serve_drv.py +0 -0
  30. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/showdoc.py +0 -0
  31. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/skill.py +0 -0
  32. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/sync.py +0 -0
  33. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev/test.py +0 -0
  34. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev.egg-info/SOURCES.txt +0 -0
  35. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev.egg-info/dependency_links.txt +0 -0
  36. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev.egg-info/entry_points.txt +0 -0
  37. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev.egg-info/requires.txt +0 -0
  38. {nbdev-3.3.11 → nbdev-3.3.12}/nbdev.egg-info/top_level.txt +0 -0
  39. {nbdev-3.3.11 → nbdev-3.3.12}/pyproject.toml +0 -0
  40. {nbdev-3.3.11 → nbdev-3.3.12}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.3.11
3
+ Version: 3.3.12
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
5
  Author-email: "Jeremy Howard and the fast.ai community" <j@fast.ai>
6
6
  License: Apache-2.0
@@ -6,7 +6,7 @@ Modules:
6
6
  - `nbdev.moddocs`: # Module docs: creating them from existing notebooks
7
7
  - `nbdev.skill`: Author clear, executable nbdev notebooks where code, prose, examples, outputs, and tests form one coherent narrative."""
8
8
 
9
- __version__ = "3.3.11"
9
+ __version__ = "3.3.12"
10
10
 
11
11
  from .doclinks import nbdev_export
12
12
  from .showdoc import show_doc
@@ -417,13 +417,16 @@ def update_init_mdoc(path=None, desc=None):
417
417
  "Write `pkg_mdoc` as the docstring of `path/__init__.py`, replacing any existing docstring"
418
418
  path = Path(path or get_config().lib_path)
419
419
  mdoc = pkg_mdoc(path, desc=desc)
420
- if not mdoc: return
421
420
  fn = path/'__init__.py'
422
421
  txt = fn.read_text(encoding='utf-8') if fn.exists() else ''
423
422
  body = ast.parse(txt).body
424
- rest = txt
423
+ rest,cur = txt,''
425
424
  if body and isinstance(body[0], ast.Expr) and isinstance(getattr(body[0].value, 'value', None), str):
425
+ cur = body[0].value.value
426
426
  rest = ''.join(txt.splitlines(keepends=True)[body[0].end_lineno:])
427
+ if not mdoc:
428
+ if '\nModules:\n' not in cur: return
429
+ mdoc = desc if desc is not None else get_config().description
427
430
  res = f'"""{mdoc}"""\n'
428
431
  if rest.strip(): res += '\n'+rest.lstrip('\n')
429
432
  fn.write_text(res, encoding='utf-8')
@@ -447,11 +450,13 @@ def pkg_llms(path=None, desc=None, index_nb=None):
447
450
  return '\n\n'.join(filter(None, parts)) + '\n'
448
451
 
449
452
  def update_llms_txt(path=None, fn=None, desc=None, index_nb=None):
450
- "Write `pkg_llms` to `fn` when it's absent or generated (has the nbdev marker); never touch a hand-written file"
453
+ "Write `pkg_llms` to `fn` when it's absent or generated (has the nbdev marker)"
451
454
  if fn is None: fn = get_config().nbs_path/'llms.txt'
452
455
  txt = pkg_llms(path, desc=desc, index_nb=index_nb)
453
- if not txt: return
454
456
  if fn.exists() and _llms_marker not in fn.read_text(encoding='utf-8'): return
457
+ if not txt:
458
+ if fn.exists(): fn.unlink()
459
+ return
455
460
  fn.write_text(txt, encoding='utf-8')
456
461
 
457
462
  # %% ../nbs/api/01_config.ipynb #95cebda6
@@ -5,7 +5,7 @@ Docs: https://nbdev.fast.ai/api/diff.html.md"""
5
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/19_diff.ipynb.
6
6
 
7
7
  # %% auto #0
8
- __all__ = ['read_nb_from_git', 'nbs_pair', 'changed_cells', 'source_diff', 'cell_diffs', 'render_diff', 'nb_diff',
8
+ __all__ = ['MAXLEN', 'read_nb_from_git', 'nbs_pair', 'changed_cells', 'source_diff', 'cell_diffs', 'render_diff', 'nb_diff',
9
9
  'nbdev_diff_driver', 'nbdev_diff']
10
10
 
11
11
  # %% ../nbs/api/19_diff.ipynb #10c8ad0b
@@ -105,9 +105,10 @@ def cell_diffs(nb_path, **kwargs):
105
105
  return _cell_changes(nb_path, f, **kwargs)
106
106
 
107
107
  # %% ../nbs/api/19_diff.ipynb #d670e58e
108
+ MAXLEN = 180 # Most characters shown per displayed line
108
109
  _dcolors = {'-':'\x1b[31m', '+':'\x1b[32m', '@':'\x1b[36m', '#':'\x1b[1m', '# ':'\x1b[1;7m'}
109
110
 
110
- def _dline(l, maxlen=120, color=False):
111
+ def _dline(l, maxlen=MAXLEN, color=False):
111
112
  "Truncate `l` to `maxlen` with an ellipsis, optionally colored by its leading diff marker"
112
113
  if maxlen and len(l)>maxlen: l = l[:maxlen]+'…'
113
114
  c = (_dcolors.get(l[:2]) or _dcolors.get(l[:1])) if color else None
@@ -127,7 +128,7 @@ def _diff_order(old, new):
127
128
  def render_diff(
128
129
  old, # `{id: source}` for the old version of the notebook
129
130
  new, # `{id: source}` for the new version
130
- maxlen:int=120, # Truncate diff lines to this width (falsy: no limit)
131
+ maxlen:int=MAXLEN, # Truncate diff lines to this width (falsy: no limit)
131
132
  color:bool=False # Add ANSI colors?
132
133
  ): # One section per changed cell, in notebook order
133
134
  "Render cell-level changes between two notebooks as truncated unified diffs"
@@ -145,7 +146,7 @@ def nb_diff(
145
146
  nb_path, # Path to the notebook
146
147
  ref_a='HEAD', # First git ref
147
148
  ref_b=None, # Second git ref; None for working dir
148
- maxlen:int=120, # Truncate diff lines to this width (falsy: no limit)
149
+ maxlen:int=MAXLEN, # Truncate diff lines to this width (falsy: no limit)
149
150
  color:bool=False # Add ANSI colors?
150
151
  ): # Rendered diff of changed cells
151
152
  "Rendered cell diff for `nb_path` between two refs"
@@ -172,7 +173,7 @@ def nbdev_diff_driver(
172
173
  new_mode:_pos=None, # Post-change file mode
173
174
  rename_to:_pos=None, # New repo path, when git detected a rename
174
175
  similarity:_pos=None, # Similarity score, when git detected a rename
175
- maxlen:int=120 # Truncate diff lines to this width (0 for no limit)
176
+ maxlen:int=MAXLEN # Truncate diff lines to this width (0 for no limit)
176
177
  ):
177
178
  "Git external diff driver for notebooks; installed by `nbdev-install-hooks`"
178
179
  if not new_file: return print(f'unmerged: {path}')
@@ -188,7 +189,7 @@ def nbdev_diff(
188
189
  path:str=None, # Notebook or directory (default: project's notebooks folder)
189
190
  ref_a:str='HEAD', # First git ref
190
191
  ref_b:str=None, # Second git ref (default: working directory)
191
- maxlen:int=120, # Truncate diff lines to this width (0 for no limit)
192
+ maxlen:int=MAXLEN, # Truncate diff lines to this width (0 for no limit)
192
193
  color:bool_arg=None # Add ANSI colors? (default: only if stdout is a tty)
193
194
  ):
194
195
  "Cell-level diffs for changed notebooks between two git refs"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.3.11
3
+ Version: 3.3.12
4
4
  Summary: Create delightful software with Jupyter Notebooks
5
5
  Author-email: "Jeremy Howard and the fast.ai community" <j@fast.ai>
6
6
  License: Apache-2.0
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
File without changes
File without changes
File without changes
File without changes
File without changes