Skip to content

Commit 683f06f

Browse files
authored
Merge pull request #957 from fastai/finish-setup
move GitHub pages enablement to GitHub Actions
2 parents d351adc + 350a72f commit 683f06f

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

nbdev/cli.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ def _update_repo_meta(cfg):
8888
if token:
8989
from ghapi.core import GhApi
9090
api = GhApi(owner=cfg.user, repo=cfg.repo, token=token)
91-
try: # repo needs something in it before you can enable pages
92-
cmds = L(['git add settings.ini', "git commit -m'add settings'", 'git config push.default current', 'git push'])
93-
cmds.map(partial(run, ignore_ex=True))
94-
api.enable_pages(branch='gh-pages')
95-
except HTTPError: print("Could not enable GitHub Pages automatically.")
96-
try: api.repos.update(homepage=f'{cfg.doc_host}/{cfg.doc_baseurl}', description=cfg.description)
91+
try: api.repos.update(homepage=f'{cfg.doc_host}{cfg.doc_baseurl}', description=cfg.description)
9792
except HTTPError:print(f"Could not update the description & URL on the repo: {cfg.user}/{cfg.repo} using $GITHUB_TOKEN.\n"
9893
"Use a token with the correction permissions or perform these steps manually.")
9994

nbs/09_API/12_cli.ipynb

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,7 @@
191191
" if token: \n",
192192
" from ghapi.core import GhApi\n",
193193
" api = GhApi(owner=cfg.user, repo=cfg.repo, token=token)\n",
194-
" try: # repo needs something in it before you can enable pages\n",
195-
" cmds = L(['git add settings.ini', \"git commit -m'add settings'\", 'git config push.default current', 'git push']) \n",
196-
" cmds.map(partial(run, ignore_ex=True))\n",
197-
" api.enable_pages(branch='gh-pages')\n",
198-
" except HTTPError: print(\"Could not enable GitHub Pages automatically.\")\n",
199-
" try: api.repos.update(homepage=f'{cfg.doc_host}/{cfg.doc_baseurl}', description=cfg.description)\n",
194+
" try: api.repos.update(homepage=f'{cfg.doc_host}{cfg.doc_baseurl}', description=cfg.description)\n",
200195
" except HTTPError:print(f\"Could not update the description & URL on the repo: {cfg.user}/{cfg.repo} using $GITHUB_TOKEN.\\n\"\n",
201196
" \"Use a token with the correction permissions or perform these steps manually.\")"
202197
]
@@ -327,23 +322,7 @@
327322
"execution_count": null,
328323
"id": "3d8031ce",
329324
"metadata": {},
330-
"outputs": [
331-
{
332-
"ename": "TypeError",
333-
"evalue": "__init__() got an unexpected keyword argument 'types'",
334-
"output_type": "error",
335-
"traceback": [
336-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
337-
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
338-
"Input \u001b[0;32mIn [13]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#|hide\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m; \u001b[43mnbdev\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mnbdev_export\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
339-
"File \u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/fastcore/script.py:108\u001b[0m, in \u001b[0;36mcall_parse.<locals>._f\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 105\u001b[0m \u001b[38;5;129m@wraps\u001b[39m(func)\n\u001b[1;32m 106\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_f\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 107\u001b[0m mod \u001b[38;5;241m=\u001b[39m inspect\u001b[38;5;241m.\u001b[39mgetmodule(inspect\u001b[38;5;241m.\u001b[39mcurrentframe()\u001b[38;5;241m.\u001b[39mf_back)\n\u001b[0;32m--> 108\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m mod: \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 109\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m SCRIPT_INFO\u001b[38;5;241m.\u001b[39mfunc \u001b[38;5;129;01mand\u001b[39;00m mod\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;241m==\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__main__\u001b[39m\u001b[38;5;124m\"\u001b[39m: SCRIPT_INFO\u001b[38;5;241m.\u001b[39mfunc \u001b[38;5;241m=\u001b[39m func\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\n\u001b[1;32m 110\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(sys\u001b[38;5;241m.\u001b[39margv)\u001b[38;5;241m>\u001b[39m\u001b[38;5;241m1\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m sys\u001b[38;5;241m.\u001b[39margv[\u001b[38;5;241m1\u001b[39m]\u001b[38;5;241m==\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m'\u001b[39m: sys\u001b[38;5;241m.\u001b[39margv\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;241m1\u001b[39m)\n",
340-
"File \u001b[0;32m~/github/nbdev/nbdev/doclinks.py:121\u001b[0m, in \u001b[0;36mnbdev_export\u001b[0;34m(path, **kwargs)\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExport notebooks in `path` to Python modules\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 120\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39menviron\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mIN_TEST\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;241m0\u001b[39m): \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m--> 121\u001b[0m files \u001b[38;5;241m=\u001b[39m \u001b[43mnbglob\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 122\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m f \u001b[38;5;129;01min\u001b[39;00m files: nb_export(f)\n\u001b[1;32m 123\u001b[0m add_init(get_config()\u001b[38;5;241m.\u001b[39mlib_path)\n",
341-
"File \u001b[0;32m~/github/nbdev/nbdev/doclinks.py:93\u001b[0m, in \u001b[0;36mnbglob\u001b[0;34m(path, skip_folder_re, file_glob, skip_file_re, key, as_path, **kwargs)\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[38;5;129m@delegates\u001b[39m(globtastic, but\u001b[38;5;241m=\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfile_glob\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskip_folder_re\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskip_file_re\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[1;32m 91\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mnbglob\u001b[39m(path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, skip_folder_re \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m^[_.]\u001b[39m\u001b[38;5;124m'\u001b[39m, file_glob\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m*.ipynb\u001b[39m\u001b[38;5;124m'\u001b[39m, skip_file_re\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m^[_.]\u001b[39m\u001b[38;5;124m'\u001b[39m, key\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnbs_path\u001b[39m\u001b[38;5;124m'\u001b[39m, as_path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 92\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFind all files in a directory matching an extension given a config key.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 93\u001b[0m path \u001b[38;5;241m=\u001b[39m Path(path \u001b[38;5;129;01mor\u001b[39;00m \u001b[43mget_config\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m[key])\n\u001b[1;32m 94\u001b[0m recursive\u001b[38;5;241m=\u001b[39mget_config()\u001b[38;5;241m.\u001b[39mrecursive\n\u001b[1;32m 95\u001b[0m res \u001b[38;5;241m=\u001b[39m globtastic(path, file_glob\u001b[38;5;241m=\u001b[39mfile_glob, skip_folder_re\u001b[38;5;241m=\u001b[39mskip_folder_re,\n\u001b[1;32m 96\u001b[0m skip_file_re\u001b[38;5;241m=\u001b[39mskip_file_re, recursive\u001b[38;5;241m=\u001b[39mrecursive, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
342-
"File \u001b[0;32m~/github/nbdev/nbdev/config.py:193\u001b[0m, in \u001b[0;36mget_config\u001b[0;34m(cfg_name, path)\u001b[0m\n\u001b[1;32m 191\u001b[0m cfg_file \u001b[38;5;241m=\u001b[39m _nbdev_config_file(cfg_name, path)\n\u001b[1;32m 192\u001b[0m extra_files \u001b[38;5;241m=\u001b[39m _xdg_config_paths(cfg_name)\n\u001b[0;32m--> 193\u001b[0m cfg \u001b[38;5;241m=\u001b[39m \u001b[43mConfig\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcfg_file\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparent\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcfg_file\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_files\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_files\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtypes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_types\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 194\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _apply_defaults(cfg)\n",
343-
"\u001b[0;31mTypeError\u001b[0m: __init__() got an unexpected keyword argument 'types'"
344-
]
345-
}
346-
],
325+
"outputs": [],
347326
"source": [
348327
"#|hide\n",
349328
"import nbdev; nbdev.nbdev_export()"

0 commit comments

Comments
 (0)