nbdev 2.3.25__tar.gz → 2.3.27__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 (38) hide show
  1. {nbdev-2.3.25/nbdev.egg-info → nbdev-2.3.27}/PKG-INFO +4 -2
  2. {nbdev-2.3.25 → nbdev-2.3.27}/README.md +2 -0
  3. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/__init__.py +1 -1
  4. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/config.py +6 -3
  5. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/doclinks.py +11 -5
  6. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/maker.py +1 -1
  7. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/quarto.py +3 -3
  8. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/showdoc.py +1 -1
  9. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/sync.py +2 -1
  10. {nbdev-2.3.25 → nbdev-2.3.27/nbdev.egg-info}/PKG-INFO +4 -2
  11. {nbdev-2.3.25 → nbdev-2.3.27}/settings.ini +3 -2
  12. {nbdev-2.3.25 → nbdev-2.3.27}/CONTRIBUTING.md +0 -0
  13. {nbdev-2.3.25 → nbdev-2.3.27}/LICENSE +0 -0
  14. {nbdev-2.3.25 → nbdev-2.3.27}/MANIFEST.in +0 -0
  15. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/_modidx.py +0 -0
  16. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/clean.py +0 -0
  17. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/cli.py +0 -0
  18. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/export.py +0 -0
  19. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/extract_attachments.py +0 -0
  20. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/frontmatter.py +0 -0
  21. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/imports.py +0 -0
  22. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/merge.py +0 -0
  23. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/migrate.py +0 -0
  24. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/process.py +0 -0
  25. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/processors.py +0 -0
  26. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/qmd.py +0 -0
  27. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/release.py +0 -0
  28. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/serve.py +0 -0
  29. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/serve_drv.py +0 -0
  30. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev/test.py +0 -0
  31. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev.egg-info/SOURCES.txt +0 -0
  32. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev.egg-info/dependency_links.txt +0 -0
  33. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev.egg-info/entry_points.txt +0 -0
  34. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev.egg-info/not-zip-safe +0 -0
  35. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev.egg-info/requires.txt +0 -0
  36. {nbdev-2.3.25 → nbdev-2.3.27}/nbdev.egg-info/top_level.txt +0 -0
  37. {nbdev-2.3.25 → nbdev-2.3.27}/setup.cfg +0 -0
  38. {nbdev-2.3.25 → nbdev-2.3.27}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nbdev
3
- Version: 2.3.25
3
+ Version: 2.3.27
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
@@ -8,7 +8,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
14
  Classifier: Programming Language :: Python :: 3.7
@@ -143,10 +143,12 @@ available commands:
143
143
  nbdev_release_both Release both conda and PyPI packages
144
144
  nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
145
145
  nbdev_release_git Tag and create a release in GitHub for the current version
146
+ nbdev_requirements Writes a `requirements.txt` file to `directory` based on settings.ini.
146
147
  nbdev_sidebar Create sidebar.yml
147
148
  nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
148
149
  nbdev_trust Trust notebooks matching `fname`
149
150
  nbdev_update Propagate change in modules matching `fname` to notebooks that created them
151
+ nbdev_update_license Allows you to update the license of your project.
150
152
 
151
153
  ## FAQ
152
154
 
@@ -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.25"
1
+ __version__ = "2.3.27"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
@@ -66,6 +66,7 @@ def _apply_defaults(
66
66
  jupyter_hooks:bool_arg=False, # Run Jupyter hooks?
67
67
  clean_ids:bool_arg=True, # Remove ids from plaintext reprs?
68
68
  clear_all:bool_arg=False, # Remove all cell metadata and cell outputs?
69
+ cell_number:bool_arg=True, # Add cell number to the exported file
69
70
  put_version_in_init:bool_arg=True, # Add the version to the main __init__.py in nbdev_export
70
71
  ):
71
72
  "Apply default settings where missing in `cfg`."
@@ -222,7 +223,7 @@ def create_output(txt, mime):
222
223
  def show_src(src, lang='python'): return Markdown(f'```{lang}\n{src}\n```')
223
224
 
224
225
  # %% ../nbs/api/01_config.ipynb 48
225
- _re_version = re.compile('^__version__\s*=.*$', re.MULTILINE)
226
+ _re_version = re.compile(r'^__version__\s*=.*$', re.MULTILINE)
226
227
  _init = '__init__.py'
227
228
 
228
229
  def update_version(path=None):
@@ -251,10 +252,12 @@ def add_init(path=None):
251
252
  if get_config().get('put_version_in_init', True): update_version(path)
252
253
 
253
254
  # %% ../nbs/api/01_config.ipynb 51
