Skip to content

Commit

Permalink
clean up schema more
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl committed Dec 11, 2023
1 parent 731b23b commit f9cfc37
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 33 deletions.
27 changes: 26 additions & 1 deletion docs/_static/jupyak-v0.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,28 @@
}
}
},
"LabExtension": {
"title": "LabExtension",
"description": "A description of the inputs and outputs of \"jupyter labextension build\"",
"properties": {
"file_dep": {
"type": "array",
"title": "file_dep",
"description": "paths or globs to files that would trigger a need to rebuild",
"items": {
"type": "string"
}
},
"targets": {
"type": "array",
"title": "targets",
"description": "canary files that will be generated (usually a package.json)",
"items": {
"type": "string"
}
}
}
},
"LiteOptions": {
"title": "LiteOptions",
"description": "options for the final jupyterlite build",
Expand Down Expand Up @@ -1257,7 +1279,10 @@
"lab_extensions": {
"type": "object",
"title": "lab_extensions",
"description": "paths with extra file dependencies needed to build an extension in this repo"
"description": "paths with extra file dependencies needed to build an extension in this repo",
"additionalProperties": {
"$ref": "#/$defs/LabExtension"
}
},
"modules": {
"type": "array",
Expand Down
23 changes: 23 additions & 0 deletions docs/_static/jupyak-v0.schema.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,26 @@ anyOf = [
{ "$ref" = "#/$defs/Task" },
]

["$defs".LabExtension]
title = "LabExtension"
description = "A description of the inputs and outputs of \"jupyter labextension build\""

["$defs".LabExtension.properties.file_dep]
type = "array"
title = "file_dep"
description = "paths or globs to files that would trigger a need to rebuild"

["$defs".LabExtension.properties.file_dep.items]
type = "string"

["$defs".LabExtension.properties.targets]
type = "array"
title = "targets"
description = "canary files that will be generated (usually a package.json)"

["$defs".LabExtension.properties.targets.items]
type = "string"

["$defs".LiteOptions]
title = "LiteOptions"
description = "options for the final jupyterlite build"
Expand Down Expand Up @@ -1226,6 +1246,9 @@ type = "object"
title = "lab_extensions"
description = "paths with extra file dependencies needed to build an extension in this repo"

["$defs".PythonOptions.properties.lab_extensions.additionalProperties]
"$ref" = "#/$defs/LabExtension"

["$defs".PythonOptions.properties.modules]
type = "array"
title = "modules"
Expand Down
18 changes: 18 additions & 0 deletions docs/_static/jupyak-v0.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,22 @@ $defs:
anyOf:
- type: string
- $ref: '#/$defs/Task'
LabExtension:
title: LabExtension
description: A description of the inputs and outputs of "jupyter labextension build"
properties:
file_dep:
type: array
title: file_dep
description: paths or globs to files that would trigger a need to rebuild
items:
type: string
targets:
type: array
title: targets
description: canary files that will be generated (usually a package.json)
items:
type: string
LiteOptions:
title: LiteOptions
description: options for the final jupyterlite build
Expand Down Expand Up @@ -944,6 +960,8 @@ $defs:
title: lab_extensions
description:
paths with extra file dependencies needed to build an extension in this repo
additionalProperties:
$ref: '#/$defs/LabExtension'
modules:
type: array
title: modules
Expand Down
33 changes: 6 additions & 27 deletions docs/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ classDef git fill:#f1502f,color:#fff;
classDef hack fill:#000,color:#fff;
shave:js:jupyterlab:yarn:build:prod:dev_mode --> jupyterlab:sweep:assets
shave:js:jupyterlab:yarn:builder:. --> jupyterlab:sweep:labextension
shave:git:lite:gist:fetch:main --> shave:git:lite:gist:checkout
shave:git:traitlets:fetch:main --> shave:git:traitlets:checkout
shave:git:comm:fetch:main --> shave:git:comm:checkout
shave:git:lumino:fetch:main --> shave:git:lumino:checkout
shave:git:lumino:fetch:pr-655 --> shave:git:lumino:checkout
shave:git:jupyter_server_terminals:fetch:main --> shave:git:jupyter_server_terminals:checkout
shave:git:jupyter_core:fetch:main --> shave:git:jupyter_core:checkout
shave:git:jupyter_events:fetch:main --> shave:git:jupyter_events:checkout
Expand All @@ -71,13 +69,6 @@ shave:git:notebook_shim:fetch:main --> shave:git:notebook_shim:checkout
shave:git:jupyterlab_server:fetch:main --> shave:git:jupyterlab_server:checkout
shave:git:jupyterlab_lsp:fetch:main --> shave:git:jupyterlab_lsp:checkout
shave:git:jupyterlab:fetch:main --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-14575 --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-14597 --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-14766 --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-14854 --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-15222 --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-15347 --> shave:git:jupyterlab:checkout
shave:git:jupyterlab:fetch:pr-15048 --> shave:git:jupyterlab:checkout
shave:git:notebook:fetch:main --> shave:git:notebook:checkout
shave:git:ipywidgets:fetch:main --> shave:git:ipywidgets:checkout
shave:git:jupyterlite:fetch:main --> shave:git:jupyterlite:checkout
Expand Down Expand Up @@ -302,7 +293,6 @@ jupyterlab:sweep:labextension --> shave:py:jupyterlite_pyodide_kernel:labext:pyo
shave:js:jupyterlite_pyodide_kernel:yarn:build:py:wheels:pyodide-kernel --> shave:py:jupyterlite_pyodide_kernel:labext:pyodide-kernel-extension
shave:js:jupyterlite_pyodide_kernel:yarn:build:lib:pyodide-kernel-extension --> shave:py:jupyterlite_pyodide_kernel:labext:pyodide-kernel-extension
shave:py:jupyterlab:pip:jupyterlab --> shave:py:jupyterlite_pyodide_kernel:labext:pyodide-kernel-extension
shave:git:lite:gist:checkout --> shave:lite:config
shave:py:traitlets:wheel:traitlets --> shave:lite:config
shave:py:comm:wheel:comm --> shave:lite:config
shave:py:jupyter_core:wheel:jupyter_core --> shave:lite:config
Expand All @@ -315,7 +305,6 @@ shave:py:ipywidgets:labext:jupyterlab_widgets --> shave:lite:config
shave:py:jupyterlite:labext:jupyterlite-javascript-kernel --> shave:lite:config
shave:py:jupyterlite_pyodide_kernel:labext:pyodide-kernel-extension --> shave:lite:config
jupyterlab:sweep:assets --> shave:lite:build
shave:git:lite:gist:checkout --> shave:lite:build
shave:py:traitlets:wheel:traitlets --> shave:lite:build
shave:py:comm:wheel:comm --> shave:lite:build
shave:py:jupyter_core:wheel:jupyter_core --> shave:lite:build
Expand All @@ -334,14 +323,7 @@ subgraph jupyterlab
jupyterlab:sweep:assets(("`✅ **assets**`")):::hack
jupyterlab:sweep:labextension(("`✅ **labextension**`")):::hack
shave:git:jupyterlab:fetch:main[("`✅ **fetch main**`")]:::git
shave:git:jupyterlab:fetch:pr-14575[("`✅ **fetch pr-14575**`")]:::git
shave:git:jupyterlab:fetch:pr-14597[("`✅ **fetch pr-14597**`")]:::git
shave:git:jupyterlab:fetch:pr-14766[("`✅ **fetch pr-14766**`")]:::git
shave:git:jupyterlab:fetch:pr-14854[("`✅ **fetch pr-14854**`")]:::git
shave:git:jupyterlab:fetch:pr-15222[("`✅ **fetch pr-15222**`")]:::git
shave:git:jupyterlab:fetch:pr-15347[("`✅ **fetch pr-15347**`")]:::git
shave:git:jupyterlab:fetch:pr-15048[("`✅ **fetch pr-15048**`")]:::git
shave:git:jupyterlab:checkout[("`✅ **checkout**`")]:::git
shave:git:jupyterlab:checkout[("`💭 **checkout**`")]:::git
shave:js:jupyterlab:yarn:install{{"`✅ **yarn install**`"}}:::js
shave:js:jupyterlab:yarn:buildutils:.{{"`✅ **yarn buildutils .**`"}}:::js
shave:js:jupyterlab:yarn:builder:.{{"`✅ **yarn builder .**`"}}:::js
Expand All @@ -350,12 +332,6 @@ subgraph jupyterlab
shave:js:jupyterlab:dist{{"`✅ **dist**`"}}:::js
shave:py:jupyterlab:pip:jupyterlab["`✅ **pip jupyterlab**`"]:::py
end
subgraph lite
shave:git:lite:gist:fetch:main[("`✅ **gist fetch main**`")]:::git
shave:git:lite:gist:checkout[("`✅ **gist checkout**`")]:::git
shave:lite:config(["`✅ **config**`"]):::jupyter
shave:lite:build(["`✅ **build**`"]):::jupyter
end
subgraph traitlets
shave:git:traitlets:fetch:main[("`✅ **fetch main**`")]:::git
shave:git:traitlets:checkout[("`✅ **checkout**`")]:::git
Expand All @@ -370,8 +346,7 @@ subgraph comm
end
subgraph lumino
shave:git:lumino:fetch:main[("`✅ **fetch main**`")]:::git
shave:git:lumino:fetch:pr-655[("`✅ **fetch pr-655**`")]:::git
shave:git:lumino:checkout[("`✅ **checkout**`")]:::git
shave:git:lumino:checkout[("`💭 **checkout**`")]:::git
shave:js:lumino:yarn:install{{"`✅ **yarn install**`"}}:::js
shave:js:lumino:yarn:build:.{{"`✅ **yarn build .**`"}}:::js
shave:js:lumino:dist{{"`✅ **dist**`"}}:::js
Expand Down Expand Up @@ -507,5 +482,9 @@ end
subgraph yarnrc
shave:js:yarnrc{{"`✅ **yarnrc**`"}}:::js
end
subgraph lite
shave:lite:config(["`💭 **config**`"]):::jupyter
shave:lite:build(["`💭 **build**`"]):::jupyter
end
</div>
</div>
4 changes: 2 additions & 2 deletions src/jupyak/tasks/_lite.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
" cli_deps += [\n",
" yak.env.py_site_packages / P._pth_path(pth) for pth in repo.lite.needs_pth\n",
" ]\n",
" for ext_js_path, ext_info in repo.py.lab_extensions.items():\n",
" build_deps += [repo.work_path / t for t in ext_info[\"targets\"]]\n",
" for ext_js_path, ext in repo.py.lab_extensions.items():\n",
" build_deps += [repo.work_path / t for t in ext.targets]\n",
" if repo.lite.wheel:\n",
" for ppt in repo.py.pyproject_tomls:\n",
" ppt_path = repo.work_path / ppt\n",
Expand Down
6 changes: 3 additions & 3 deletions src/jupyak/tasks/_py.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
" for ppt in [*py.pyproject_tomls, *py.setup_cfgs]:\n",
" yield from ppt_tasks(work_path / ppt, repo, file_dep)\n",
"\n",
" for ext_dir, info in py.lab_extensions.items():\n",
" for ext_dir, ext in py.lab_extensions.items():\n",
" ext_path = work_path / ext_dir\n",
" in_ext = deepcopy(in_repo)\n",
" in_ext[\"cwd\"] = ext_path\n",
" script = py.labextension_script\n",
" file_dep = A.resolve_globbish(work_path, info[\"file_dep\"])\n",
" file_dep = A.resolve_globbish(work_path, ext.file_dep)\n",
" file_dep += [script, yak.env.py_site_packages / _pth_path(\"jupyterlab\")]\n",
" targets = A.resolve_globbish(work_path, info[\"targets\"])\n",
" targets = A.resolve_globbish(work_path, ext.targets)\n",
" yield dict(\n",
" name=f\"{repo.name}:labext:{ext_path.name}\",\n",
" doc=f\"> build the labextension {ext_path.name} from {repo.name}\",\n",
Expand Down
35 changes: 35 additions & 0 deletions src/jupyak/tasks/_yak.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,30 @@
" )"
]
},
{
"cell_type": "markdown",
"id": "a6e2db9e-1451-42d9-9176-13d62e98d504",
"metadata": {},
"source": [
"A description of the inputs and outputs of \"jupyter labextension build\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e10f1f7f-f220-4ce8-8677-5c8b5af66887",
"metadata": {},
"outputs": [],
"source": [
"class LabExtension(HasSchema):\n",
" file_dep = TypedTuple(\n",
" T.Unicode(), help=\"paths or globs to files that would trigger a need to rebuild\"\n",
" )\n",
" targets = TypedTuple(\n",
" T.Unicode(), help=\"canary files that will be generated (usually a package.json)\"\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "ad780291-d38b-4275-9a52-abf8449abc8d",
Expand Down Expand Up @@ -786,13 +810,24 @@
" help=\"legacy setup.cfg files for installable packages\",\n",
" )\n",
" lab_extensions = T.Dict(\n",
" value_trait=InstanceDict(LabExtension),\n",
" key_trait=T.Unicode(help=\"the parent of a package.json in the repo\"),\n",
" help=\"paths with extra file dependencies needed to build an extension in this repo\",\n",
" )\n",
"\n",
" @T.default(\"pyproject_tomls\")\n",
" def _default_pyproject_tomls(self):\n",
" return [W.PYPROJECT_TOML]\n",
"\n",
" def to_dict(self):\n",
" as_dict = super().to_dict()\n",
" all_ext = as_dict.get(\"lab_extensions\", {})\n",
" if all_ext:\n",
" as_dict[\"lab_extensions\"] = {\n",
" cwd: ext.to_dict() for cwd, ext in all_ext.items()\n",
" }\n",
" return as_dict\n",
"\n",
" @property\n",
" def labextension_script(self):\n",
" return self.parent.parent.work_path / \"scripts/labextension.py\""
Expand Down

0 comments on commit f9cfc37

Please sign in to comment.