diff --git a/docs/_templates/demo.html b/docs/_templates/demo.html index 20bf2ac..ee463b0 100644 --- a/docs/_templates/demo.html +++ b/docs/_templates/demo.html @@ -1,7 +1,7 @@
diff --git a/docs/_templates/new-form.html b/docs/_templates/new-form.html index 7395c99..b731ea9 100644 --- a/docs/_templates/new-form.html +++ b/docs/_templates/new-form.html @@ -1,23 +1,16 @@ - Request Preview Site + start pull request @@ -45,7 +38,7 @@ } + diff --git a/src/jupyak/tasks/_form.ipynb b/src/jupyak/tasks/_form.ipynb index a430f4b..5188ba9 100644 --- a/src/jupyak/tasks/_form.ipynb +++ b/src/jupyak/tasks/_form.ipynb @@ -21,6 +21,7 @@ "from pathlib import Path\n", "\n", "import importnb\n", + "import IPython\n", "import jinja2" ] }, @@ -43,7 +44,7 @@ "source": [ "with importnb.Notebook():\n", " from jupyak.tasks import load_tasks\n", - " from jupyak.tasks._yak import Repo, Yak" + " from jupyak.tasks._yak import Yak" ] }, { @@ -55,18 +56,7 @@ "source": [ "def load_yak():\n", " load_tasks()\n", - " return Yak({\"pr\": {}})" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "adbc58fe-c2a6-4ef7-859a-a88546a60d15", - "metadata": {}, - "outputs": [], - "source": [ - "def make_repo(repo: Repo):\n", - " return []" + " return Yak({\"repos\": {}})" ] }, { @@ -77,7 +67,15 @@ "outputs": [], "source": [ "REPOS_TMPL = r\"\"\"\n", - "repos\n", + "\n", + "customize GitHub checkout\n", + "\n", + "\n", + "All of the repositories below will be checked out at the current main branch as a baseline.\n", + "Check one or more repos to provide use a differnt branch, PR, or tag, or provide one or more PRs to\n", + "merge with it, and/or customize the merge strategy and options to work around merge conflicts.\n", + "\n", + "\n", "{% for name in yak.repos %}\n", " \n", " {{name}}\n", @@ -213,6 +211,48 @@ " return [jinja2.Template(REPO_STYLE_TEMPL).render(yak=yak)]" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "80c59837-bc25-4571-9c28-bcb61dac930e", + "metadata": {}, + "outputs": [], + "source": [ + "LITE_TMPL = r\"\"\"\n", + "\n", + "customize JupyterLite\n", + "\n", + "\n", + "If given, an optional gist will be cloned\n", + "to provide the content of the JupyterLite site.\n", + "If the gist contains jupyter_lite_config.json and/or jupyter-lite.json,\n", + "this will be merged into the generated\n", + "configuration\n", + "of jupyter lite build and the runtime application.\n", + "\n", + "\n", + "\n", + "the gist ID must be empty, or contain 20+ letters and numbers\n", + "\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4b128fc0-36ad-463d-a1ff-8bfe0e3a4ffe", + "metadata": {}, + "outputs": [], + "source": [ + "def make_lite_form(yak: Yak):\n", + " return [jinja2.Template(LITE_TMPL).render(yak=yak)]" + ] + }, { "cell_type": "code", "execution_count": null, @@ -225,7 +265,8 @@ " chunks = []\n", " style_chunks = []\n", " script_chunks = []\n", - " for trait_name, value in yak.trait_values().items():\n", + " for trait_name in [\"repos\", \"lite\"]:\n", + " value = yak.trait_values()[trait_name]\n", " maker = globals().get(f\"make_{trait_name}_form\")\n", " if maker:\n", " chunks += maker(yak)\n", @@ -253,16 +294,31 @@ "source": [ "def write_form(dest: Path, **options):\n", " dest.parent.mkdir(parents=True, exist_ok=True)\n", + " final_tmpl = dest.parent / \"_templates/new-form.html\"\n", " chunks = [\n", " \"# request a preview site\",\n", " \"\",\n", - " \"> make selections below, then use the sidebar to start a new Pull Request\",\n", + " \"> Make selections below for the most common configuration options, then use the \",\n", + " \"> _start pull request_ form to be redirected to GitHub.\",\n", + " \"> A large number of other configuration options are _possible_, but are not yet fully described.\",\n", " \"\",\n", " *make_form(),\n", + " final_tmpl.read_text(encoding=\"utf-8\"),\n", " ]\n", " txt = re.sub(r\"^ +\", \"\", \"\\n\".join(chunks), flags=re.M)\n", " dest.write_text(txt, encoding=\"utf-8\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7ac0c6c3-a69b-4e5e-bf55-1dcc2449f283", + "metadata": {}, + "outputs": [], + "source": [ + "if __name__ == \"__main__\":\n", + " IPython.display.display(IPython.display.HTML(\"\\n\".join(make_form())))" + ] } ], "metadata": {
\n", + "All of the repositories below will be checked out at the current main branch as a baseline.\n", + "Check one or more repos to provide use a differnt branch, PR, or tag, or provide one or more PRs to\n", + "merge with it, and/or customize the merge strategy and options to work around merge conflicts.\n", + "
main
\n", + "If given, an optional gist will be cloned\n", + "to provide the content of the JupyterLite site.\n", + "If the gist contains jupyter_lite_config.json and/or jupyter-lite.json,\n", + "this will be merged into the generated\n", + "configuration\n", + "of jupyter lite build and the runtime application.\n", + "
jupyter_lite_config.json
jupyter-lite.json
jupyter lite build