nbdevAuto 0.3.77__tar.gz → 0.3.78__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdevAuto
3
- Version: 0.3.77
3
+ Version: 0.3.78
4
4
  Summary: automating nbdev
5
5
  Author-email: Benedict Thekkel <bthekkel1@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "0.3.78"
@@ -7,11 +7,11 @@ Docs: https://bthek1.github.io/nbdevAuto/fleet.html.md"""
7
7
  # %% auto #0
8
8
  __all__ = ['RAW_DOC_SUFFIXES', 'KNOWN_TOKEN', 'SECRET_PATTERNS', 'ALLOW', 'RENDERED_SUFFIXES', 'TEXT_SUFFIXES', 'EMAIL',
9
9
  'RESERVED_DOMAINS', 'BULK_EMAIL_MIN', 'NB_RULES', 'DLTASK_SECTIONS', 'DLTASK_NOT_TASKS', 'LARGE_NB_BYTES',
10
- 'NOT_PUBLISHED', 'VERBS', 'Skip', 'Outcome', 'Report', 'format_summary', 'walk', 'finish', 'script_path',
11
- 'upload_one', 'fleet_upload', 'ahead_of_remote', 'push_one', 'copy_one', 'fleet_push', 'fleet_copy',
12
- 'status_one', 'fleet_status', 'fetch_all', 'update_one', 'dirty_submodules', 'init_new', 'pull_root',
13
- 'fleet_update', 'fleet_sync', 'looks_secret', 'notebook_text', 'is_published', 'scan_file', 'scan_one',
14
- 'fleet_scan', 'lint_notebook', 'unlinked_from_index', 'lint_one', 'lint_totals', 'fleet_nblint',
10
+ 'SKIP_DIRECTIVES', 'NOT_PUBLISHED', 'VERBS', 'Skip', 'Outcome', 'Report', 'format_summary', 'walk', 'finish',
11
+ 'script_path', 'upload_one', 'fleet_upload', 'ahead_of_remote', 'push_one', 'copy_one', 'fleet_push',
12
+ 'fleet_copy', 'status_one', 'fleet_status', 'fetch_all', 'update_one', 'dirty_submodules', 'init_new',
13
+ 'pull_root', 'fleet_update', 'fleet_sync', 'looks_secret', 'notebook_text', 'is_published', 'scan_file',
14
+ 'scan_one', 'fleet_scan', 'lint_notebook', 'unlinked_from_index', 'lint_one', 'lint_totals', 'fleet_nblint',
15
15
  'parse_verb', 'usage', 'run_verb', 'fleet']
16
16
 
17
17
  # %% ../nbs/04_Fleet.ipynb #d361ee5f-9f09-464f-aec6-0e27cec90fe9
