Publishing workshops¶
A finished workshop reaches learners in one of three shapes: an archive
listed in a collection that the workshop browser installs from, a git
repository that holds one or more workshops and its own collection
index, or a JupyterLite site that runs in the browser with nothing
installed. This page covers building each, the course repository that
jupyter workshop course init writes with everything a repository of
workshops needs, putting a repository or a single workshop on GitHub,
and building a catalog that points learners at several collections.
Each publishing step is also a button in a workshop
library, on the workshop’s card or the course’s group, and
something Workshop Author does when
asked; none of it happens without your say so. Finding and installing
workshops describes what learners see.
An archive and a collection entry¶
jupyter workshop publish my-workshop builds an archive of the workshop
under dist/, leaving out _workshop, .git, scratch and the like,
writes its SHA-256 beside it, and writes a collection entry: a JSON
snippet with the name, version, description and hash, and, with
--url, the address the archive will be published at. The archive is
built with fixed ownership and timestamps, so the hash is the same on
every machine and can be checked by whoever installs it.
jupyter workshop collection collection.json ENTRY... merges such
entries into a collection index, creating it if needed. Publishing a new
version of a workshop that is already listed updates its entry in place
and keeps the earlier versions, newest first; a new workshop is appended,
so the order of the file is yours to arrange:
jupyter workshop publish git-basics --url https://example.org/w/git-basics-1.2.0.tar.gz
jupyter workshop collection collection.json dist/git-basics-1.2.0.collection.json --title "Our workshops" --icon icon.svg
Host collection.json, its icon and the archives anywhere that serves
files over HTTPS, such as GitHub Pages or an object store, and give
learners the index URL to subscribe to, through the Collections dialog, the
collections setting or a launch link. The
index format is a JSON document, and
jupyter workshop schema --collection prints its schema. The
command line page lists every option of publish
and collection.
Several workshops in one repository¶
A repository can hold a set of related workshops side by side, each in its own directory, with one index at the root that lists them all:
workshops-repo/
collection.json
icon.svg
workshops/
git-basics/
workshop.yaml
pages/
pandas-intro/
workshop.yaml
pages/
jupyter workshop index writes and updates collection.json from the
manifests, giving each entry a git source pointing at its directory in
the repository, so no archives are built or published:
jupyter workshop index workshops --repo https://github.com/example-org/workshops --ref main
Every workshop found under the directories given becomes an entry whose
source is its path in the repository, fetched from --repo at --ref.
Run from the checkout, both are read from git and can be left out; give
--ref a tag when a course is pinned to a release, and --ordered when
the workshops are meant to be taken in the order listed. An existing index
is updated rather than replaced, so older versions stay listed and the
order of the workshops, which is the order the browser shows, is kept.
A directory that is searched lists its workshops in path order, which for a course is rarely the order to take them in. Set the order by naming the workshop directories themselves, in sequence:
jupyter workshop index workshops/what-it-does workshops/a-first-one workshops/how-it-remembers --ordered
Named one by one like that, and accounting for everything already
listed, the workshops are written in the order given, on an update as
well as the first time, so that is also how a new workshop is put into
the middle of a course or a course rearranged. After that
jupyter workshop index workshops refreshes the entries and leaves the
order alone, adding anything new at the end. The
command line page has the full set of options and what
is skipped when searching.
Commit the index with the workshops. Anyone can then subscribe to the
raw URL of collection.json, or start a session with it through a collection
launch link, and Install fetches each
workshop from the forge. The same checkout can serve as a Binder image
that lists the workshops as installed; see the Binder
recipe. The
showcase repository follows the pattern, down to a
workflow that lints and self-tests every workshop on each push. A
workflow like that is also where a workshop that changes the machine it
runs on, by installing packages or editing global configuration, should
be self-tested, since each run gets a fresh runner; see the warning
under test.
A course repository¶
A course is that repository with everything else it needs already in
place: the indexes, one per part of the course with a catalog over
them, and around them what a repository needs to be written in with an
agent, checked and hosted. jupyter workshop course init writes one:
jupyter workshop course init wrapt-workshops --title "wrapt workshops" \
--description "Guided workshops for wrapt." \
--collection decorators="Decorators with wrapt" \
--collection proxies="Object proxies with wrapt" \
--repo https://github.com/example/wrapt-workshops
wrapt-workshops/
AGENTS.md, CLAUDE.md guidance for agents writing workshops here
OUTLINE.md the design: every section in place, nothing designed yet
README.md for learners: launch links, the collections, running locally
Justfile every common task, and the order of each collection
pyproject.toml the uv project: JupyterLab and the pinned extension
.mcp.json the workshop MCP server, from the repository's environment
jupyter_lab_config.py the local start, in the workshop browser with the catalog
catalog.json names every collection
collections/<name>/collection.json one empty, ordered index per part
workshops/ every workshop, flat, whatever collection it is in
binder/, .devcontainer/ the Binder image and the Codespaces container
.github/workflows/ lint and self-test every workshop on each push
course.json what was written, for `course update`
The design comes first: OUTLINE.md has a part for each collection,
with its shape, one entry per workshop and the topics it leaves out,
and the cross-cutting decisions and status table, and is written before
the first workshop is. Then just install, just new <name> for each
workshop, just lint and just test <name>, and just index to write
the indexes in the order the Justfile gives. Collection ids are
<prefix>/<course>/<collection>, the prefix the repository’s forge and
owner by default, and are an identity to settle before the first
workshop is written, since subscribers and analytics know a collection
by it. The hosted launches switch off the library and authoring parts
of the extension along with the usual features, so visitors are kept to
the course’s workshops. With --lite the course is written for
JupyterLite as well: the site files, a Pages workflow that publishes
the site once the tests pass, and lint and tests on both frontends.
A course made this way is a repository from the start, with nothing
committed. In a workshop library it lives under
personal/courses/, or is linked in with --link, and the browser
shows its workshops under My courses in the order its indexes give.
jupyter workshop course update later moves the course to a new
release of the extension, rewriting the generated files that have not
been edited and reporting the ones that have; just bump <version>
runs it. See course for every option.
A repository on GitHub¶
A workshop or a course made with the tooling is a git repository from
the start, with nothing committed, and the way to publish one is to put
that repository on GitHub. jupyter workshop github does it through the
gh command, signed in to your account with
the repo scope, and so does Workshop
Author when asked, after asking you to
confirm, as do Publish… on a workshop’s card and Publish to GitHub… on a
course’s group in a library, which ask whether the
repository is to be private or public first:
jupyter workshop github ~/Workshops/personal/courses/wrapt-workshops
jupyter workshop github ~/Workshops/personal/workshops/git-basics --public
With no origin remote it creates the repository, private unless you
ask for a public one, with the directory as its source, adds the remote
and pushes; with one it pushes the current branch, and makes a private
repository public when asked. Everything must be committed first: the
command refuses an uncommitted tree, so what is published is what was
committed. Private is the default because nothing should become public
without a second choice; a private repository can still be shared with
collaborators, and --public later opens it up. A course scaffolded
before it had a repository carries a placeholder address in its
Justfile, README.md and launch configuration, and creating the
repository rewrites those files with the real one, where they are still
as generated; commit them and publish again. The Binder and Codespaces
links in a course’s README then work, and a course written for
JupyterLite publishes its site from its Pages workflow once GitHub Pages
is set to build from GitHub Actions in the repository’s settings (which
on a private repository needs a paid plan). See github
for the options.
A workshop in a gist¶
A small workshop, instructions and inline actions with a few files alongside, fits in a GitHub gist. A gist is a git repository whose name is its id, and the extension fetches it the way it fetches any repository: the server downloads its archive, and JupyterLite reads its raw files. The one difference is that a gist holds no directories, so every file sits beside the manifest.
jupyter workshop gist makes the flat copy. Each file is stored under
its path with the directory separators turned into --, which keeps
the origin of a file visible and groups a directory’s files together in
the gist’s alphabetical listing, and a workshop-tree.json beside them
maps every path back to the gist file that holds it:
workshop.yaml
workshop-tree.json
pages--01-welcome.md
pages--02-finish.md
files--data.csv
{
"version": 1,
"files": [
{ "path": "workshop.yaml", "name": "workshop.yaml" },
{ "path": "pages/01-welcome.md", "name": "pages--01-welcome.md" },
{ "path": "pages/02-finish.md", "name": "pages--02-finish.md" },
{ "path": "files/data.csv", "name": "files--data.csv" }
]
}
Nothing in the workshop is rewritten. When the extension downloads a
gist that holds a tree file, it puts every file back at its path before
the workshop opens, so the manifest, the pages and any links between
them work as written, and starter files under files/ seed the
workspace as they do from a repository. The tree is authoritative: a
gist file it does not list, such as the generated README.md, is left
out. Every path must stay inside the workshop directory and outside its
_workshop state directory, and a tree that breaks that, or that lists
one path twice, is refused before anything is written. The format is
described by
tree.schema.json.
The command carries the files jupyter workshop publish would archive,
less hidden files, editor droppings and the workshop’s own README.md.
The gists API carries text only, so a file that is not text, such as an
image, is stored as base64 under a name ending .base64 and marked so
in the tree, and an empty file, which a gist cannot hold, is recorded in
the tree alone. The command lints the source, writes the copy under
dist/gist/, then puts the copy back together the way a download would
and lints that. It also writes a README.md, which GitHub shows first
on the gist page, with the workshop’s details from the manifest and how
to open it: it says the gist is a workshop to take rather than pages to
read, and gives a button and a plain link that launch it in JupyterLite
when the manifest lists that frontend, and a button and link that launch
it in JupyterLab on mybinder.org through the project’s Binder
launcher. With --create it makes the gist, secret
unless --public, and prints its address; with --update it replaces
the files of an existing one, as a new revision in the gist’s history;
see gist for the token it needs. The gist is recorded in
the workshop’s _workshop/gist.json, so a later --update with no gist
named goes to the same one, and so does Workshop
Author when asked to publish again, and
Publish… on the workshop’s card in a library, which asks
whether the gist is to be secret or public first.
A file’s content can be edited on the gist page, but a file added or
renamed there is not in the tree and is left out, so make such changes
in the workshop and run the command again with --update. A gist
written by hand needs no tree file: without one, its files are taken as
they are, with the pages beside the manifest and the manifest naming
them as they appear in the gist.
The gist’s page URL is the source, for the “Open Workshop from URL…”
command, a git entry in a collection, or a launch link:
https://gist.github.com/owner/fee514f3051b532e3f790c2ae7068ed7
The permalink of a revision, the same URL with the full commit hash
after the id, pins the workshop to that revision; ref does the same.
A secret gist works as well as a public one, since the archive and the
raw files are served to anyone with the link. A gist written for
JupyterLite can be handed out as a link to one of the project’s
launcher sites with the gist as the
workshop parameter, without a site of its own; that is the link the
generated README’s button carries.
A catalog of collections¶
An organisation with several collections publishes one catalog that points at them all, so learners subscribe to one URL and pick:
courses-repo/
catalog.json
logo.svg
python-basics/
collection.json
icon.svg
first-steps/
workshop.yaml
kubernetes/
collection.json
icon.svg
pods/
workshop.yaml
jupyter workshop catalog builds the catalog from the collections
themselves, restating each one’s title, description, publisher and icon
so the browser can show them without reading every index, and refreshes
the entries whenever a collection changes:
jupyter workshop index python-basics --out python-basics/collection.json --title "Python basics" --icon icon.svg
jupyter workshop index kubernetes --out kubernetes/collection.json --title "Kubernetes" --icon icon.svg
jupyter workshop catalog catalog.json python-basics/collection.json kubernetes/collection.json --relative --title "Example Academy" --icon logo.svg
jupyter workshop catalog catalog.json
--relative records each collection by its path relative to the
catalog, so the whole tree can be served from GitHub Pages or as raw
files and moved as one; a collection hosted elsewhere is named by its
URL instead. The last line, with no collections named, re-reads every
entry, which is what a CI job runs after a change, together with
jupyter workshop lint catalog.json to check that every collection can
be read. The catalog format is a JSON
document, and jupyter workshop schema --catalog prints its schema.
A JupyterLite site¶
The build needs the lite extra, uv add "jupyterlab-workshop[lite]"
or pip install "jupyterlab-workshop[lite]".
jupyter workshop lite my-workshop [other-workshop ...] [--out lite-site]
[--default NAME] [--trust LEVEL]
[--collection URL|FILE] [--catalog URL|FILE]
[--settings FILE] [--welcome FILE]
[--no-terminal] [--lite-dir DIR]
[--serve] [--port PORT]
The command copies the workshops into the site’s contents (leaving
_workshop/ progress behind), writes the extension settings that open a
workshop on start (--default, or the only workshop given) and, with
--trust, apply a trust level without asking, then runs jupyter lite build. The site includes whatever JupyterLab extensions are installed in
the environment, this one among them. --serve serves the result on a
local port, under a sub-path as GitHub Pages would, to try it out.
A site with several workshops and no --default has no workshop to
open, so it starts in the workshop browser in place of the launcher,
the build having set browseOnStart. The site’s own
address is then all a link needs. A visitor who left a workshop open is
returned to it, as in any JupyterLab; add JupyterLab’s own reset
parameter to a link, as in .../lab/index.html?reset, for one that
always lands in the browser.
--collection subscribes the site to a collection, so the browser
lists the workshops under the collection’s title, numbered in its order
when it is ordered, and the Finish dialog of each offers the next. Give
it the local collection.json, or the directory holding one, and the
file is carried in the site’s contents, with an icon it names by a
relative path, and subscribed to by that path. The workshops in the
site are matched to the entries of the index by name. A URL is
subscribed to as it is, which suits an index published elsewhere, whose
host must then send CORS headers.
--catalog works the same way for a catalog, from which the browser
offers collections to subscribe to: a URL is subscribed to as it is, and
a local catalog.json, or the directory holding one, is carried in the
site. A catalog may name its collections and icons by paths relative to
itself, as in the one-repository layout of
catalogs, so each of those is carried at the
same place beside the catalog, a collection’s own icon included, while
collections it names by URL stay where they are. A relative path has to
stay within the catalog’s directory, and may not fall inside a workshop
of the same name. A collection named by both --catalog and
--collection is carried once, where the catalog puts it, so that the
browser shows the catalog’s entry as the subscribed one.
--settings FILE takes a file in the form of overrides.json, the
settings of each plugin under the plugin’s id, and builds it into the
site. This is how a site is given an
analytics block, disabled features,
or the settings of any other JupyterLab plugin. The file is the base
and the build’s own settings are laid over it: workshopsDirectory is
always the root of the contents, --default and --trust win over the
file, and --collection and --catalog add to the lists in it. A file
can set browseOnStart to false to keep a site at the launcher. The
extension’s settings in the file are checked against the settings
schema, since a static site has nobody to report a misspelt setting to.
--welcome FILE carries a Markdown file in the site and sets it as the
welcome message, shown once per browser. A site built
with --trust trusted shows no trust dialog, so when it also reports
progress the welcome message is the place to say so.
A collection index, a catalog and a welcome message each sit at the root of the site’s contents beside the workshops, under their own file names, so the names have to differ.
The terminal needs node, npm and micromamba on the path when
building, because the terminal extension fetches its WebAssembly
commands from emscripten-forge. The site declares terminals available,
so File, New, Terminal and the launcher card work as well as the
workshop’s own actions. --no-terminal leaves it out. --lite-dir
names the directory JupyterLite keeps its build state and those
downloads in; the default is under the Jupyter data directory so that
later builds are quick. One build uses the directory at a time: a build
started while another is running, a JupyterLite self-test included,
waits for it to finish.
Pyodide itself is loaded from a CDN when the site opens, so learners
need network access on first use. The built site is relative-path only
and works from any sub-path. What a workshop can and cannot do there is
described under JupyterLite, and jupyter workshop test --lite self-tests it in that form.
GitHub Pages¶
The repository’s own workflow (.github/workflows/pages.yml) runs
just pages, which assembles the project site: a landing page, the JSON
schemas, and the example workshop built as a JupyterLite site under
demo/. The result is deployed with actions/deploy-pages to
https://grahamdumpleton.github.io/jupyterlab-workshop/. A workshop
repository can do the same with just the JupyterLite build:
- run: pip install "jupyterlab-workshop[lite]"
- run: |
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest \
| tar -xj -C /usr/local bin/micromamba
- run: jupyter workshop lite . --out site
- uses: actions/upload-pages-artifact@v3
with:
path: site
A link to the deployed site with ?workshop=<name> opens that workshop;
add restart=force to start it afresh on every visit, as the project’s
demo link does. See launch links.
A launcher for launch links¶
A site built with no workshop is a launcher: a JupyterLite that opens whatever its launch link names, such as a gist or a repository. The project publishes one for each Python version its builds can carry, under a path that names the version:
https://grahamdumpleton.github.io/jupyterlab-workshop/lite/3.14/lab/index.html
The Python in a JupyterLite site is fixed when the site is built, by
the Pyodide release the kernel package pins, so a site that tracked the
latest release would change the Python under every link pointing at it.
Naming the version in the path means a link, and the launch button
jupyter workshop gist writes into a gist’s README, keeps the Python it
was written for when a launcher for a newer one is published alongside.
The extension in every launcher is the current release, since the
workshop format is what it keeps compatible.
just pages builds the launcher with --python set to the version the
installed kernel carries and names the directory after it, so the path
can never claim one Python while serving another. A second version
means building a second launcher with the kernel package that carries
it. The launcher carries a welcome message explaining what it is, for
anyone who opens it without a link; its settings file turns
welcomeOnLaunch off, so a link that names a workshop
goes straight to that workshop’s trust dialog. A workshop that needs a
particular Python says so in requires.tools, which both the server
preflight and the gist command honour:
requires:
tools:
- { name: python, version: '>=3.14' }