nbdevAuto 0.3.80__tar.gz → 0.3.82__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.
- {nbdevauto-0.3.80/nbdevAuto.egg-info → nbdevauto-0.3.82}/PKG-INFO +1 -1
- nbdevauto-0.3.82/nbdevAuto/__init__.py +1 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/_modidx.py +1 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/fleet.py +35 -9
- {nbdevauto-0.3.80 → nbdevauto-0.3.82/nbdevAuto.egg-info}/PKG-INFO +1 -1
- nbdevauto-0.3.80/nbdevAuto/__init__.py +0 -1
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/LICENSE +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/MANIFEST.in +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/README.md +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/automate.py +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/core.py +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/functions.py +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/github.py +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto/pdf.py +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto.egg-info/SOURCES.txt +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto.egg-info/dependency_links.txt +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto.egg-info/entry_points.txt +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto.egg-info/requires.txt +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/nbdevAuto.egg-info/top_level.txt +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/pyproject.toml +0 -0
- {nbdevauto-0.3.80 → nbdevauto-0.3.82}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.82"
|
|
@@ -63,6 +63,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
63
63
|
'nbdevAuto.fleet.fleet_scan': ('fleet.html#fleet_scan', 'nbdevAuto/fleet.py'),
|
|
64
64
|
'nbdevAuto.fleet.fleet_status': ('fleet.html#fleet_status', 'nbdevAuto/fleet.py'),
|
|
65
65
|
'nbdevAuto.fleet.fleet_sync': ('fleet.html#fleet_sync', 'nbdevAuto/fleet.py'),
|
|
66
|
+
'nbdevAuto.fleet.fleet_template': ('fleet.html#fleet_template', 'nbdevAuto/fleet.py'),
|
|
66
67
|
'nbdevAuto.fleet.fleet_update': ('fleet.html#fleet_update', 'nbdevAuto/fleet.py'),
|
|
67
68
|
'nbdevAuto.fleet.fleet_upload': ('fleet.html#fleet_upload', 'nbdevAuto/fleet.py'),
|
|
68
69
|
'nbdevAuto.fleet.format_summary': ('fleet.html#format_summary', 'nbdevAuto/fleet.py'),
|
|
@@ -9,10 +9,10 @@ __all__ = ['RAW_DOC_SUFFIXES', 'KNOWN_TOKEN', 'SECRET_PATTERNS', 'ALLOW', 'RENDE
|
|
|
9
9
|
'RESERVED_DOMAINS', 'BULK_EMAIL_MIN', 'NB_RULES', 'DLTASK_SECTIONS', 'DLTASK_NOT_TASKS', 'LARGE_NB_BYTES',
|
|
10
10
|
'SKIP_DIRECTIVES', 'NOT_PUBLISHED', 'VERBS', 'Skip', 'Outcome', 'Report', 'format_summary', 'walk', 'finish',
|
|
11
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',
|
|
13
|
-
'pull_root', 'fleet_update', 'fleet_sync', 'looks_secret', 'notebook_text', 'is_published',
|
|
14
|
-
'scan_one', 'fleet_scan', 'lint_notebook', 'unlinked_from_index', 'lint_one', 'lint_totals',
|
|
15
|
-
'parse_verb', 'usage', 'run_verb', 'fleet']
|
|
12
|
+
'fleet_copy', 'fleet_template', 'status_one', 'fleet_status', 'fetch_all', 'update_one', 'dirty_submodules',
|
|
13
|
+
'init_new', 'pull_root', 'fleet_update', 'fleet_sync', 'looks_secret', 'notebook_text', 'is_published',
|
|
14
|
+
'scan_file', 'scan_one', 'fleet_scan', 'lint_notebook', 'unlinked_from_index', 'lint_one', 'lint_totals',
|
|
15
|
+
'fleet_nblint', 'parse_verb', 'usage', 'run_verb', 'fleet']
|
|
16
16
|
|
|
17
17
|
# %% ../nbs/04_Fleet.ipynb #d361ee5f-9f09-464f-aec6-0e27cec90fe9
|
|
18
18
|
import json
|
|
@@ -210,18 +210,27 @@ def push_one(path, sub=None, dry_run=False):
|
|
|
210
210
|
if dry_run: return [f"would push {n} commit{'' if n == 1 else 's'} on {br}"]
|
|
211
211
|
return _push_summary(_run("git", "-C", str(path), "push"))
|
|
212
212
|
|
|
213
|
-
def copy_one(path, sub=None, files=(), dest="nbs", dry_run=False):
|
|
213
|
+
def copy_one(path, sub=None, files=(), dest="nbs", dry_run=False, fill=False):
|
|
214
214
|
"""Copy `files` into `path`/`dest`.
|
|
215
215
|
|
|
216
216
|
The file list belongs to the caller, so this stays a general-purpose copy rather than
|
|
217
|
-
learning about any particular superproject's shared chrome.
|
|
217
|
+
learning about any particular superproject's shared chrome.
|
|
218
|
+
|
|
219
|
+
With `fill`, the literal strings `${owner}` and `${repo}` become this submodule's GitHub
|
|
220
|
+
owner and repo, so one shared template can still link each site to its own repo. Plain
|
|
221
|
+
`str.replace`, not `string.Template`: that one also rewrites `$$`, which a copied file
|
|
222
|
+
may legitimately contain. A file without a placeholder is copied byte for byte."""
|
|
218
223
|
out = Path(path)/dest
|
|
219
224
|
if not out.is_dir(): raise Skip(f"no {dest}/")
|
|
220
225
|
names = []
|
|
221
226
|
for f in files:
|
|
222
227
|
src = Path(f)
|
|
223
228
|
if not src.is_file(): raise StepFailed(f"copy {src.name}", 1, f"no such file: {src}")
|
|
224
|
-
if
|
|
229
|
+
if dry_run: pass
|
|
230
|
+
elif fill and b"${" in (data := src.read_bytes()):
|
|
231
|
+
text = data.decode().replace("${owner}", sub.owner).replace("${repo}", sub.repo)
|
|
232
|
+
(out/src.name).write_text(text)
|
|
233
|
+
else: shutil.copy2(src, out/src.name)
|
|
225
234
|
names.append(src.name)
|
|
226
235
|
return [("would copy " if dry_run else "copied ") + ", ".join(names) + f" -> {dest}/"]
|
|
227
236
|
|
|
@@ -249,6 +258,22 @@ def fleet_copy(
|
|
|
249
258
|
root=root, workers=8, style="line")
|
|
250
259
|
sys.exit(finish(rep, "would update" if dry_run else "updated"))
|
|
251
260
|
|
|
261
|
+
def fleet_template(
|
|
262
|
+
files:str, # Files to copy into each submodule, comma or space separated
|
|
263
|
+
dest:str = "nbs", # Directory inside each submodule to copy into
|
|
264
|
+
dry_run:bool = False, # Report what would be copied without copying it
|
|
265
|
+
root:str = None, # Superproject root (default: nearest ancestor with .gitmodules)
|
|
266
|
+
):
|
|
267
|
+
"Copy shared files into every submodule, filling ${owner} and ${repo} per submodule"
|
|
268
|
+
# A separate verb rather than a `copy` flag: the justfile falls back to the source tree
|
|
269
|
+
# only when the installed release lacks the VERB, so an old `copy` would otherwise run
|
|
270
|
+
# and publish the raw placeholders.
|
|
271
|
+
fs = [f for f in re.split(r"[,\s]+", files) if f]
|
|
272
|
+
if not fs: sys.exit("fleet template: no files given")
|
|
273
|
+
rep = walk(lambda p, s: copy_one(p, s, files=fs, dest=dest, dry_run=dry_run, fill=True),
|
|
274
|
+
root=root, workers=8, style="line")
|
|
275
|
+
sys.exit(finish(rep, "would update" if dry_run else "updated"))
|
|
276
|
+
|
|
252
277
|
# %% ../nbs/04_Fleet.ipynb #5e870c46-a03b-4be9-a7a5-0a30e9af8830
|
|
253
278
|
def _porcelain(path):
|
|
254
279
|
"""`git status -s` for `path`, NOT stripped.
|
|
@@ -604,7 +629,7 @@ NB_RULES = [
|
|
|
604
629
|
("no_trailing_rule", "## cell without a trailing ---", 7),
|
|
605
630
|
]
|
|
606
631
|
# Matched case-insensitively against the `##` headings, as substrings, so "Datasets"
|
|
607
|
-
# also accepts "Datasets and splits". From dl-task-notebook-format.
|
|
632
|
+
# also accepts "Datasets and splits". From dl-task-notebook-format.md.
|
|
608
633
|
DLTASK_SECTIONS = ["What is", "Real-world use cases", "Evaluation", "Datasets",
|
|
609
634
|
"Setup", "benchmark", "Common frameworks", "Going further"]
|
|
610
635
|
DLTASK_NOT_TASKS = ("Theory", "Frameworks")
|
|
@@ -795,7 +820,8 @@ def fleet_nblint(
|
|
|
795
820
|
|
|
796
821
|
# %% ../nbs/04_Fleet.ipynb #0281bd2b-91ba-4e49-90dc-d1a95d54d5a6
|
|
797
822
|
VERBS = {"upload": fleet_upload, "push": fleet_push, "copy": fleet_copy,
|
|
798
|
-
"
|
|
823
|
+
"template": fleet_template, "status": fleet_status, "update": fleet_update,
|
|
824
|
+
"sync": fleet_sync,
|
|
799
825
|
"scan": fleet_scan, "nblint": fleet_nblint}
|
|
800
826
|
|
|
801
827
|
def parse_verb(argv):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.80"
|
|
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
|