@@ -585,6 +585,7 @@ NB_RULES = [
585
585
  ("mermaid_plain", "Plain ```mermaid fence (raw source on the site)", 1),
586
586
  ("title_leading_rule","Title cell starts with --- (breaks nbdev-test)", 1),
587
587
  ("title_no_h1", "Title cell has no # H1", 1),
588
+ ("title_bad_directive","Misspelled skip directive (nbdev ignores it)", 1),
588
589
  ("index_unlinked", "Public notebook missing from index.ipynb", 1),
589
590
  ("mermaid_braced", "Braced {mermaid} not yet an .svg file", 2),
590
591
  ("svg_in_index", "Inline <svg> in index.ipynb (README strips it)", 2),
@@ -594,9 +595,9 @@ NB_RULES = [
594
595
  ("non_ascii", "Non-ASCII characters in code cells", 4),
595
596
  ("naive_datetime", "Naive now() or utcnow(), no timezone", 4),
596
597
  ("bad_filename", "Filename with a space or &", 4),
597
- ("dl_matplotlib", "DL_methods chart in matplotlib", 5),
598
+ ("dl_matplotlib", "DL_methods chart in matplotlib (imshow is fine)", 5),
598
599
  ("dltask_sections", "DL_tasks notebook missing a required section", 5),
599
- ("dltask_no_require", "DL_tasks live-capture demo without require(...)", 5),
600
+ ("dltask_no_require", "DL_tasks live demo that fails on a cold kernel", 5),
600
601
  ("stale_outputs", "skip_exec notebook carrying outputs", 6),
601
602
  ("large_file", "Notebook over 3 MB", 6),
602
603
  ("multi_h2", "Markdown cell with several ## sections", 7),
@@ -608,6 +609,7 @@ DLTASK_SECTIONS = ["What is", "Real-world use cases", "Evaluation", "Datasets",
608
609
  "Setup", "benchmark", "Common frameworks", "Going further"]
609
610
  DLTASK_NOT_TASKS = ("Theory", "Frameworks")
610
611
  LARGE_NB_BYTES = 3_000_000
612
+ SKIP_DIRECTIVES = ("skip_showdoc", "skip_exec")
611
613
  # Never a site, so never held to the publishing standard (see special-submodules).
612
614
  NOT_PUBLISHED = ("Personal/bthek1_career",)
613
615
 
@@ -636,6 +638,11 @@ def lint_notebook(path, sub=""):
636
638
  if first.startswith("---"): out["title_leading_rule"] = 1
637
639
  if not re.match(r"^(---[\s\S]*?---\s*)?#\s+\S", first): out["title_no_h1"] = 1
638
640
  if not re.search(r"^>\s*\S", first, re.M): out["title_no_desc"] = 1
641
+ # nbdev matches directive keys exactly, so `Skip_exec` or `skip_doc` is silently
642
+ # ignored and the notebook executes or shows docs it was meant to skip.
643
+ keys = re.findall(r"^\s*-\s*([A-Za-z_]+)\s*:", first, re.M)
644
+ bad = [k for k in keys if re.search(r"skip|showdoc|exec", k, re.I) and k not in SKIP_DIRECTIVES]
645
+ if bad: out["title_bad_directive"] = len(bad)
639
646
  if not exports and "skip_showdoc: true" not in first: out["no_skip_showdoc"] = 1
640
647
 
641
648
  # The title cell is checked above; a `##` packed into it is a title problem first.
@@ -656,18 +663,32 @@ def lint_notebook(path, sub=""):
656
663
  if re.search(r"datetime\.utcnow\(|\b(?:dt|datetime)\.now\(\s*\)", allcode):
657
664
  out["naive_datetime"] = 1
658
665
 
666
+ # Charts only: imshow image display is allowed (ECharts cannot draw an image array).
659
667
  if sub == "DL/DL_methods" and re.search(
660
- r"^\s*(import|from)\s+(matplotlib|seaborn|plotly)", allcode, re.M):
668
+ r"^\s*(import|from)\s+(matplotlib|seaborn|plotly)", allcode, re.M) and re.search(
669
+ r"\b(?:plt|ax|axes\[[^]]*\])\.(?:plot|scatter|bar|barh|hist|pie|errorbar|fill_between|"
670
+ r"boxplot|violinplot|step|stem|contourf?|plot_surface|plot_wireframe)\(|\bsns\.\w+\(|\bpx\.\w+\(",
671
+ allcode):
661
672
  out["dl_matplotlib"] = 1
662
673
  # Only a real task notebook: not the index, a library notebook, a stub, or the
663
674
  # Theory/ and Frameworks/ reference pages, which have no task to benchmark.
664
675
  if (sub == "DL/DL_tasks" and name != "index.ipynb" and not exports and len(cells) > 3
665
676
  and path.parent.name not in DLTASK_NOT_TASKS):
666
677
  heads = "\n".join(re.findall(r"^##\s+.*$", allmd, re.M)).lower()
667
- missing = [s for s in DLTASK_SECTIONS if s.lower() not in heads]
678
+ # "Head-to-head: <question>" is the benchmark section under a sharper title.
679
+ missing = [s for s in DLTASK_SECTIONS if s.lower() not in heads
680
+ and not (s == "benchmark" and "head-to-head" in heads)]
668
681
  if missing: out["dltask_sections"] = len(missing)
669
- if re.search(r"cv2\.VideoCapture|sounddevice|pyaudio", allcode) and "require(" not in allcode:
670
- out["dltask_no_require"] = 1
682
+ # A live demo is the cell people run alone, so it must survive a cold kernel:
683
+ # a require(...) guard, a bootstrap(...) that runs Setup from the .ipynb, or a
684
+ # standalone prelude defining its own free_memory(). Comment lines do not count.
685
+ for c in cells:
686
+ if c.get("cell_type") != "code": continue
687
+ live = "\n".join(l for l in "".join(c["source"]).splitlines()
688
+ if not l.lstrip().startswith("#"))
689
+ if (re.search(r"cv2\.VideoCapture|sounddevice|pyaudio", live)
690
+ and not re.search(r"\b(?:require|bootstrap)\(|^def free_memory\(", live, re.M)):
691
+ out["dltask_no_require"] = out.get("dltask_no_require", 0) + 1
671
692
 
672
693
  # DL notebooks keep outputs on purpose (benchmarks, demos), so only elsewhere is a
673
694
  # skip_exec notebook with outputs a sign of stale results.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbdevAuto
3
- Version: 0.3.77
3
+ Version: 0.3.78
4
4
  Summary: automating nbdev
5
5
  Author-email: Benedict Thekkel <bthekkel1@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -1 +0,0 @@
1
- __version__ = "0.3.77"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes