slackwright 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. slackwright-0.1.0/.editorconfig +21 -0
  2. slackwright-0.1.0/.github/workflows/deploy.yaml +31 -0
  3. slackwright-0.1.0/.github/workflows/testing.yaml +71 -0
  4. slackwright-0.1.0/.gitignore +19 -0
  5. slackwright-0.1.0/.pre-commit-config.yaml +34 -0
  6. slackwright-0.1.0/LICENSE +25 -0
  7. slackwright-0.1.0/PKG-INFO +105 -0
  8. slackwright-0.1.0/README.md +69 -0
  9. slackwright-0.1.0/compose.yaml +26 -0
  10. slackwright-0.1.0/docs/design.md +535 -0
  11. slackwright-0.1.0/pyproject.toml +133 -0
  12. slackwright-0.1.0/slackwright/__init__.py +10 -0
  13. slackwright-0.1.0/slackwright/blocks.py +224 -0
  14. slackwright-0.1.0/slackwright/canvas.py +151 -0
  15. slackwright-0.1.0/slackwright/forms.py +999 -0
  16. slackwright-0.1.0/slackwright/inflight.py +93 -0
  17. slackwright-0.1.0/slackwright/ingest.py +394 -0
  18. slackwright-0.1.0/slackwright/progress.py +90 -0
  19. slackwright-0.1.0/slackwright/py.typed +0 -0
  20. slackwright-0.1.0/slackwright/render.py +384 -0
  21. slackwright-0.1.0/slackwright/stores.py +150 -0
  22. slackwright-0.1.0/slackwright/toolkit.py +575 -0
  23. slackwright-0.1.0/tests/__init__.py +0 -0
  24. slackwright-0.1.0/tests/fake_slack.py +79 -0
  25. slackwright-0.1.0/tests/services.py +85 -0
  26. slackwright-0.1.0/tests/test_blocks.py +127 -0
  27. slackwright-0.1.0/tests/test_canvas.py +142 -0
  28. slackwright-0.1.0/tests/test_forms.py +690 -0
  29. slackwright-0.1.0/tests/test_inflight.py +48 -0
  30. slackwright-0.1.0/tests/test_ingest.py +274 -0
  31. slackwright-0.1.0/tests/test_progress.py +70 -0
  32. slackwright-0.1.0/tests/test_render.py +377 -0
  33. slackwright-0.1.0/tests/test_stores.py +110 -0
  34. slackwright-0.1.0/tests/test_toolkit.py +528 -0
  35. slackwright-0.1.0/tests/test_version.py +11 -0
  36. slackwright-0.1.0/uv.lock +1632 -0