254
- def write_cells(cells, hdr, file, offset=0):
255
+ def write_cells(cells, hdr, file, offset=0, cell_number=True):
255
256
  "Write `cells` to `file` along with header `hdr` starting at index `offset` (mainly for nbdev internal use)."
256
257
  for cell in cells:
257
- if cell.source.strip(): file.write(f'\n\n{hdr} {cell.idx_+offset}\n{cell.source}')
258
+ if cell.source.strip():
259
+ idx = f" {cell.idx_+offset}" if cell_number else ""
260
+ file.write(f'\n\n{hdr}{idx}\n{cell.source}')
258
261
 
259
262
  # %% ../nbs/api/01_config.ipynb 52
260
263
  def _basic_export_nb(fname, name, dest=None):
@@ -47,16 +47,22 @@ def _iter_py_cells(p):
47
47
  "Yield cells from an exported Python file."
48
48
  p = Path(p)
49
49
  cells = p.read_text(encoding='utf-8').split("\n# %% ")
50
+ has_cell_number = get_config().cell_number
50
51
  for cell in cells[1:]:
51
52
  top,code = cell.split('\n', 1)
52
53
  try:
53
- *nb,idx = top.split()
54
- nb = ' '.join(nb)
54
+ if has_cell_number:
55
+ *nb,idx = top.split()
56
+ nb = ' '.join(nb)
57
+ idx = int(idx)
58
+ else:
59
+ nb = top
60
+ idx = None
55
61
  except ValueError: raise ValueError(f"Unexpected format in '{p}' at cell:\n```\n# %% {cell.strip()}.\n```\n"
56
62
  "The expected format is: '# %% {nb_path} {cell_idx}'.")
57
63
  nb_path = None if nb=='auto' else (p.parent/nb).resolve() # NB paths are stored relative to .py file
58
64
  if code.endswith('\n'): code=code[:-1]
59
- yield AttrDict(nb=nb, idx=int(idx), code=code, nb_path=nb_path, py_path=p.resolve())
65
+ yield AttrDict(nb=nb, idx=idx, code=code, nb_path=nb_path, py_path=p.resolve())
60
66
 
61
67
  # %% ../nbs/api/05_doclinks.ipynb 11
62
68
  def _nbpath2html(p): return p.with_name(re.sub(r'^\d+[a-zA-Z0-9]*_', '', p.name.lower())).with_suffix('.html')
@@ -71,7 +77,7 @@ def _get_modidx(py_path, code_root, nbs_path):
71
77
  _def_types = ast.FunctionDef,ast.AsyncFunctionDef,ast.ClassDef
72
78
  d = {}
73
79
  for cell in _iter_py_cells(py_path):
74
- if cell.nb == 'auto': continue
80
+ if 'auto' in cell.nb: continue
75
81
  loc = _nbpath2html(cell.nb_path.relative_to(nbs_path))
76
82
 
77
83
  def _stor(nm):
@@ -98,7 +104,7 @@ def _build_modidx(dest=None, nbs_path=None, skip_exists=False):
98
104
  res['settings'] = {k:v for k,v in get_config().d.items()
99
105
  if k in ('doc_host','doc_baseurl','lib_path','git_url','branch')}
100
106
  code_root = dest.parent.resolve()
101
- for file in globtastic(dest, file_glob="*.py", skip_file_re='^_', skip_folder_re="\.ipynb_checkpoints"):
107
+ for file in globtastic(dest, file_glob="*.py", skip_file_re='^_', skip_folder_re=r"\.ipynb_checkpoints"):
102
108
  res['syms'].update(_get_modidx((dest.parent/file).resolve(), code_root, nbs_path=nbs_path))
103
109
  idxfile.write_text("# Autogenerated by nbdev\n\nd = "+pformat(res, width=140, indent=2, compact=True)+'\n')
104
110
 
@@ -207,7 +207,7 @@ def make(self:ModuleMaker, cells, all_cells=None, lib_path=None):
207
207
  f.write(f"# AUTOGENERATED! DO NOT EDIT! File to edit: {self.dest2nb}.")
208
208
  if last_future > 0: write_cells(cells[:last_future], self.hdr, f)
209
209
  if self.parse: f.write(f"\n\n# %% auto 0\n__all__ = {all_str}")
210
- write_cells(cells[last_future:], self.hdr, f)
210
+ write_cells(cells[last_future:], self.hdr, f, cell_number=get_config().cell_number)
211
211
  f.write('\n')
212
212
 
213
213
  # %% ../nbs/api/02_maker.ipynb 38
@@ -68,7 +68,7 @@ def _sort(a):
68
68
  if y.startswith('index.'): return x,'00'
69
69
  return a
70
70
  #|export
