Skip to content

Commit 43d69a8

Browse files
committed
add change to nbs rather than in autogen files >.<
1 parent 940db05 commit 43d69a8

File tree

1 file changed

+97
-20
lines changed

1 file changed

+97
-20
lines changed

nbs/api/13_cli.ipynb

Lines changed: 97 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"id": "ff4908a6",
67
"metadata": {},
@@ -14,7 +15,11 @@
1415
"cell_type": "code",
1516
"execution_count": null,
1617
"id": "c6d13dc1",
17-
"metadata": {},
18+
"metadata": {
19+
"vscode": {
20+
"languageId": "python"
21+
}
22+
},
1823
"outputs": [],
1924
"source": [
2025
"#|default_exp cli"
@@ -24,7 +29,11 @@
2429
"cell_type": "code",
2530
"execution_count": null,
2631
"id": "6a35c7c4-748f-4c82-a9bf-c780a8d83e90",
27-
"metadata": {},
32+
"metadata": {
33+
"vscode": {
34+
"languageId": "python"
35+
}
36+
},
2837
"outputs": [],
2938
"source": [
3039
"#|export\n",
@@ -56,7 +65,11 @@
5665
"cell_type": "code",
5766
"execution_count": null,
5867
"id": "1e623a3d-3e77-44c6-adf3-4768b78328c5",
59-
"metadata": {},
68+
"metadata": {
69+
"vscode": {
70+
"languageId": "python"
71+
}
72+
},
6073
"outputs": [],
6174
"source": [
6275
"#|hide\n",
@@ -66,6 +79,7 @@
6679
]
6780
},
6881
{
82+
"attachments": {},
6983
"cell_type": "markdown",
7084
"id": "e9fc60a8",
7185
"metadata": {},
@@ -77,7 +91,11 @@
7791
"cell_type": "code",
7892
"execution_count": null,
7993
"id": "86c29369",
80-
"metadata": {},
94+
"metadata": {
95+
"vscode": {
96+
"languageId": "python"
97+
}
98+
},
8199
"outputs": [],
82100
"source": [
83101
"#|export\n",
@@ -108,7 +126,11 @@
108126
"cell_type": "code",
109127
"execution_count": null,
110128
"id": "fe4dc8bf",
111-
"metadata": {},
129+
"metadata": {
130+
"vscode": {
131+
"languageId": "python"
132+
}
133+
},
112134
"outputs": [],
113135
"source": [
114136
"#|hide\n",
@@ -117,6 +139,7 @@
117139
]
118140
},
119141
{
142+
"attachments": {},
120143
"cell_type": "markdown",
121144
"id": "3e7e76f7-7b19-4347-a52b-c33ad15d2178",
122145
"metadata": {},
@@ -128,7 +151,11 @@
128151
"cell_type": "code",
129152
"execution_count": null,
130153
"id": "a1c001af-2c7c-4e0b-8c7d-a7d40c08f5e9",
131-
"metadata": {},
154+
"metadata": {
155+
"vscode": {
156+
"languageId": "python"
157+
}
158+
},
132159
"outputs": [],
133160
"source": [
134161
"#|export\n",
@@ -141,7 +168,11 @@
141168
"cell_type": "code",
142169
"execution_count": null,
143170
"id": "60df4b28",
144-
"metadata": {},
171+
"metadata": {
172+
"vscode": {
173+
"languageId": "python"
174+
}
175+
},
145176
"outputs": [],
146177
"source": [
147178
"#|export\n",
@@ -157,7 +188,11 @@
157188
"cell_type": "code",
158189
"execution_count": null,
159190
"id": "dd385911-aa8f-44e7-8d46-7b8a20f3b010",
160-
"metadata": {},
191+
"metadata": {
192+
"vscode": {
193+
"languageId": "python"
194+
}
195+
},
161196
"outputs": [],
162197
"source": [
163198
"#|export\n",
@@ -176,7 +211,11 @@
176211
"cell_type": "code",
177212
"execution_count": null,
178213
"id": "c4a663d9",
179-
"metadata": {},
214+
"metadata": {
215+
"vscode": {
216+
"languageId": "python"
217+
}
218+
},
180219
"outputs": [],
181220
"source": [
182221
"#|export\n",
@@ -190,13 +229,28 @@
190229
" _update_repo_meta(cfg)\n",
191230
"\n",
192231
" path = Path()\n",
193-
" with warnings.catch_warnings():\n",
194-
" warnings.simplefilter('ignore', UserWarning)\n",
195-
" tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release('fastai', 'nbdev-template').tag_name\n",
196-
" url = f\"https://github.com/fastai/nbdev-template/archive/{tag}.tar.gz\"\n",
197-
" extract_tgz(url)\n",
198-
" tmpl_path = path/f'nbdev-template-{tag}'\n",
199232
"\n",
233+
" _ORG_OR_USR = 'fastai'\n",
234+
" _REPOSITORY = 'nbdev-template'\n",
235+
" _TEMPLATE = f'{_ORG_OR_USR}/{_TEMPLATE}'\n",
236+
" template = kwargs.get('template', _TEMPLATE)\n",
237+
" try:\n",
238+
" org_or_usr, repo = template.split('/')\n",
239+
" except ValueError:\n",
240+
" org_or_usr, repo = _ORG_OR_USR, _REPOSITORY\n",
241+
"\n",
242+
"\n",
243+
" tag = kwargs.get('tag', None)\n",
244+
" if tag is None:\n",
245+
" with warnings.catch_warnings():\n",
246+
" warnings.simplefilter('ignore', UserWarning)\n",
247+
"\n",
248+
" tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release(org_or_usr, repo).tag_name\n",
249+
"\n",
250+
" url = f\"https://github.com/{org_or_usr}/{repo}/archive/{tag}.tar.gz\"\n",
251+
" extract_tgz(url)\n",
252+
" tmpl_path = path/f'{repo}-{tag}'\n",
253+
" \n",
200254
" cfg.nbs_path.mkdir(exist_ok=True)\n",
201255
" nbexists = bool(first(cfg.nbs_path.glob('*.ipynb')))\n",
202256
" _nbs_path_sufs = ('.ipynb','.css')\n",
@@ -215,6 +269,7 @@
215269
]
216270
},
217271
{
272+
"attachments": {},
218273
"cell_type": "markdown",
219274
"id": "2239c092",
220275
"metadata": {},
@@ -226,7 +281,11 @@
226281
"cell_type": "code",
227282
"execution_count": null,
228283
"id": "edc5f6e9",
229-
"metadata": {},
284+
"metadata": {
285+
"vscode": {
286+
"languageId": "python"
287+
}
288+
},
230289
"outputs": [],
231290
"source": [
232291
"#|hide\n",
@@ -236,6 +295,7 @@
236295
]
237296
},
238297
{
298+
"attachments": {},
239299
"cell_type": "markdown",
240300
"id": "280e0d6d-6559-4fc3-9478-320ce5eff0dc",
241301
"metadata": {},
@@ -247,7 +307,11 @@
247307
"cell_type": "code",
248308
"execution_count": null,
249309
"id": "e34f6ff4-f85b-4805-b406-121279cc9246",
250-
"metadata": {},
310+
"metadata": {
311+
"vscode": {
312+
"languageId": "python"
313+
}
314+
},
251315
"outputs": [],
252316
"source": [
253317
"#|export\n",
@@ -262,7 +326,11 @@
262326
"cell_type": "code",
263327
"execution_count": null,
264328
"id": "b50d27fb-c343-47e2-a008-7ebdd02e1356",
265-
"metadata": {},
329+
"metadata": {
330+
"vscode": {
331+
"languageId": "python"
332+
}
333+
},
266334
"outputs": [
267335
{
268336
"name": "stdout",
@@ -305,6 +373,7 @@
305373
]
306374
},
307375
{
376+
"attachments": {},
308377
"cell_type": "markdown",
309378
"id": "aa35b010",
310379
"metadata": {},
@@ -316,7 +385,11 @@
316385
"cell_type": "code",
317386
"execution_count": null,
318387
"id": "3d8031ce",
319-
"metadata": {},
388+
"metadata": {
389+
"vscode": {
390+
"languageId": "python"
391+
}
392+
},
320393
"outputs": [],
321394
"source": [
322395
"#|hide\n",
@@ -327,7 +400,11 @@
327400
"cell_type": "code",
328401
"execution_count": null,
329402
"id": "12588a26-43a6-42c4-bacd-896293c871ab",
330-
"metadata": {},
403+
"metadata": {
404+
"vscode": {
405+
"languageId": "python"
406+
}
407+
},
331408
"outputs": [],
332409
"source": []
333410
}

0 commit comments

Comments
 (0)