@@ -0,0 +1,21 @@
1
+ # top-most EditorConfig file
2
+ root = true
3
+
4
+ # Unix-style newlines with a newline ending every file
5
+ [*]
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+
9
+ # 4 space indentation
10
+ [*.py]
11
+ indent_style = space
12
+ indent_size = 4
13
+
14
+ # 2 space indentation
15
+ [*.yml]
16
+ indent_style = space
17
+ indent_size = 2
18
+
19
+ [bootstrap]
20
+ indent_style = space
21
+ indent_size = 2
@@ -0,0 +1,31 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+
11
+ environment:
12
+ name: pypi
13
+ url: https://pypi.org/project/slackwright/
14
+
15
+ permissions:
16
+ contents: read
17
+ id-token: write
18
+
19
+ steps:
20
+ - uses: actions/checkout@v5
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v6
24
+
25
+ - name: Build and check package
26
+ run: |
27
+ uv build
28
+ uvx twine check dist/*
29
+
30
+ - name: Publish package distributions to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,71 @@
1
+ name: Testing
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches: [main]
6
+ paths-ignore:
7
+ - 'docs/**'
8
+ - '*.md'
9
+ - '*.rst'
10
+ tags-ignore: ["*"]
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ python: ["3.12", "3.13", "3.14"]
19
+ services:
20
+ valkey:
21
+ image: valkey/valkey:8
22
+ ports: ["6379:6379"]
23
+ options: >-
24
+ --health-cmd "valkey-cli ping"
25
+ --health-interval 2s --health-timeout 2s --health-retries 15
26
+ postgres:
27
+ image: postgres:17
28
+ env:
29
+ POSTGRES_PASSWORD: postgres
30
+ ports: ["5432:5432"]
31
+ options: >-
32
+ --health-cmd pg_isready
33
+ --health-interval 2s --health-timeout 2s --health-retries 15
34
+ env:
35
+ VALKEY_URL: valkey://localhost:6379/0
36
+ POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/postgres
37
+ steps:
38
+ - name: Checkout repository
39
+ uses: actions/checkout@v5
40
+
41
+ - name: Install uv
42
+ uses: astral-sh/setup-uv@v6
43
+ with:
44
+ python-version: ${{ matrix.python }}
45
+
46
+ - name: Install dependencies
47
+ run: uv sync --all-groups
48
+
49
+ - name: Create build directory
50
+ run: mkdir -p build
51
+
52
+ - name: Lint Check
53
+ run: uv run pre-commit run --all-files
54
+
55
+ - name: Type Check (mypy)
56
+ run: uv run mypy slackwright
57
+
58
+ - name: Type Check (basedpyright)
59
+ run: uv run basedpyright slackwright
60
+
61
+ - name: Run tests
62
+ run: |
63
+ uv run coverage run
64
+ uv run coverage report
65
+ uv run coverage xml
66
+
67
+ - name: Upload Coverage
68
+ uses: codecov/codecov-action@v5
69
+ with:
70
+ files: ./build/coverage.xml
71
+ flags: unittests
@@ -0,0 +1,19 @@
1
+ .idea
2
+ .mypy_cache
3
+ .vscode
4
+ codegen/amqp-rabbitmq-0.9.1.json
5
+ codegen/amqp0-9-1.xml
6
+ *.pyc
7
+ build
8
+ dist
9
+ docs/_build
10
+ atlassian-ide-plugin.xml
11
+ .DS_Store
12
+ pamqp.egg-info
13
+ env
14
+ env2.7
15
+ env3
16
+ .coverage
17
+ coverage.xml
18
+ xunit.xml
19
+ coverage
@@ -0,0 +1,34 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: check-ast
6
+ - id: check-toml
7
+ - id: check-yaml
8
+ args: [--allow-multiple-documents]
9
+ - id: debug-statements
10
+ - id: end-of-file-fixer
11
+ - id: mixed-line-ending
12
+ - id: trailing-whitespace
13
+
14
+ - repo: https://github.com/astral-sh/ruff-pre-commit
15
+ rev: v0.14.5
16
+ hooks:
17
+ - id: ruff-format
18
+ - id: ruff
19
+ args: [--fix]
20
+
21
+ - repo: local
22
+ hooks:
23
+ - id: mypy
24
+ name: mypy
25
+ entry: uv run mypy slackwright
26
+ language: system
27
+ types: [python]
28
+ pass_filenames: false
29
+ - id: basedpyright
30
+ name: basedpyright
31
+ entry: uv run basedpyright slackwright
32
+ language: system
33
+ types: [python]
34
+ pass_filenames: false
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2026 Gavin M. Roy
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of the copyright holder nor the names of its contributors may
13
+ be used to endorse or promote products derived from this software without
14
+ specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.5
2
+ Name: slackwright
3
+ Version: 0.1.0
4
+ Summary: Building blocks for AI agents that live in Slack
5
+ Project-URL: Homepage, https://github.com/gmr/slackwright
6
+ Project-URL: Bug Tracker, https://github.com/gmr/slackwright/issues
7
+ Author-email: "Gavin M. Roy" <gavinmroy@gmail.com>
8
+ License-Expression: BSD-3-Clause
9
+ License-File: LICENSE
10
+ Keywords: agent,block-kit,bot,canvas,markdown,slack
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: Implementation :: CPython
22
+ Classifier: Topic :: Communications :: Chat
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.12
26
+ Requires-Dist: aiohttp>=3.9
27
+ Requires-Dist: httpx>=0.27
28
+ Requires-Dist: markdown-it-py>=3.0
29
+ Requires-Dist: pydantic>=2.10
30
+ Requires-Dist: slack-sdk>=3.47
31
+ Provides-Extra: postgres
32
+ Requires-Dist: psycopg[pool]>=3.2; extra == 'postgres'
33
+ Provides-Extra: valkey
34
+ Requires-Dist: valkey>=6; extra == 'valkey'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # slackwright
38
+
39
+ Building blocks for AI agents that live in Slack.
40
+
41
+ slackwright is a library, not a framework. Your bot keeps its own event
42
+ loop and agent; slackwright gives it the Slack parts:
43
+
44
+ - **Render**: post LLM Markdown answers with Slack's native Markdown
45
+ support, split long answers, and stream replies with task cards.
46
+ - **Tools**: expose the parts below to an LLM agent as tools, with
47
+ Anthropic tool definitions and validated inputs.
48
+ - **Forms**: forms that an agent designs, in a modal or inline in a
49
+ message, with validated submissions.
50
+ - **Canvases**: create, edit, and read canvas documents.
51
+ - **Ingest**: turn a Slack thread, its mentions, and its files into LLM
52
+ messages.
53
+ - **Lifecycle**: progress updates and an in-flight drain for graceful
54
+ shutdown.
55
+
56
+ > Status: early development. The API will change.
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install slackwright
62
+ pip install 'slackwright[valkey]' # ValkeyFormStore
63
+ pip install 'slackwright[postgres]' # PostgresFormStore
64
+ ```
65
+
66
+ ## Example
67
+
68
+ ```python
69
+ import slackwright
70
+ from slackwright import forms, stores
71
+
72
+ runtime = forms.Runtime(stores.ValkeyFormStore(valkey), on_submit)
73
+ runtime.register(bolt_app) # handles form buttons and modals
74
+
75
+ toolkit = slackwright.Toolkit(
76
+ slack_client,
77
+ channel_id=channel_id,
78
+ thread_ts=thread_ts,
79
+ user_id=user_id,
80
+ forms=runtime,
81
+ canvases=True,
82
+ )
83
+ tools = toolkit.anthropic() # give these to Claude
84
+ result = await toolkit.call(name, tool_input) # run a tool_use block
85
+ ```
86
+
87
+ See [docs/design.md](docs/design.md) for the design.
88
+
89
+ ## Development
90
+
91
+ ```bash
92
+ uv sync --all-groups
93
+ docker compose up -d --wait # Valkey and PostgreSQL for integration tests
94
+ uv run pre-commit run --all-files
95
+ uv run coverage run
96
+ uv run coverage report
97
+ ```
98
+
99
+ Without the compose services, the Valkey and PostgreSQL tests are
100
+ skipped. When `VALKEY_URL` or `POSTGRES_URL` is set (CI sets both),
101
+ those tests always run against that URL.
102
+
103
+ ## License
104
+
105
+ BSD 3-Clause. See [LICENSE](LICENSE).
@@ -0,0 +1,69 @@
1
+ # slackwright
2
+
3
+ Building blocks for AI agents that live in Slack.
4
+
5
+ slackwright is a library, not a framework. Your bot keeps its own event
6
+ loop and agent; slackwright gives it the Slack parts:
7
+
8
+ - **Render**: post LLM Markdown answers with Slack's native Markdown
9
+ support, split long answers, and stream replies with task cards.
10
+ - **Tools**: expose the parts below to an LLM agent as tools, with
11
+ Anthropic tool definitions and validated inputs.
12
+ - **Forms**: forms that an agent designs, in a modal or inline in a
13
+ message, with validated submissions.
14
+ - **Canvases**: create, edit, and read canvas documents.
15
+ - **Ingest**: turn a Slack thread, its mentions, and its files into LLM
16
+ messages.
17
+ - **Lifecycle**: progress updates and an in-flight drain for graceful
18
+ shutdown.
19
+
20
+ > Status: early development. The API will change.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install slackwright
26
+ pip install 'slackwright[valkey]' # ValkeyFormStore
27
+ pip install 'slackwright[postgres]' # PostgresFormStore
28
+ ```
29
+
30
+ ## Example
31
+
32
+ ```python
33
+ import slackwright
34
+ from slackwright import forms, stores
35
+
36
+ runtime = forms.Runtime(stores.ValkeyFormStore(valkey), on_submit)
37
+ runtime.register(bolt_app) # handles form buttons and modals
38
+
39
+ toolkit = slackwright.Toolkit(
40
+ slack_client,
41
+ channel_id=channel_id,
42
+ thread_ts=thread_ts,
43
+ user_id=user_id,
44
+ forms=runtime,
45
+ canvases=True,
46
+ )
47
+ tools = toolkit.anthropic() # give these to Claude
48
+ result = await toolkit.call(name, tool_input) # run a tool_use block
49
+ ```
50
+
51
+ See [docs/design.md](docs/design.md) for the design.
52
+
53
+ ## Development
54
+
55
+ ```bash
56
+ uv sync --all-groups
57
+ docker compose up -d --wait # Valkey and PostgreSQL for integration tests
58
+ uv run pre-commit run --all-files
59
+ uv run coverage run
60
+ uv run coverage report
61
+ ```
62
+
63
+ Without the compose services, the Valkey and PostgreSQL tests are
64
+ skipped. When `VALKEY_URL` or `POSTGRES_URL` is set (CI sets both),
65
+ those tests always run against that URL.
66
+
67
+ ## License
68
+
69
+ BSD 3-Clause. See [LICENSE](LICENSE).
@@ -0,0 +1,26 @@
1
+ # Backing services for the integration tests:
2
+ #
3
+ # docker compose up -d --wait
4
+ # uv run coverage run
5
+ #
6
+ # The tests use these ports when VALKEY_URL and POSTGRES_URL are not set.
7
+ # CI starts the same images as GitHub Actions service containers.
8
+ services:
9
+ valkey:
10
+ image: valkey/valkey:8
11
+ ports: ["127.0.0.1:56379:6379"]
12
+ healthcheck:
13
+ test: ["CMD", "valkey-cli", "ping"]
14
+ interval: 2s
15
+ timeout: 2s
16
+ retries: 15
17
+ postgres:
18
+ image: postgres:17
19
+ environment:
20
+ POSTGRES_PASSWORD: postgres
21
+ ports: ["127.0.0.1:55432:5432"]
22
+ healthcheck:
23
+ test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "postgres"]
24
+ interval: 2s
25
+ timeout: 2s
26
+ retries: 15