nbdev 3.2.1__tar.gz → 3.2.2__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-3.2.1/nbdev.egg-info → nbdev-3.2.2}/PKG-INFO +2 -2
  2. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/__init__.py +1 -1
  3. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/_modidx.py +6 -0
  4. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/diff.py +1 -1
  5. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/release.py +31 -7
  6. {nbdev-3.2.1 → nbdev-3.2.2/nbdev.egg-info}/PKG-INFO +2 -2
  7. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev.egg-info/requires.txt +1 -1
  8. {nbdev-3.2.1 → nbdev-3.2.2}/pyproject.toml +1 -1
  9. {nbdev-3.2.1 → nbdev-3.2.2}/CONTRIBUTING.md +0 -0
  10. {nbdev-3.2.1 → nbdev-3.2.2}/LICENSE +0 -0
  11. {nbdev-3.2.1 → nbdev-3.2.2}/MANIFEST.in +0 -0
  12. {nbdev-3.2.1 → nbdev-3.2.2}/README.md +0 -0
  13. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/clean.py +0 -0
  14. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/cli.py +0 -0
  15. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/config.py +0 -0
  16. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/doclinks.py +0 -0
  17. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/export.py +0 -0
  18. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/extract_attachments.py +0 -0
  19. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/frontmatter.py +0 -0
  20. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/imports.py +0 -0
  21. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/maker.py +0 -0
  22. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/merge.py +0 -0
  23. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/migrate.py +0 -0
  24. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/process.py +0 -0
  25. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/processors.py +0 -0
  26. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/qmd.py +0 -0
  27. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/quarto.py +0 -0
  28. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/scrubmagics.py +0 -0
  29. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/serve.py +0 -0
  30. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/serve_drv.py +0 -0
  31. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/showdoc.py +0 -0
  32. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/sync.py +0 -0
  33. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev/test.py +0 -0
  34. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev.egg-info/SOURCES.txt +0 -0
  35. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev.egg-info/dependency_links.txt +0 -0
  36. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev.egg-info/entry_points.txt +0 -0
  37. {nbdev-3.2.1 → nbdev-3.2.2}/nbdev.egg-info/top_level.txt +0 -0
  38. {nbdev-3.2.1 → nbdev-3.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.2.1
3
+ Version: 3.2.2
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
@@ -24,7 +24,7 @@ Requires-Dist: watchdog
24
24
  Requires-Dist: asttokens
25
25
  Requires-Dist: setuptools
26
26
  Requires-Dist: build
27
- Requires-Dist: fastgit
27
+ Requires-Dist: fastgit>=0.0.7
28
28
  Requires-Dist: pyyaml
29
29
  Requires-Dist: tomli; python_version < "3.11"
30
30
  Provides-Extra: dev
@@ -1,4 +1,4 @@
1
- __version__ = "3.2.1"
1
+ __version__ = "3.2.2"
2
2
 
3
3
  from .doclinks import nbdev_export
4
4
  from .showdoc import show_doc
@@ -313,11 +313,17 @@ d = { 'settings': { 'branch': 'main',
313
313
  'nbdev.release.Release.changelog': ('api/release.html#release.changelog', 'nbdev/release.py'),
314
314
  'nbdev.release.Release.latest_notes': ('api/release.html#release.latest_notes', 'nbdev/release.py'),
315
315
  'nbdev.release.Release.release': ('api/release.html#release.release', 'nbdev/release.py'),
316
+ 'nbdev.release._check_changelog_base': ('api/release.html#_check_changelog_base', 'nbdev/release.py'),
316
317
  'nbdev.release._find_config': ('api/release.html#_find_config', 'nbdev/release.py'),
317
318
  'nbdev.release._get_conda_meta': ('api/release.html#_get_conda_meta', 'nbdev/release.py'),
319
+ 'nbdev.release._is_ancestor': ('api/release.html#_is_ancestor', 'nbdev/release.py'),
318
320
  'nbdev.release._issue_txt': ('api/release.html#_issue_txt', 'nbdev/release.py'),
319
321
  'nbdev.release._issues_txt': ('api/release.html#_issues_txt', 'nbdev/release.py'),
320
322
  'nbdev.release._load_json': ('api/release.html#_load_json', 'nbdev/release.py'),
323
+ 'nbdev.release._release_branch': ('api/release.html#_release_branch', 'nbdev/release.py'),
324
+ 'nbdev.release._release_head': ('api/release.html#_release_head', 'nbdev/release.py'),
325
+ 'nbdev.release._remote_shas': ('api/release.html#_remote_shas', 'nbdev/release.py'),
326
+ 'nbdev.release._require_release_branch': ('api/release.html#_require_release_branch', 'nbdev/release.py'),
321
327
  'nbdev.release._run': ('api/release.html#_run', 'nbdev/release.py'),
322
328
  'nbdev.release._write_yaml': ('api/release.html#_write_yaml', 'nbdev/release.py'),
323
329
  'nbdev.release.anaconda_upload': ('api/release.html#anaconda_upload', 'nbdev/release.py'),
@@ -25,7 +25,7 @@ def read_nb_from_git(
25
25
  path = Path(path)
26
26
  if path.is_absolute(): path = path.relative_to(g.top())
27
27
  if ref is None: return read_nb(g.top()/path)
28
- raw = g.show(f'{ref}:{path}', split=False)
28
+ raw = g.show(f'{ref}:{path}')
29
29
  return dict2nb(json.loads(raw))
30
30
 
31
31
  # %% ../nbs/api/19_diff.ipynb #3ac25702
@@ -40,6 +40,25 @@ def _load_json(cfg, k):
40
40
  try: return json.loads(cfg[k])
41
41
  except json.JSONDecodeError as e: raise Exception(f"Key: `{k}` in .ini file is not a valid JSON string: {e}")
42
42
 
43
+ # %% ../nbs/api/18_release.ipynb #e5861010
44
+ def _require_release_branch(branch):
45
+ if not branch: raise SystemExit('Cannot release from detached HEAD; create a maintenance branch first')
46
+ return branch
47
+
48
+ def _release_branch(): return _require_release_branch(run('git branch --show-current').strip())
49
+ def _is_ancestor(ref): return subprocess.run(['git', 'merge-base', '--is-ancestor', ref, 'HEAD'], capture_output=True).returncode == 0
50
+ def _remote_shas(s): return {o.split()[0] for o in s.splitlines()}
51
+
52
+ def _check_changelog_base(tag):
53
+ if _is_ancestor(tag): return
54
+ raise SystemExit(f'HEAD does not contain the latest release ({tag}). Write CHANGELOG.md manually, then run with --no_changelog.')
55
+
56
+ def _release_head():
57
+ _release_branch()
58
+ head = run('git rev-parse HEAD').strip()
59
+ if head not in _remote_shas(run('git ls-remote --heads origin')): raise SystemExit(f'Release commit {head[:7]} is not on origin; push the current branch first')
60
+ return head
61
+
43
62
  # %% ../nbs/api/18_release.ipynb #dcaba486
44
63
  def update_changelog(txt, ver, notes, marker='<!-- do not remove -->\n'):
45
64
  "Insert `notes` into changelog `txt` after `marker`, replacing any existing section for `ver`"
@@ -80,12 +99,16 @@ async def changelog(self:Release,
80
99
  except APIError as e:
81
100
  if e.status_code != 404: raise
82
101
  lr,self.commit_date = None,'2000-01-01T00:00:004Z'
83
- if lr and (Version(self.cfg.version) <= Version(lr.tag_name)):
84
- print(f'Error: Version bump required: expected: >{lr.tag_name}, got: {self.cfg.version}.')
85
- raise SystemExit(1)
86
- res = f"\n## {self.cfg.version}\n"
102
+ if lr:
103
+ run('git fetch --tags --quiet')
104
+ _check_changelog_base(lr.tag_name)
105
+ if Version(self.cfg.version) <= Version(lr.tag_name):
106
+ print(f'Error: Version bump required: expected: >{lr.tag_name}, got: {self.cfg.version}.')
107
+ raise SystemExit(1)
108
+ res = f"\n## {self.cfg.version}\n\n"
87
109
  issues = await self._issue_groups()
88
- res += '\n'.join(_issues_txt(*o) for o in zip(issues, self.groups.values()))
110
+ sections = (_issues_txt(*o) for o in zip(issues, self.groups.values()))
111
+ res += '\n\n'.join(filter(None, sections))
89
112
  if debug: return res
90
113
  res = update_changelog(self.changefile.read_text(), self.cfg.version, res, marker)
91
114
  shutil.copy(self.changefile, self.changefile.with_suffix(".bak"))
@@ -98,7 +121,7 @@ async def release(self:Release):
98
121
  "Tag and create a release in GitHub for the current version"
99
122
  ver = self.cfg.version
100
123
  notes = self.latest_notes()
101
- await self.gh.create_release(ver, branch=self.cfg.branch, body=notes)
124
+ await self.gh.create_release(ver, branch=_release_head(), body=notes)
102
125
  return ver
103
126
 
104
127
  # %% ../nbs/api/18_release.ipynb #22101171
@@ -143,11 +166,12 @@ async def release_gh(
143
166
  ):
144
167
  "Create the changelog, optionally edit it, then push and create the GitHub release"
145
168
  cfg = _find_config()
169
+ _release_branch()
146
170
  if not no_changelog: await Release(repo=repo).changelog()
147
171
  if not no_editor: subprocess.run([os.environ.get('EDITOR','nano'), cfg.config_path/'CHANGELOG.md'])
148
172
  if not yes and not input("Make release now? (y/n) ").lower().startswith('y'): sys.exit(1)
149
173
  run('git commit -am release')
150
- run('git push')
174
+ run('git push --set-upstream origin HEAD')
151
175
  print(f"Released {await push_release(token, repo=repo)}")
152
176
 
153
177
  # %% ../nbs/api/18_release.ipynb #5b4d4aa2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdev
3
- Version: 3.2.1
3
+ Version: 3.2.2
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
@@ -24,7 +24,7 @@ Requires-Dist: watchdog
24
24
  Requires-Dist: asttokens
25
25
  Requires-Dist: setuptools
26
26
  Requires-Dist: build
27
- Requires-Dist: fastgit
27
+ Requires-Dist: fastgit>=0.0.7
28
28
  Requires-Dist: pyyaml
29
29
  Requires-Dist: tomli; python_version < "3.11"
30
30
  Provides-Extra: dev
@@ -6,7 +6,7 @@ watchdog
6
6
  asttokens
7
7
  setuptools
8
8
  build
9
- fastgit
9
+ fastgit>=0.0.7
10
10
  pyyaml
11
11
 
12
12
  [:python_version < "3.11"]
@@ -20,7 +20,7 @@ classifiers = [
20
20
  ]
21
21
  dynamic = ["version"]
22
22
  dependencies = [ "fastcore>=1.14.6", "execnb>=0.2.4", "astunparse", "ghapi>=2.0.0", "watchdog", "asttokens",
23
- "setuptools", "build", "fastgit", "pyyaml", "tomli; python_version < '3.11'", ]
23
+ "setuptools", "build", "fastgit>=0.0.7", "pyyaml", "tomli; python_version < '3.11'", ]
24
24
 
25
25
  [project.optional-dependencies]
26
26
  dev = [ "ipywidgets", "nbdev-numpy", "nbdev-stdlib", "pandas", "matplotlib", "black", "svg.py", "nbclassic",
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