71
- _def_file_re = '\.(?:ipynb|qmd|html)$'
71
+ _def_file_re = r'\.(?:ipynb|qmd|html)$'
72
72
 
73
73
  @delegates(nbglob_cli)
74
74
  def _nbglob_docs(
@@ -87,12 +87,12 @@ def _recursive_parser(
87
87
  set_index: bool = True): # If `True`, `index` file will be set to href.
88
88
  for name, val in dir_dict.items():
89
89
  if type(val) is str:
90
- if re.search('index\..*', re.sub('^\d+_', '', val)) and set_index and section:
90
+ if re.search('index\..*', re.sub(r'^\d+_', '', val)) and set_index and section:
91
91
  section.update({'href': str(dirpath/val)})
92
92
  else:
93
93
  contents.append(str(dirpath/val))
94
94
  elif type(val) is dict:
95
- name = re.sub('^\d+_', '', name)
95
+ name = re.sub(r'^\d+_', '', name)
96
96
  section = {'section': name, 'contents': []}
97
97
  contents.append(section)
98
98
  _recursive_parser(val, section['contents'], dirpath/name, section=section)
@@ -25,7 +25,7 @@ def _bold(s): return f'**{s}**' if s.strip() else s
25
25
 
26
26
  # %% ../nbs/api/08_showdoc.ipynb 7
27
27
  def _escape_markdown(s):
28
- for c in '|^': s = re.sub(rf'\\?\{c}', f'\{c}', s)
28
+ for c in '|^': s = re.sub(rf'\\?\{c}', rf'\{c}', s)
29
29
  return s.replace('\n', '<br>')
30
30
 
31
31
  # %% ../nbs/api/08_showdoc.ipynb 9
@@ -34,7 +34,7 @@ def _mod_files():
34
34
  return L(files for mod in midx.d['syms'].values() for _,files in mod.values()).unique()
35
35
 
36
36
  # %% ../nbs/api/06_sync.ipynb 8
37
- _re_import = re.compile("from\s+\S+\s+import\s+\S")
37
+ _re_import = re.compile(r"from\s+\S+\s+import\s+\S")
38
38
 
39
39
  # %% ../nbs/api/06_sync.ipynb 10
40
40
  def _to_absolute(code, py_path, lib_dir):
@@ -67,6 +67,7 @@ def nbdev_update(fname:str=None): # A Python file name to update
67
67
  if fname and fname.endswith('.ipynb'): raise ValueError("`nbdev_update` operates on .py files. If you wish to convert notebooks instead, see `nbdev_export`.")
68
68
  if os.environ.get('IN_TEST',0): return
69
69
  cfg = get_config()
70
+ if not cfg.cell_number: raise ValueError("`nbdev_update` does not support without cell_number in .py files. Please check your settings.ini")
70
71
  fname = Path(fname or cfg.lib_path)
71
72
  lib_dir = cfg.lib_path.parent
72
73
  files = globtastic(fname, file_glob='*.py', skip_folder_re='^[_.]').filter(lambda x: str(Path(x).absolute().relative_to(lib_dir) in _mod_files()))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nbdev
3
- Version: 2.3.25
3
+ Version: 2.3.27
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
@@ -8,7 +8,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
14
  Classifier: Programming Language :: Python :: 3.7
@@ -143,10 +143,12 @@ available commands:
143
143
  nbdev_release_both Release both conda and PyPI packages
144
144
  nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
145
145
  nbdev_release_git Tag and create a release in GitHub for the current version
146
+ nbdev_requirements Writes a `requirements.txt` file to `directory` based on settings.ini.
146
147
  nbdev_sidebar Create sidebar.yml
147
148
  nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
148
149
  nbdev_trust Trust notebooks matching `fname`
149
150
  nbdev_update Propagate change in modules matching `fname` to notebooks that created them
151
+ nbdev_update_license Allows you to update the license of your project.
150
152
 
151
153
  ## FAQ
152
154
 
@@ -9,12 +9,12 @@ 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.25
12
+ version = 2.3.27
13
13
  audience = Developers
14
14
  language = English
15
15
  custom_sidebar = True
16
16
  license = apache2
17
- status = 2
17
+ status = 5
18
18
  requirements = fastcore>=1.5.27 execnb>=0.1.4 astunparse ghapi>=1.0.3 watchdog asttokens
19
19
  pip_requirements = PyYAML
20
20
  conda_requirements = pyyaml
@@ -66,5 +66,6 @@ allowed_cell_metadata_keys =
66
66
  jupyter_hooks = True
67
67
  clean_ids = False
68
68
  clear_all = False
69
+ cell_number = True
69
70
  put_version_in_init = True
70
71
 
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