From 60527e032733e388b669004c577d9284fd30c3ba Mon Sep 17 00:00:00 2001 From: Scott Cranfill Date: Wed, 3 Jun 2026 21:30:46 +0000 Subject: [PATCH 1/3] chore: Turn off package publishing on pushes to main Also removes Python version matrix publishing and points the workflow at the appcontainer. --- .github/workflows/publish-devcontainer.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-devcontainer.yml b/.github/workflows/publish-devcontainer.yml index 148a715..e91ec40 100644 --- a/.github/workflows/publish-devcontainer.yml +++ b/.github/workflows/publish-devcontainer.yml @@ -2,9 +2,6 @@ name: Publish devcontainer on: workflow_dispatch: - push: - branches: - - main defaults: run: @@ -13,9 +10,6 @@ defaults: jobs: publish: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout @@ -35,19 +29,17 @@ jobs: id: buildx uses: docker/setup-buildx-action@v4 - - name: Build, tag, and push image to GHCR [python ${{ matrix.python-version }}] + - name: Build, tag, and push image to GHCR uses: docker/build-push-action@v7 with: builder: ${{ steps.buildx.outputs.name }} build-args: | GIT-SHA=${{ github.sha }} - PYTHON_VERSION=${{ matrix.python-version }} + PYTHON_VERSION=3.14 cache-from: type=gha,scope=compilerla cache-to: type=gha,scope=compilerla,mode=max context: . - file: .devcontainer/Dockerfile + file: appcontainer/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: | - ${{ matrix.python-version == '3.11' && format('ghcr.io/{0}:main', github.repository) || format('ghcr.io/{0}:main_{1}', github.repository, matrix.python-version) }} - ${{ matrix.python-version == '3.11' && format('ghcr.io/{0}:{1}', github.repository, github.sha) || format('ghcr.io/{0}:{1}_{2}', github.repository, github.sha, matrix.python-version) }} + tags: ghcr.io/${{ github.repository }}:${{ github.sha }} From 8f6527aa28f48145b8d0dfe18dc247c2bfcea775 Mon Sep 17 00:00:00 2001 From: Scott Cranfill Date: Wed, 3 Jun 2026 21:37:16 +0000 Subject: [PATCH 2/3] chore: Add .gitignore --- .gitignore | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ad2dac --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# general things to ignore +build/ +dist/ +docs/_sources/ +docs/.doctrees +.eggs/ +*.egg-info/ +*.egg +.env +*.py[cod] +__pycache__/ +*.so +*~ + +# virtualenv +env*/ +venv/ +.venv* + +# codecov / coverage +.coverage +cov_* +coverage.xml + +# due to using tox and pytest +.tox +.cache +.pytest_cache/ +.python-version +pip +.mypy_cache/ + +# misc +tmp.txt +.DS_Store +logs/ +*.db +.pytype/ +.idea/ From 132a73e4e6b797c242c45ac56edd3989bd91717f Mon Sep 17 00:00:00 2001 From: Scott Cranfill Date: Wed, 3 Jun 2026 21:37:32 +0000 Subject: [PATCH 3/3] chore: Update README --- README.md | 90 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 5247326..b4a057f 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,78 @@ -# template-devcontainer +# Slackronyms -A [template repository][template-repo] with a minimal [VS Code devcontainer][devcontainer] setup. +A Slack bot to help teams keep track of acronyms and other abbreviations. -Read the full documentation online: +## Setup -## Why? +### Create Your Slack App -Read more in our blog post: [How to support a platform-agnostic engineering team with VS Code Dev Containers](https://compiler.la/blog/2024/devcontainer-platform-agnostic-team). +1. Open [https://api.slack.com/apps/new](https://api.slack.com/apps/new) and choose **From a manifest**. +1. Choose the workspace you want to install the application to. +1. Replace the contents of the JSON code block with the contents of [`manifest.json`](slackronyms/manifest.json). +1. Review the configuration and click **Create**. +1. Click **Install to Workspace** and **Allow** on the screen that follows. You'll then be redirected to the App Configuration dashboard. -## Features +### Environment Variables -- Base Docker image `python:3.11` includes support for common dev tooling like `git`, `curl`, `pip`, and `pre-commit` -- Includes VS Code extensions like [`GitLens`][gitlens] and [`Prettier`][prettier] and good default settings for the editor -- The [`pre-commit` configuration][pre-commit-config] includes a number of useful [`pre-commit-hooks`][pre-commit-hooks] and - Compiler's [`conventional-pre-commit`][conventional-pre-commit] hook -- A separate `docs` service builds documentation using [`mkdocs-material`][mkdocs-material] +Before you can run the app, you'll need to store some environment variables. -## Usage +1. Create a `.env` file from the sample at the root of the repo: -### Create a new repository + ```sh + cp .env.sample .env + ``` -[Create a new repository from this template][generate]. +1. Open your app's configuration page from [this list](https://api.slack.com/apps), click **OAuth & Permissions** in the left hand menu, then copy the Bot User OAuth Token. Paste it for `SLACK_BOT_TOKEN` in your `.env` file. +1. Click **Basic Information** from the left hand menu and follow the steps in the App-Level Tokens section to create an app-level token with the `connections:write` scope. Copy this token and paste it for `SLACK_APP_TOKEN` in your `.env` file. -### Run the devcontainer +### Developing in a VS Code dev container -With the `Remote - Containers` extension enabled, open the folder containing this repository inside VS Code. +We include a [Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) configuration to help with local testing and development. -You should receive a prompt in the VS Code window; click `Reopen in Container` to run the development environment inside the devcontainer. +**The first time you run this project**, you'll have to manually build the app container in your terminal, because the dev container is built from the app container. -If you do not receive a prompt, or when you feel like starting from a fresh environment: +```sh +docker compose build app +``` -1. `Ctrl/Cmd+Shift+P` to bring up the command palette in VS Code -1. Type `Remote-Containers` to filter the commands -1. Select `Rebuild and Reopen in Container` to completely rebuild the devcontainer -1. Select `Reopen in Container` to reopen the most recent devcontainer build +From there, connect to the dev container to begin working on the project: + +1. Open the repository directory in VS Code +1. Ctrl/Cmd+Shift+P to bring up the Command Palette +1. Start typing `devcontainers` to filter the command list +1. Select **Rebuild and Reopen in Container** to start from scratch +1. Select **Reopen in Container** to reopen the last dev container used + +Once inside the dev container, you have to manually start the app by pressing F5 (or switch the primary sidebar to Run and Debug and click the play button). + +You should see output in a new terminal indicating that the app is now running, and you should now be able to invoke it in your Slack test workspace! Try the `/define` command to confirm. + +After modifying app code, it will need to be restarted for the changes to take effect. Press Ctrl/Cmd+Shift+F5 to restart it (or click the refresh icon that appeared in the top menu bar). + +The app can be stopped with Shift+F5 (or the stop icon in the top menu bar). + +To exit the dev container, use the **Reopen Folder Locally** command. + +## Project Structure + +This project was generated from Slack's [Bolt for Python template app](https://github.com/slack-samples/bolt-python-starter-template), which provided the basis for the code found in the `slackronyms` folder. + +### `manifest.json` + +`manifest.json` is a configuration for Slack apps. With a manifest, you can create an app with a pre-defined configuration, or adjust the configuration of an existing app. + +### `app.py` + +`app.py` is the entry point for the application, which gets run to start the server. This project aims to keep this file as thin as possible, primarily using it as a way to route inbound requests. + +### `/listeners` + +Every incoming request is routed to a "listener". Inside this directory, listeners are grouped based on the Slack Platform feature used, so `/listeners/shortcuts` handles incoming [Shortcuts](https://docs.slack.dev/interactivity/implementing-shortcuts/) requests, `/listeners/views` handles [View submissions](https://api.slack.com/reference/interaction-payloads/views#view_submission) and so on. + +Slackronyms currently only implements a slash command listener for the `/define` command, which is found in [`/listeners/commands/define.py`](slackronyms/listeners/commands/define.py), but the other sample listeners are included in the codebase while we work out what other features we might want to leverage. ## License [Apache 2.0](LICENSE) -[conventional-pre-commit]: https://github.com/compilerla/conventional-pre-commit -[devcontainer]: https://code.visualstudio.com/docs/remote/containers -[generate]: https://github.com/compilerla/template-devcontainer/generate -[gitlens]: https://gitlens.amod.io/ -[mkdocs-material]: https://squidfunk.github.io/mkdocs-material/ -[pre-commit-config]: .pre-commit-config.yaml -[pre-commit-hooks]: https://github.com/pre-commit/pre-commit-hooks -[prettier]: https://prettier.io/ -[template-repo]: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository +Parts derived from the Slack's Bolt for Python template app are licensed under the [MIT License](https://github.com/slack-samples/bolt-python-starter-template/blob/main/LICENSE).