From 8b00ae1390644c0289019d3f0c9b492f7e592a40 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Wed, 27 May 2026 21:46:45 +0200 Subject: [PATCH 1/8] chore: add workshops - install-branch: Install packages from git branches or URLs Supports both short names (craft-parts) and full URLs Defaults to canonical org for short names - lock: Run uv lock with custom arguments and update setup Automatically runs make setup after locking dependencies Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .workshop/dev.yaml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .workshop/dev.yaml diff --git a/.workshop/dev.yaml b/.workshop/dev.yaml new file mode 100644 index 0000000000..c0c63e3294 --- /dev/null +++ b/.workshop/dev.yaml @@ -0,0 +1,43 @@ +name: dev +base: ubuntu@24.04 +sdks: + - name: uv + channel: latest/stable + - name: copilot + channel: latest/stable + - name: project-starcraft +actions: + setup: make setup + lint: make lint + format: make format + test: make test + test-fast: make test-fast + test-coverage: make test-coverage + schema: make schema + clean: make clean + lock: | + uv lock "$@" + make setup + install-branch: | + set -euo pipefail + if [[ $# -lt 2 ]]; then + echo "Usage: install-branch " >&2 + echo "" >&2 + echo "Examples:" >&2 + echo " workshop run -- install-branch craft-parts main" >&2 + echo " workshop run -- install-branch https://github.com/user/repo.git main" >&2 + exit 1 + fi + + REPO_OR_URL=$1 + BRANCH=$2 + + # Check if it's a URL (contains :// or ends with .git) + if [[ $REPO_OR_URL =~ "://" ]] || [[ $REPO_OR_URL == *.git ]]; then + REPO_URL=$REPO_OR_URL + else + # Assume it's a package name, use canonical org by default + REPO_URL="https://github.com/canonical/${REPO_OR_URL}" + fi + + uv pip install "git+${REPO_URL}@${BRANCH}" From a7aaa8a04fb262859f604e54f3a13f8c4c7e3a2d Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Wed, 27 May 2026 21:48:40 +0200 Subject: [PATCH 2/8] chore: add project-local sdk --- .workshop/starcraft/sdk.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .workshop/starcraft/sdk.yaml diff --git a/.workshop/starcraft/sdk.yaml b/.workshop/starcraft/sdk.yaml new file mode 100644 index 0000000000..f5248a2fee --- /dev/null +++ b/.workshop/starcraft/sdk.yaml @@ -0,0 +1,13 @@ +# For details: https://canonical-workshop.readthedocs-hosted.com/latest/explanation/sdks/sdks/#sketch-sdk +name: starcraft +plugs: +# Use this configuration to mount a host directory to the workshop +# models: +# interface: mount +# workshop-target: /home/workshop/models +slots: +# Use this configuration to expose a port, then add a corresponding system SDK plug +# More details: https://canonical-workshop.readthedocs-hosted.com/latest/how-to/customize-workshops/forward-ports/ +# my-web-server: +# interface: tunnel +# endpoint: 8080 From c1aa8e071c21d6d4c447126e0492c91602e29540 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Wed, 27 May 2026 21:52:28 +0200 Subject: [PATCH 3/8] chore: ignore workshop.lock --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index b240aa10ae..c3d009c0a4 100644 --- a/.gitignore +++ b/.gitignore @@ -177,3 +177,6 @@ dmypy.json # .NET build artifacts /tests/**/bin/ /tests/**/obj/ + +# Canonical workshop +/.workshop.lock From 0e72e6c7f8f94cef5f31f8050194a2ad0955d961 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Wed, 27 May 2026 22:00:48 +0200 Subject: [PATCH 4/8] fix: include sdk hooks --- .workshop/starcraft/hooks/setup-base | 2 ++ .workshop/starcraft/hooks/setup-project | 1 + 2 files changed, 3 insertions(+) create mode 100644 .workshop/starcraft/hooks/setup-base create mode 100644 .workshop/starcraft/hooks/setup-project diff --git a/.workshop/starcraft/hooks/setup-base b/.workshop/starcraft/hooks/setup-base new file mode 100644 index 0000000000..b68d8df4ad --- /dev/null +++ b/.workshop/starcraft/hooks/setup-base @@ -0,0 +1,2 @@ +apt-get update +apt-get install make diff --git a/.workshop/starcraft/hooks/setup-project b/.workshop/starcraft/hooks/setup-project new file mode 100644 index 0000000000..eb7ce2d5ec --- /dev/null +++ b/.workshop/starcraft/hooks/setup-project @@ -0,0 +1 @@ +make setup From 8bfbf5371f3f8bc974666073e9a1a20295d55723 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Wed, 27 May 2026 22:40:45 +0200 Subject: [PATCH 5/8] docs: add workshop development to the dev docs --- docs/contribute/development.rst | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/docs/contribute/development.rst b/docs/contribute/development.rst index e649d5179d..f302f16441 100644 --- a/docs/contribute/development.rst +++ b/docs/contribute/development.rst @@ -69,6 +69,55 @@ Inside the project directory, set up the development environment: If these commands complete without error, your environment is ready. +Develop with Workshop +--------------------- + +.. admonition:: Work in progress + :class: caution + + Workshop integration for Snapcraft is under active development. Some + features may be incomplete or subject to change. + +`Workshop `__ is Canonical's +container-based development environment. The Snapcraft repository includes a +Workshop configuration that provisions an isolated Ubuntu 24.04 container with +all tools and dependencies pre-installed. It's an alternative to the local +environment described in the previous section. + +When the workshop starts, it automatically runs ``make setup`` inside the +container. From there, use the pre-configured actions to carry out common +development tasks: + +.. code-block:: bash + + workshop run -- setup # re-run the virtual environment setup + workshop run -- lint # run all linters + workshop run -- format # run the autoformatters + workshop run -- test # run the full test suite + workshop run -- test-fast # run the fast test suite + workshop run -- test-coverage # run tests with a coverage report + workshop run -- schema # regenerate the JSON schema + workshop run -- clean # remove temporary build artifacts + +Two additional helpers support dependency work. + +``lock`` runs ``uv lock`` with any arguments you pass, then re-runs +``make setup``: + +.. code-block:: bash + + workshop run -- lock --upgrade-package craft-parts + +``install-branch`` installs a dependency directly from a Git branch. Pass a +short package name (resolves to the canonical GitHub organization by default) +or a full repository URL: + +.. code-block:: bash + + workshop run -- install-branch craft-parts main + workshop run -- install-branch https://github.com/user/craft-parts.git feat/my-fix + + Choose a task ------------- From a53765201d8182c57342d39c8358876e23f5c586 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Wed, 27 May 2026 22:52:11 +0200 Subject: [PATCH 6/8] fix: workshop link --- docs/contribute/development.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contribute/development.rst b/docs/contribute/development.rst index f302f16441..35a96c98cd 100644 --- a/docs/contribute/development.rst +++ b/docs/contribute/development.rst @@ -78,7 +78,7 @@ Develop with Workshop Workshop integration for Snapcraft is under active development. Some features may be incomplete or subject to change. -`Workshop `__ is Canonical's +`Workshop `__ is Canonical's container-based development environment. The Snapcraft repository includes a Workshop configuration that provisions an isolated Ubuntu 24.04 container with all tools and dependencies pre-installed. It's an alternative to the local From 0831179689717589e0262a63b28d4f4e973843f5 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Thu, 28 May 2026 09:09:27 +0200 Subject: [PATCH 7/8] docs: pr suggestions and expanded workshop guidance. --- docs/contribute/development.rst | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/contribute/development.rst b/docs/contribute/development.rst index 35a96c98cd..818d222ee1 100644 --- a/docs/contribute/development.rst +++ b/docs/contribute/development.rst @@ -78,13 +78,14 @@ Develop with Workshop Workshop integration for Snapcraft is under active development. Some features may be incomplete or subject to change. -`Workshop `__ is Canonical's -container-based development environment. The Snapcraft repository includes a -Workshop configuration that provisions an isolated Ubuntu 24.04 container with -all tools and dependencies pre-installed. It's an alternative to the local -environment described in the previous section. - -When the workshop starts, it automatically runs ``make setup`` inside the +Local development environments require periodic maintenance and debugging. You can +instead develop inside a sandbox, where the required development software +is pre-installed and immutable. Snapcraft provides a development image that's +controlled with `Workshop `__. + +With the `Workshop Snap `__ installed, start the +development environment by running ``workshop launch dev`` from within the Snapcraft +directory. When the workshop starts, it automatically runs ``make setup`` inside the container. From there, use the pre-configured actions to carry out common development tasks: @@ -99,16 +100,16 @@ development tasks: workshop run -- schema # regenerate the JSON schema workshop run -- clean # remove temporary build artifacts -Two additional helpers support dependency work. +Two additional actions support dependency work. -``lock`` runs ``uv lock`` with any arguments you pass, then re-runs +The ``lock`` action runs ``uv lock`` with any arguments you pass, then re-runs ``make setup``: .. code-block:: bash workshop run -- lock --upgrade-package craft-parts -``install-branch`` installs a dependency directly from a Git branch. Pass a +The ``install-branch`` action installs a dependency directly from a Git branch. Pass a short package name (resolves to the canonical GitHub organization by default) or a full repository URL: @@ -117,6 +118,9 @@ or a full repository URL: workshop run -- install-branch craft-parts main workshop run -- install-branch https://github.com/user/craft-parts.git feat/my-fix +Workshop provides most of the features needed for developing Snapcraft. Read the +`Workshop tutorial `__ +to learn what else Workshop can do. Choose a task ------------- From c26e6c493950e804cbbb2f050fb8c8c5ffabe483 Mon Sep 17 00:00:00 2001 From: "Alex M. Lowe" Date: Fri, 29 May 2026 22:31:40 +0200 Subject: [PATCH 8/8] fix: oopsie on ruff and ty --- .workshop/starcraft/hooks/setup-project | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.workshop/starcraft/hooks/setup-project b/.workshop/starcraft/hooks/setup-project index eb7ce2d5ec..5732bef59b 100644 --- a/.workshop/starcraft/hooks/setup-project +++ b/.workshop/starcraft/hooks/setup-project @@ -1 +1,3 @@ +uv tool install ruff +uv tool install ty make setup