nbdev 3.3.2__tar.gz → 3.3.3__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.
- {nbdev-3.3.2/nbdev.egg-info → nbdev-3.3.3}/PKG-INFO +1 -1
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/__init__.py +1 -1
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/config.py +9 -10
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/skill.py +9 -1
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/test.py +2 -2
- {nbdev-3.3.2 → nbdev-3.3.3/nbdev.egg-info}/PKG-INFO +1 -1
- {nbdev-3.3.2 → nbdev-3.3.3}/CONTRIBUTING.md +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/LICENSE +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/MANIFEST.in +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/README.md +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/_modidx.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/clean.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/cli.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/diff.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/doclinks.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/export.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/extract_attachments.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/frontmatter.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/imports.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/maker.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/merge.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/migrate.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/process.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/processors.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/qmd.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/quarto.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/release.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/scrubmagics.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/serve.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/serve_drv.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/showdoc.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev/sync.py +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev.egg-info/SOURCES.txt +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev.egg-info/dependency_links.txt +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev.egg-info/entry_points.txt +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev.egg-info/requires.txt +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/nbdev.egg-info/top_level.txt +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/pyproject.toml +0 -0
- {nbdev-3.3.2 → nbdev-3.3.3}/setup.cfg +0 -0
|
@@ -5,7 +5,7 @@ Modules:
|
|
|
5
5
|
- `nbdev.extract_attachments`: A preprocessor that extracts all of the attachments from the notebook file. The extracted attachments are returned in the 'resources' dictionary.
|
|
6
6
|
- `nbdev.skill`: Author clear, executable nbdev notebooks where code, prose, examples, outputs, and tests form one coherent narrative."""
|
|
7
7
|
|
|
8
|
-
__version__ = "3.3.
|
|
8
|
+
__version__ = "3.3.3"
|
|
9
9
|
|
|
10
10
|
from .doclinks import nbdev_export
|
|
11
11
|
from .showdoc import show_doc
|
|
@@ -11,7 +11,6 @@ __all__ = ['pyproject_nm', 'pyproject_tmpl', 'nbdev_defaults', 'pyproj_tmpl', 'n
|
|
|
11
11
|
'update_llms_txt', 'import_obj', 'write_cells']
|
|
12
12
|
|
|
13
13
|
# %% ../nbs/api/01_config.ipynb #6fd14ecd
|
|
14
|
-
from datetime import datetime
|
|
15
14
|
from fastcore.docments import *
|
|
16
15
|
from fastcore.utils import *
|
|
17
16
|
from fastcore.meta import *
|
|
@@ -19,10 +18,9 @@ from fastcore.script import *
|
|
|
19
18
|
from fastcore.style import *
|
|
20
19
|
from fastcore.xdg import *
|
|
21
20
|
|
|
22
|
-
import ast,importlib,re
|
|
21
|
+
import ast,importlib,re
|
|
23
22
|
from IPython.display import Markdown
|
|
24
23
|
from fastcore.nbio import read_nb,NbCell
|
|
25
|
-
from urllib.error import HTTPError
|
|
26
24
|
|
|
27
25
|
try: import tomllib
|
|
28
26
|
except ImportError: import tomli as tomllib
|
|
@@ -42,6 +40,7 @@ def _get_info(owner, repo, default_branch='main', default_kw='nbdev'):
|
|
|
42
40
|
from ghapi.all import call_gh, APIError
|
|
43
41
|
try: r = call_gh('repos.get', owner=owner, repo=repo)
|
|
44
42
|
except APIError:
|
|
43
|
+
# chkstyle: ignore-node
|
|
45
44
|
msg= [f"""Could not access repo: {owner}/{repo} to find your default branch - `{default_branch}` assumed.
|
|
46
45
|
Edit `pyproject.toml` if this is incorrect.
|
|
47
46
|
In the future, you can allow nbdev to see private repos by setting the environment variable GITHUB_TOKEN as described here:
|
|
@@ -205,8 +204,7 @@ class ConfigToml(AttrDict):
|
|
|
205
204
|
if 'lib_path' not in self: self['lib_path'] = self.lib_name.replace('-', '_')
|
|
206
205
|
|
|
207
206
|
@property
|
|
208
|
-
def version(self):
|
|
209
|
-
return read_version(self.config_path / self['lib_path']) or '0.0.1'
|
|
207
|
+
def version(self): return read_version(self.config_path / self['lib_path']) or '0.0.1'
|
|
210
208
|
|
|
211
209
|
@property
|
|
212
210
|
def d(self): return {k:v for k,v in super().items()}
|
|
@@ -253,7 +251,7 @@ def is_nbdev(path=None): return _find_nbdev_pyproject(path) is not None
|
|
|
253
251
|
def create_output(txt, mime):
|
|
254
252
|
"Add a cell output containing `txt` of the `mime` text MIME sub-type"
|
|
255
253
|
return [dict(data={f"text/{mime}": str(txt).splitlines(True)},
|
|
256
|
-
|
|
254
|
+
execution_count=1, metadata={}, output_type="execute_result")]
|
|
257
255
|
|
|
258
256
|
# %% ../nbs/api/01_config.ipynb #5a4d8e52
|
|
259
257
|
def show_src(src, lang='python'): return Markdown(f'```{lang}\n{src}\n```')
|
|
@@ -318,12 +316,13 @@ def set_version(path, version):
|
|
|
318
316
|
|
|
319
317
|
# %% ../nbs/api/01_config.ipynb #d00889e5
|
|
320
318
|
def bump_version(v, part=2, unbump=False):
|
|
321
|
-
"Bump semver
|
|
319
|
+
"Bump semver part `part` (0=major, 1=minor, 2=patch), counted from the right"
|
|
322
320
|
parts = (v or '0.0.0').split('.')
|
|
323
321
|
parts += ['0'] * (3 - len(parts))
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
idx = len(parts) - 3 + part
|
|
323
|
+
parts[idx] = str(int(parts[idx]) + (-1 if unbump else 1))
|
|
324
|
+
for i in range(idx+1, len(parts)): parts[i] = '0'
|
|
325
|
+
return '.'.join(parts)
|
|
327
326
|
|
|
328
327
|
# %% ../nbs/api/01_config.ipynb #e32583e6
|
|
329
328
|
def update_version(path=None):
|
|
@@ -32,6 +32,14 @@ Markdown explains what the code cannot: why an abstraction exists, what distinct
|
|
|
32
32
|
|
|
33
33
|
Keep docstrings to a short statement of what the symbol does. Extended explanation, examples, and warnings go in markdown cells, where they render properly and can include executable results. Document parameters and returns with docments, keeping their docs beside the signature instead of repeating it in the docstring. Backtick symbol names in prose. nbdev links them, so prefer names over hand-maintained URLs.
|
|
34
34
|
|
|
35
|
+
# Module docstrings
|
|
36
|
+
|
|
37
|
+
`doc(module)` shows the docstring with the API listing, and for an LLM that is usually the whole read. Treat the docstring as the module's TL;DR. Write a short summary under each major section heading and tag it `#| export`, teaching what a reader cannot guess from signatures and leaving per-function detail to the page.
|
|
38
|
+
|
|
39
|
+
`#| exportd` on a code cell puts its source in the docstring as a fenced block and keeps it out of the module code. Use it for a compact runnable demo, placed after the definitions it needs. End the summary before it with a colon so the two read as one. Only exported cells join the docstring, so the pair stays adjacent there even when definition cells sit between them in the notebook.
|
|
40
|
+
|
|
41
|
+
Preview the assembled docstring with `nbdev.export.nb_mdoc`, and run code to check each claim before writing it. `nbdev-export` adds the module to the generated package docstring and `llms.txt` once its docstring says more than the default summary line, so write these cells only for modules meant to be read on their own. For the package intro, tag the opening paragraphs of `index.ipynb` with `#| export`.
|
|
42
|
+
|
|
35
43
|
# Examples are documentation and tests
|
|
36
44
|
|
|
37
45
|
Write each example as page content first, then make it verify behavior: realistic values, the shortest path to the idea, an informative displayed result, direct assertions that reinforce the lesson, reuse of objects introduced earlier, and important errors demonstrated executably with `expect_fail` (one focused example per contract). Keep test plumbing out of reader-facing cells. Mocks, dense comprehensions, and long setup make poor documentation, so extract a tiny helper or hide the check. Assertions verify, but only the final expression's display teaches. End cells with the value worth showing, and design a compact `_repr_markdown_` or structured summary when it turns later examples into documentation for free. Plots, tables, images, and rich HTML all count as evidence. Stored outputs are part of the explanation. Keep them focused, and never dump a large structure without saying what matters in it. Test helpers come from `fastcore.test` (`test_eq`, `expect_fail`, ...), in plain code cells.
|
|
@@ -58,7 +66,7 @@ Keep imports in dedicated import cells, define values near first use, reuse esta
|
|
|
58
66
|
|
|
59
67
|
# Directives
|
|
60
68
|
|
|
61
|
-
`#| default_exp` names the module. `#| export` marks exported cells. Underscore-prefixed helpers may export without joining the public API. `#| hide` keeps necessary but distracting material off the page. `#| eval: false` is for cells that genuinely must not run, not for suppressing broken ones, and it cascades. An unevaluated cell cannot create state for later evaluated cells.
|
|
69
|
+
`#| default_exp` names the module. `#| export` marks exported cells. Underscore-prefixed helpers may export without joining the public API. `#| exportd` exports a code cell's source to the module docstring instead of the module. `#| hide` keeps necessary but distracting material off the page. `#| eval: false` is for cells that genuinely must not run, not for suppressing broken ones, and it cascades. An unevaluated cell cannot create state for later evaluated cells.
|
|
62
70
|
|
|
63
71
|
# nbdev v3
|
|
64
72
|
|
|
@@ -108,8 +108,8 @@ def nbdev_test(
|
|
|
108
108
|
if len(files)==0: return print('No files were eligible for testing')
|
|
109
109
|
|
|
110
110
|
if n_workers is None: n_workers = 0 if len(files)==1 else min(num_cpus(), 8)
|
|
111
|
-
if IN_NOTEBOOK: kw = {'method':'spawn'} if os.name=='nt' else {'method':'forkserver'}
|
|
112
|
-
else: kw = {'method':'
|
|
111
|
+
if IN_NOTEBOOK: kw = {'method':'spawn'} if os.name=='nt' or sys.platform=='darwin' else {'method':'forkserver'}
|
|
112
|
+
else: kw = {'method':'spawn'} if sys.platform=='darwin' else {}
|
|
113
113
|
wd_pth = cfg.nbs_path
|
|
114
114
|
with working_directory(wd_pth if (wd_pth and wd_pth.exists()) else os.getcwd()):
|
|
115
115
|
results = parallel(test_nb, files, skip_flags=skip_flags, force_flags=force_flags, n_workers=n_workers,
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|