nbdevAuto 0.3.89__tar.gz → 0.3.95__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.89/nbdevAuto.egg-info → nbdevauto-0.3.95}/PKG-INFO +36 -41
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/README.md +35 -40
- nbdevauto-0.3.95/nbdevAuto/__init__.py +1 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto/_modidx.py +87 -108
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto/automate.py +3 -104
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto/fleet.py +7 -23
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto/functions.py +2 -19
- {nbdevauto-0.3.89 → nbdevauto-0.3.95/nbdevAuto.egg-info}/PKG-INFO +36 -41
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto.egg-info/SOURCES.txt +0 -2
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto.egg-info/entry_points.txt +0 -5
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/pyproject.toml +0 -5
- nbdevauto-0.3.89/nbdevAuto/__init__.py +0 -1
- nbdevauto-0.3.89/nbdevAuto/core.py +0 -7
- nbdevauto-0.3.89/nbdevAuto/pdf.py +0 -92
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/LICENSE +0 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/MANIFEST.in +0 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto/github.py +0 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto.egg-info/dependency_links.txt +0 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto.egg-info/requires.txt +0 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/nbdevAuto.egg-info/top_level.txt +0 -0
- {nbdevauto-0.3.89 → nbdevauto-0.3.95}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nbdevAuto
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.95
|
|
4
4
|
Summary: automating nbdev
|
|
5
5
|
Author-email: Benedict Thekkel <bthekkel1@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -30,6 +30,7 @@ Dynamic: license-file
|
|
|
30
30
|
|
|
31
31
|
# nbdevAuto
|
|
32
32
|
|
|
33
|
+
Command line automation for the nbdev publish cycle, plus the dataset and image helpers the notebooks in this collection reuse.
|
|
33
34
|
|
|
34
35
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
35
36
|
|
|
@@ -37,114 +38,108 @@ Unlike most sites in this collection, this one documents an **installable librar
|
|
|
37
38
|
|
|
38
39
|
The library collapses that sequence into single-word shell commands. It is what `just upload` and `just full_upload` invoke under the hood for every submodule in the parent Knowledge repo.
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
---
|
|
41
42
|
|
|
42
43
|
## Install
|
|
43
44
|
|
|
44
|
-
```
|
|
45
|
+
```sh
|
|
45
46
|
pip install nbdevAuto # the publish-cycle commands and the helpers
|
|
46
47
|
pip install 'nbdevAuto[gh]' # also installs githubkit, which `ghstatus` needs
|
|
47
48
|
```
|
|
48
49
|
|
|
49
50
|
Requires Python 3.10 or newer.
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
---
|
|
52
53
|
|
|
53
54
|
## Use
|
|
54
55
|
|
|
55
56
|
Every exported function is also a console script, so the common case is a bare word in the terminal at the root of an nbdev project:
|
|
56
57
|
|
|
57
|
-
```
|
|
58
|
+
```sh
|
|
58
59
|
upload -m "commit message" # export, test, clean, then add/commit/push
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
Or import the helpers into a notebook:
|
|
62
63
|
|
|
63
|
-
```
|
|
64
|
+
```python
|
|
64
65
|
from nbdevAuto.functions import download_search_images, classify_images
|
|
65
|
-
from nbdevAuto.pdf import PDFreader
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
---
|
|
69
69
|
|
|
70
70
|
## Contents
|
|
71
71
|
|
|
72
72
|
| Page | Covers |
|
|
73
|
-
|
|
74
|
-
| [Functions](
|
|
75
|
-
| [Automate](
|
|
76
|
-
| [
|
|
77
|
-
| [
|
|
78
|
-
| [Fleet](04_Fleet.ipynb) | [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet): running one command across every submodule of a superproject. A walker that reports only what did work and counts the rest, plus the verbs built on it - upload, push, copy, status, update and sync |
|
|
73
|
+
|--- |--- |
|
|
74
|
+
| [Functions](https://bthek1.github.io/nbdevAuto/functions.html) | Dataset and image helpers: downloading single images or whole search-driven datasets, verifying and resizing what came back, building the folder layout a classifier expects, running a fastai learner over one image, Kaggle competition and dataset shortcuts, and [`graph`](https://bthek1.github.io/nbdevAuto/functions.html#graph), a `graphviz.Digraph` subclass preloaded with a rounded, filled style |
|
|
75
|
+
| [Automate](https://bthek1.github.io/nbdevAuto/automate.html) | The command line surface: the prep/commit/push pipeline and the one-line-per-stage console grid every command reports through |
|
|
76
|
+
| [GitHub](https://bthek1.github.io/nbdevAuto/github.html) | [`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus): reading `.gitmodules`, resolving a token, and asking the GitHub API about every submodule at once - CI runs, Pages deploys, Pages builds, remote `main` shas - plus the `--report` and `--audit` views, the exit codes that keep "absent" apart from "cannot ask", and [`newest_run`](https://bthek1.github.io/nbdevAuto/github.html#newest_run), which picks a run by `run_number` because the API's page order is not a contract |
|
|
77
|
+
| [Fleet](https://bthek1.github.io/nbdevAuto/fleet.html) | [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet): running one command across every submodule of a superproject. A walker that reports only what did work and counts the rest, plus the verbs built on it - upload, push, template, status, update, sync, scan and nblint |
|
|
79
78
|
|
|
80
|
-
|
|
79
|
+
---
|
|
81
80
|
|
|
82
81
|
## The Command Line Surface
|
|
83
82
|
|
|
84
|
-
Installing the package puts these on your `PATH`. Most are ordinary functions in [Automate](
|
|
83
|
+
Installing the package puts these on your `PATH`. Most are ordinary functions in [Automate](https://bthek1.github.io/nbdevAuto/automate.html), exposed as scripts through `[project.scripts]`; [`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) comes from [GitHub](https://bthek1.github.io/nbdevAuto/github.html) and [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet) from [Fleet](https://bthek1.github.io/nbdevAuto/fleet.html).
|
|
85
84
|
|
|
86
85
|
| Command | Does |
|
|
87
|
-
|
|
86
|
+
|--- |--- |
|
|
88
87
|
| [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) | Bump the version, then export, test and clean the notebooks, refreshing `_quarto.yml` and the README |
|
|
89
88
|
| [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp) | git add, commit, and push. Without `-m` the message is built from the staged paths |
|
|
90
|
-
| [`status`](https://bthek1.github.io/nbdevAuto/automate.html#status) | Show the working tree state |
|
|
91
89
|
| [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) | [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) then [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp), the one you actually type |
|
|
92
|
-
| `gitrelease` | Bump the **minor** version, then tag and create a GitHub release |
|
|
93
|
-
| `piprelease` | Build the sdist and wheel, then upload to PyPI with twine |
|
|
94
|
-
| [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release) | `gitrelease` then `piprelease` |
|
|
95
90
|
| [`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) | Remote status for every submodule of an nbdev superproject, from the GitHub API. `--report` for the sync view, `--audit` to check `.gitmodules` against the repos the account owns, `--json` for machine output |
|
|
96
|
-
| [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet) | Run one command across every submodule:
|
|
97
|
-
| `h` | Print the list of available commands |
|
|
91
|
+
| [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet) | Run one command across every submodule: \`fleet upload |
|
|
98
92
|
|
|
99
|
-
Both [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) and [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) take `-p` to choose which version part to increment; it defaults to 2, the patch, so every [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a new version.
|
|
93
|
+
Both [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) and [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) take `-p` to choose which version part to increment; it defaults to 2, the patch, so every [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a new version. Use `-p 1` for a minor release.
|
|
100
94
|
|
|
101
|
-
|
|
95
|
+
Pushing to `main` publishes to PyPI on its own: `publish.yaml` runs after CI passes, and skips quietly when the version is already there.
|
|
102
96
|
|
|
103
97
|
[`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) needs the `gh` extra (`pip install 'nbdevAuto[gh]'`), which brings in `githubkit`. It is an extra rather than a dependency because githubkit pulls pydantic, httpx and hishel behind it, which is a lot of weight for anyone who only wants [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload). Without it the command exits 3 with an install hint rather than a traceback. It takes its token from `$GITHUB_TOKEN` / `$GH_TOKEN`, then `gh auth token`.
|
|
104
98
|
|
|
105
|
-
|
|
99
|
+
---
|
|
106
100
|
|
|
107
101
|
## The Output Contract
|
|
108
102
|
|
|
109
|
-
Every command reports through one grid, defined in [Automate](
|
|
103
|
+
Every command reports through one grid, defined in [Automate](https://bthek1.github.io/nbdevAuto/automate.html) and reused by [Fleet](https://bthek1.github.io/nbdevAuto/fleet.html). It exists because these commands run 19 times in a row, so anything that costs three lines per stage costs sixty over a fleet.
|
|
110
104
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
```
|
|
106
|
+
1/6 bump version (part 2) OK 75ms 0.3.67 -> 0.3.68
|
|
107
|
+
2/6 nbdev_export OK 129ms
|
|
108
|
+
3/6 nbdev_test OK 1.5s 6 notebooks, slowest 01_Automate.ipynb 1.0s
|
|
109
|
+
```
|
|
114
110
|
|
|
115
111
|
Four rules hold it together, and a change to any stage has to keep them:
|
|
116
112
|
|
|
117
113
|
- **One stage, one line, inside 88 columns.** The columns are fixed: `n/total` (5), label (22), outcome (4), duration (7), detail (the rest). A unit test renders real stages through a console pinned to that width and asserts every line fits.
|
|
118
114
|
- **A summariser returns short strings, not a transcript.** [`_test_summary`](https://bthek1.github.io/nbdevAuto/automate.html#_test_summary) turns a line per notebook into `6 notebooks, slowest X 1.0s`; [`_push_summary`](https://bthek1.github.io/nbdevAuto/automate.html#_push_summary) turns nine lines of git progress into a sha range and a size. Anything too long for the detail column moves to an indented continuation line, so a verbose summariser degrades the layout rather than breaking it.
|
|
119
|
-
- **A stage that shells out must capture at the file-descriptor level.** `redirect_stdout` only rebinds Python
|
|
120
|
-
- **A green OK has to mean something.** [`_run`](https://bthek1.github.io/nbdevAuto/automate.html#_run) raises on a non-zero exit rather than returning a code nobody reads, and the failure prints the command
|
|
115
|
+
- **A stage that shells out must capture at the file-descriptor level.** `redirect_stdout` only rebinds Python's `sys.stdout`, so a child process writing to fd 1 walks straight past it - which is how `nbdev_readme` used to spill sixteen lines of pandoc metadata into the middle of a run. [`_quiet`](https://bthek1.github.io/nbdevAuto/automate.html#_quiet) swaps fds 1 and 2 for a temp file as well and merges both captures.
|
|
116
|
+
- **A green OK has to mean something.** [`_run`](https://bthek1.github.io/nbdevAuto/automate.html#_run) raises on a non-zero exit rather than returning a code nobody reads, and the failure prints the command's own output. Before that, a failed `git push` still reported `OK`.
|
|
121
117
|
|
|
122
118
|
On a terminal the label is written first without a newline, so a slow stage is visible while it runs, then rewritten in place. Piped output skips that entirely, because a carriage return in a log file is just noise.
|
|
123
119
|
|
|
124
|
-
|
|
120
|
+
---
|
|
125
121
|
|
|
126
122
|
## Where It Is Used
|
|
127
123
|
|
|
128
|
-
The parent Knowledge repo
|
|
124
|
+
The parent Knowledge repo's `justfile` calls [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) once per submodule. `just upload` runs it only where the working tree is dirty, `just full_upload` runs it everywhere. That is the main consumer, so a change to `automate.py` affects the publish path for every site in the collection.
|
|
129
125
|
|
|
130
|
-
[`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) is the other half of that loop. [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) pushes to 19 repos and then goes blind: whether each repo
|
|
126
|
+
[`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) is the other half of that loop. [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) pushes to 19 repos and then goes blind: whether each repo's CI passed and whether its Pages deploy actually landed is invisible from the terminal. `just ci`, `just report` and `just audit` in the parent repo are all thin wrappers around this one command, which answers for the whole fleet in about 1.5 seconds instead of 19 browser tabs.
|
|
131
127
|
|
|
132
|
-
|
|
128
|
+
---
|
|
133
129
|
|
|
134
130
|
## Releases
|
|
135
131
|
|
|
136
132
|
This package publishes itself. A `publish.yaml` workflow runs after CI passes on `main` and uploads to PyPI through Trusted Publishing, so no API token is stored in the repository. It reads `__version__` out of `nbdevAuto/__init__.py` and asks PyPI whether that version already exists: a new version is published, an existing one is skipped without failing the build. Once PyPI accepts it, the same workflow creates the matching GitHub release (tag `<version>`, title `v<version>`, auto-generated notes) with the built wheel and sdist attached, and skips if that release already exists.
|
|
137
133
|
|
|
138
|
-
Because [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) bumps the patch version on every push, an ordinary commit made with [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a release. A plain `git commit` leaves the version alone and the workflow skips.
|
|
134
|
+
Because [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) bumps the patch version on every push, an ordinary commit made with [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a release. A plain `git commit` leaves the version alone and the workflow skips. For a minor release, run `upload -p 1`.
|
|
139
135
|
|
|
140
|
-
|
|
136
|
+
---
|
|
141
137
|
|
|
142
138
|
## Not Covered Yet
|
|
143
139
|
|
|
144
140
|
- **No tests for the helpers.** `01_Automate.ipynb`, `03_GitHub.ipynb` and `04_Fleet.ipynb` all carry unit tests for their pure functions - the fleet ones against a throwaway superproject of real git repos - but the dataset and image helpers in `00_Functions.ipynb` are exercised only by being used, so a broken one surfaces in a downstream repo rather than here.
|
|
145
|
-
- **Undeclared dependencies.** `pyproject.toml` declares `graphviz` and `fastcore`, plus `githubkit` behind the `gh` extra. The helpers additionally import `fastai`, `fastbook`, `fastdownload`, `PIL`, `matplotlib`, `tqdm`, `
|
|
146
|
-
- **`core.py` is an empty nbdev stub** (a single `foo`) left over from `00_core.ipynb`, which no longer exists.
|
|
141
|
+
- **Undeclared dependencies.** `pyproject.toml` declares `graphviz` and `fastcore`, plus `githubkit` behind the `gh` extra. The helpers additionally import `fastai`, `fastbook`, `fastdownload`, `PIL`, `matplotlib`, `tqdm`, `nbdev` and `kaggle` (which also needs its credentials). All of those are imported lazily inside the function that needs them, so installing the package and running the console scripts still works - only the specific helper you call fails. Install them yourself.
|
|
147
142
|
- **`CHANGELOG.md` is still the nbdev stub** (`Version 1.0.0 - Initial release`) while the package is past 0.3.68. Nothing generates it, and [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) bumps the patch on every push, so it would need writing by hand or dropping.
|
|
148
143
|
- The docstrings are one-liners, so the rendered API pages are thin. The notebooks carry the real explanation.
|
|
149
144
|
|
|
150
|
-
|
|
145
|
+
---
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# nbdevAuto
|
|
2
2
|
|
|
3
|
+
Command line automation for the nbdev publish cycle, plus the dataset and image helpers the notebooks in this collection reuse.
|
|
3
4
|
|
|
4
5
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
5
6
|
|
|
@@ -7,114 +8,108 @@ Unlike most sites in this collection, this one documents an **installable librar
|
|
|
7
8
|
|
|
8
9
|
The library collapses that sequence into single-word shell commands. It is what `just upload` and `just full_upload` invoke under the hood for every submodule in the parent Knowledge repo.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
---
|
|
11
12
|
|
|
12
13
|
## Install
|
|
13
14
|
|
|
14
|
-
```
|
|
15
|
+
```sh
|
|
15
16
|
pip install nbdevAuto # the publish-cycle commands and the helpers
|
|
16
17
|
pip install 'nbdevAuto[gh]' # also installs githubkit, which `ghstatus` needs
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
Requires Python 3.10 or newer.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
---
|
|
22
23
|
|
|
23
24
|
## Use
|
|
24
25
|
|
|
25
26
|
Every exported function is also a console script, so the common case is a bare word in the terminal at the root of an nbdev project:
|
|
26
27
|
|
|
27
|
-
```
|
|
28
|
+
```sh
|
|
28
29
|
upload -m "commit message" # export, test, clean, then add/commit/push
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
Or import the helpers into a notebook:
|
|
32
33
|
|
|
33
|
-
```
|
|
34
|
+
```python
|
|
34
35
|
from nbdevAuto.functions import download_search_images, classify_images
|
|
35
|
-
from nbdevAuto.pdf import PDFreader
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
---
|
|
39
39
|
|
|
40
40
|
## Contents
|
|
41
41
|
|
|
42
42
|
| Page | Covers |
|
|
43
|
-
|
|
44
|
-
| [Functions](
|
|
45
|
-
| [Automate](
|
|
46
|
-
| [
|
|
47
|
-
| [
|
|
48
|
-
| [Fleet](04_Fleet.ipynb) | [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet): running one command across every submodule of a superproject. A walker that reports only what did work and counts the rest, plus the verbs built on it - upload, push, copy, status, update and sync |
|
|
43
|
+
|--- |--- |
|
|
44
|
+
| [Functions](https://bthek1.github.io/nbdevAuto/functions.html) | Dataset and image helpers: downloading single images or whole search-driven datasets, verifying and resizing what came back, building the folder layout a classifier expects, running a fastai learner over one image, Kaggle competition and dataset shortcuts, and [`graph`](https://bthek1.github.io/nbdevAuto/functions.html#graph), a `graphviz.Digraph` subclass preloaded with a rounded, filled style |
|
|
45
|
+
| [Automate](https://bthek1.github.io/nbdevAuto/automate.html) | The command line surface: the prep/commit/push pipeline and the one-line-per-stage console grid every command reports through |
|
|
46
|
+
| [GitHub](https://bthek1.github.io/nbdevAuto/github.html) | [`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus): reading `.gitmodules`, resolving a token, and asking the GitHub API about every submodule at once - CI runs, Pages deploys, Pages builds, remote `main` shas - plus the `--report` and `--audit` views, the exit codes that keep "absent" apart from "cannot ask", and [`newest_run`](https://bthek1.github.io/nbdevAuto/github.html#newest_run), which picks a run by `run_number` because the API's page order is not a contract |
|
|
47
|
+
| [Fleet](https://bthek1.github.io/nbdevAuto/fleet.html) | [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet): running one command across every submodule of a superproject. A walker that reports only what did work and counts the rest, plus the verbs built on it - upload, push, template, status, update, sync, scan and nblint |
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
---
|
|
51
50
|
|
|
52
51
|
## The Command Line Surface
|
|
53
52
|
|
|
54
|
-
Installing the package puts these on your `PATH`. Most are ordinary functions in [Automate](
|
|
53
|
+
Installing the package puts these on your `PATH`. Most are ordinary functions in [Automate](https://bthek1.github.io/nbdevAuto/automate.html), exposed as scripts through `[project.scripts]`; [`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) comes from [GitHub](https://bthek1.github.io/nbdevAuto/github.html) and [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet) from [Fleet](https://bthek1.github.io/nbdevAuto/fleet.html).
|
|
55
54
|
|
|
56
55
|
| Command | Does |
|
|
57
|
-
|
|
56
|
+
|--- |--- |
|
|
58
57
|
| [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) | Bump the version, then export, test and clean the notebooks, refreshing `_quarto.yml` and the README |
|
|
59
58
|
| [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp) | git add, commit, and push. Without `-m` the message is built from the staged paths |
|
|
60
|
-
| [`status`](https://bthek1.github.io/nbdevAuto/automate.html#status) | Show the working tree state |
|
|
61
59
|
| [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) | [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) then [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp), the one you actually type |
|
|
62
|
-
| `gitrelease` | Bump the **minor** version, then tag and create a GitHub release |
|
|
63
|
-
| `piprelease` | Build the sdist and wheel, then upload to PyPI with twine |
|
|
64
|
-
| [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release) | `gitrelease` then `piprelease` |
|
|
65
60
|
| [`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) | Remote status for every submodule of an nbdev superproject, from the GitHub API. `--report` for the sync view, `--audit` to check `.gitmodules` against the repos the account owns, `--json` for machine output |
|
|
66
|
-
| [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet) | Run one command across every submodule:
|
|
67
|
-
| `h` | Print the list of available commands |
|
|
61
|
+
| [`fleet`](https://bthek1.github.io/nbdevAuto/fleet.html#fleet) | Run one command across every submodule: \`fleet upload |
|
|
68
62
|
|
|
69
|
-
Both [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) and [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) take `-p` to choose which version part to increment; it defaults to 2, the patch, so every [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a new version.
|
|
63
|
+
Both [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) and [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) take `-p` to choose which version part to increment; it defaults to 2, the patch, so every [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a new version. Use `-p 1` for a minor release.
|
|
70
64
|
|
|
71
|
-
|
|
65
|
+
Pushing to `main` publishes to PyPI on its own: `publish.yaml` runs after CI passes, and skips quietly when the version is already there.
|
|
72
66
|
|
|
73
67
|
[`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) needs the `gh` extra (`pip install 'nbdevAuto[gh]'`), which brings in `githubkit`. It is an extra rather than a dependency because githubkit pulls pydantic, httpx and hishel behind it, which is a lot of weight for anyone who only wants [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload). Without it the command exits 3 with an install hint rather than a traceback. It takes its token from `$GITHUB_TOKEN` / `$GH_TOKEN`, then `gh auth token`.
|
|
74
68
|
|
|
75
|
-
|
|
69
|
+
---
|
|
76
70
|
|
|
77
71
|
## The Output Contract
|
|
78
72
|
|
|
79
|
-
Every command reports through one grid, defined in [Automate](
|
|
73
|
+
Every command reports through one grid, defined in [Automate](https://bthek1.github.io/nbdevAuto/automate.html) and reused by [Fleet](https://bthek1.github.io/nbdevAuto/fleet.html). It exists because these commands run 19 times in a row, so anything that costs three lines per stage costs sixty over a fleet.
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
```
|
|
76
|
+
1/6 bump version (part 2) OK 75ms 0.3.67 -> 0.3.68
|
|
77
|
+
2/6 nbdev_export OK 129ms
|
|
78
|
+
3/6 nbdev_test OK 1.5s 6 notebooks, slowest 01_Automate.ipynb 1.0s
|
|
79
|
+
```
|
|
84
80
|
|
|
85
81
|
Four rules hold it together, and a change to any stage has to keep them:
|
|
86
82
|
|
|
87
83
|
- **One stage, one line, inside 88 columns.** The columns are fixed: `n/total` (5), label (22), outcome (4), duration (7), detail (the rest). A unit test renders real stages through a console pinned to that width and asserts every line fits.
|
|
88
84
|
- **A summariser returns short strings, not a transcript.** [`_test_summary`](https://bthek1.github.io/nbdevAuto/automate.html#_test_summary) turns a line per notebook into `6 notebooks, slowest X 1.0s`; [`_push_summary`](https://bthek1.github.io/nbdevAuto/automate.html#_push_summary) turns nine lines of git progress into a sha range and a size. Anything too long for the detail column moves to an indented continuation line, so a verbose summariser degrades the layout rather than breaking it.
|
|
89
|
-
- **A stage that shells out must capture at the file-descriptor level.** `redirect_stdout` only rebinds Python
|
|
90
|
-
- **A green OK has to mean something.** [`_run`](https://bthek1.github.io/nbdevAuto/automate.html#_run) raises on a non-zero exit rather than returning a code nobody reads, and the failure prints the command
|
|
85
|
+
- **A stage that shells out must capture at the file-descriptor level.** `redirect_stdout` only rebinds Python's `sys.stdout`, so a child process writing to fd 1 walks straight past it - which is how `nbdev_readme` used to spill sixteen lines of pandoc metadata into the middle of a run. [`_quiet`](https://bthek1.github.io/nbdevAuto/automate.html#_quiet) swaps fds 1 and 2 for a temp file as well and merges both captures.
|
|
86
|
+
- **A green OK has to mean something.** [`_run`](https://bthek1.github.io/nbdevAuto/automate.html#_run) raises on a non-zero exit rather than returning a code nobody reads, and the failure prints the command's own output. Before that, a failed `git push` still reported `OK`.
|
|
91
87
|
|
|
92
88
|
On a terminal the label is written first without a newline, so a slow stage is visible while it runs, then rewritten in place. Piped output skips that entirely, because a carriage return in a log file is just noise.
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
---
|
|
95
91
|
|
|
96
92
|
## Where It Is Used
|
|
97
93
|
|
|
98
|
-
The parent Knowledge repo
|
|
94
|
+
The parent Knowledge repo's `justfile` calls [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) once per submodule. `just upload` runs it only where the working tree is dirty, `just full_upload` runs it everywhere. That is the main consumer, so a change to `automate.py` affects the publish path for every site in the collection.
|
|
99
95
|
|
|
100
|
-
[`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) is the other half of that loop. [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) pushes to 19 repos and then goes blind: whether each repo
|
|
96
|
+
[`ghstatus`](https://bthek1.github.io/nbdevAuto/github.html#ghstatus) is the other half of that loop. [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) pushes to 19 repos and then goes blind: whether each repo's CI passed and whether its Pages deploy actually landed is invisible from the terminal. `just ci`, `just report` and `just audit` in the parent repo are all thin wrappers around this one command, which answers for the whole fleet in about 1.5 seconds instead of 19 browser tabs.
|
|
101
97
|
|
|
102
|
-
|
|
98
|
+
---
|
|
103
99
|
|
|
104
100
|
## Releases
|
|
105
101
|
|
|
106
102
|
This package publishes itself. A `publish.yaml` workflow runs after CI passes on `main` and uploads to PyPI through Trusted Publishing, so no API token is stored in the repository. It reads `__version__` out of `nbdevAuto/__init__.py` and asks PyPI whether that version already exists: a new version is published, an existing one is skipped without failing the build. Once PyPI accepts it, the same workflow creates the matching GitHub release (tag `<version>`, title `v<version>`, auto-generated notes) with the built wheel and sdist attached, and skips if that release already exists.
|
|
107
103
|
|
|
108
|
-
Because [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) bumps the patch version on every push, an ordinary commit made with [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a release. A plain `git commit` leaves the version alone and the workflow skips.
|
|
104
|
+
Because [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) bumps the patch version on every push, an ordinary commit made with [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) ships a release. A plain `git commit` leaves the version alone and the workflow skips. For a minor release, run `upload -p 1`.
|
|
109
105
|
|
|
110
|
-
|
|
106
|
+
---
|
|
111
107
|
|
|
112
108
|
## Not Covered Yet
|
|
113
109
|
|
|
114
110
|
- **No tests for the helpers.** `01_Automate.ipynb`, `03_GitHub.ipynb` and `04_Fleet.ipynb` all carry unit tests for their pure functions - the fleet ones against a throwaway superproject of real git repos - but the dataset and image helpers in `00_Functions.ipynb` are exercised only by being used, so a broken one surfaces in a downstream repo rather than here.
|
|
115
|
-
- **Undeclared dependencies.** `pyproject.toml` declares `graphviz` and `fastcore`, plus `githubkit` behind the `gh` extra. The helpers additionally import `fastai`, `fastbook`, `fastdownload`, `PIL`, `matplotlib`, `tqdm`, `
|
|
116
|
-
- **`core.py` is an empty nbdev stub** (a single `foo`) left over from `00_core.ipynb`, which no longer exists.
|
|
111
|
+
- **Undeclared dependencies.** `pyproject.toml` declares `graphviz` and `fastcore`, plus `githubkit` behind the `gh` extra. The helpers additionally import `fastai`, `fastbook`, `fastdownload`, `PIL`, `matplotlib`, `tqdm`, `nbdev` and `kaggle` (which also needs its credentials). All of those are imported lazily inside the function that needs them, so installing the package and running the console scripts still works - only the specific helper you call fails. Install them yourself.
|
|
117
112
|
- **`CHANGELOG.md` is still the nbdev stub** (`Version 1.0.0 - Initial release`) while the package is past 0.3.68. Nothing generates it, and [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) bumps the patch on every push, so it would need writing by hand or dropping.
|
|
118
113
|
- The docstrings are one-liners, so the rendered API pages are thin. The notebooks carry the real explanation.
|
|
119
114
|
|
|
120
|
-
|
|
115
|
+
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.95"
|