toolframe-sql-sqlite 0.4.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.
@@ -0,0 +1,54 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+ workflow_call:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ validate:
15
+ runs-on: ubuntu-24.04
16
+ timeout-minutes: 20
17
+ steps:
18
+ - name: Check out SQLite provider
19
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
+ with:
21
+ path: toolframe-sql-sqlite
22
+ persist-credentials: false
23
+
24
+ - name: Check out pinned SDK
25
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ repository: ${{ vars.TOOLFRAME_REPOSITORY_OWNER || github.repository_owner }}/toolframe-sdk
28
+ token: ${{ secrets.TOOLFRAME_READ_TOKEN || github.token }}
29
+ ref: 2cd153ec36c585a9adb5ad566effc2985d9e222d
30
+ path: toolframe-sdk
31
+ persist-credentials: false
32
+
33
+ - name: Set up Python
34
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
35
+ with:
36
+ python-version: '3.14.7'
37
+
38
+ - name: Set up uv
39
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
40
+ with:
41
+ version: '0.12.8'
42
+ enable-cache: false
43
+
44
+ - name: Validate in fresh environments
45
+ working-directory: toolframe-sql-sqlite
46
+ run: bash scripts/validate.sh "$RUNNER_TEMP/validated-dist"
47
+
48
+ - name: Retain validated distributions
49
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
50
+ with:
51
+ name: python-distributions
52
+ path: ${{ runner.temp }}/validated-dist/*
53
+ if-no-files-found: error
54
+ retention-days: 7
@@ -0,0 +1,64 @@
1
+ name: Publish Python package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ registry:
7
+ description: Package registry
8
+ type: choice
9
+ required: true
10
+ default: testpypi
11
+ options:
12
+ - testpypi
13
+ - pypi
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ concurrency:
19
+ group: publish-${{ inputs.registry }}-${{ github.ref }}
20
+ cancel-in-progress: false
21
+
22
+ jobs:
23
+ release-tag:
24
+ runs-on: ubuntu-24.04
25
+ timeout-minutes: 5
26
+ steps:
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ with:
29
+ persist-credentials: false
30
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
31
+ with:
32
+ python-version: '3.14.7'
33
+ - name: Require a tag matching the package version
34
+ run: python scripts/check_release.py "$GITHUB_REF"
35
+
36
+ validate:
37
+ needs: release-tag
38
+ uses: ./.github/workflows/ci.yml
39
+ secrets: inherit
40
+ publish:
41
+ needs: validate
42
+ if: github.ref_type == 'tag'
43
+ runs-on: ubuntu-24.04
44
+ timeout-minutes: 10
45
+ environment:
46
+ name: ${{ inputs.registry }}
47
+ permissions:
48
+ id-token: write
49
+ steps:
50
+ - name: Download distributions validated in this run
51
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
52
+ with:
53
+ name: python-distributions
54
+ path: dist
55
+
56
+ - name: Publish to TestPyPI
57
+ if: inputs.registry == 'testpypi'
58
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
59
+ with:
60
+ repository-url: https://test.pypi.org/legacy/
61
+
62
+ - name: Publish to PyPI
63
+ if: inputs.registry == 'pypi'
64
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
@@ -0,0 +1,63 @@
1
+ name: Code quality
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ types: [opened, synchronize, reopened, edited]
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ branch-policy:
15
+ runs-on: ubuntu-24.04
16
+ timeout-minutes: 5
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ with:
20
+ persist-credentials: false
21
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
22
+ with:
23
+ python-version: '3.14.7'
24
+ - name: Check the actual source branch
25
+ env:
26
+ BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
27
+ run: python scripts/check_branch_name.py "$BRANCH_NAME"
28
+
29
+ code-quality:
30
+ runs-on: ubuntu-24.04
31
+ timeout-minutes: 10
32
+ steps:
33
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34
+ with:
35
+ persist-credentials: false
36
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
37
+ with:
38
+ version: '0.12.8'
39
+ enable-cache: false
40
+ - name: Check Python lint and formatting
41
+ run: uvx prek==0.5.5 run ruff-check ruff-format --all-files --show-diff-on-failure
42
+
43
+ commit-policy:
44
+ if: github.event_name == 'pull_request'
45
+ runs-on: ubuntu-24.04
46
+ timeout-minutes: 10
47
+ permissions:
48
+ contents: read
49
+ pull-requests: read
50
+ steps:
51
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52
+ with:
53
+ fetch-depth: 0
54
+ persist-credentials: false
55
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
56
+ with:
57
+ python-version: '3.14.7'
58
+ - uses: commit-check/commit-check-action@a61779784a953fd9047c001c102cfeac5cf26964 # commit-check 2.18.3
59
+ with:
60
+ message: true
61
+ branch: false
62
+ pr-title: true
63
+ pr-comments: false
@@ -0,0 +1,17 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ *.egg-info/
8
+ .coverage
9
+ .DS_Store
10
+ /build/
11
+ /.coverage
12
+ /htmlcov/
13
+
14
+ # Local working documents, issue state, and development worktrees.
15
+ /.local/
16
+ /.issues/
17
+ /.worktrees/
@@ -0,0 +1,29 @@
1
+ default_install_hook_types: [pre-commit, commit-msg]
2
+ default_stages: [pre-commit]
3
+ default_language_version:
4
+ python: python3.11
5
+
6
+ repos:
7
+ - repo: local
8
+ hooks:
9
+ - id: check-branch-name
10
+ name: Check branch naming policy
11
+ entry: python scripts/check_branch_name.py
12
+ language: python
13
+ always_run: true
14
+ pass_filenames: false
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.16.8
17
+ hooks:
18
+ - id: ruff-check
19
+ types_or: [python, pyi]
20
+ files: '^(src|tests|scripts)/'
21
+ - id: ruff-format
22
+ types_or: [python, pyi]
23
+ args: [--check]
24
+ files: '^(src|tests|scripts)/'
25
+ - repo: https://github.com/commit-check/commit-check
26
+ rev: v2.18.3
27
+ hooks:
28
+ - id: check-message
29
+ stages: [commit-msg]
@@ -0,0 +1,47 @@
1
+ # Contributing
2
+
3
+ ## Commit hooks
4
+
5
+ Install [prek](https://prek.j178.dev/) and enable the repository's hooks:
6
+
7
+ ```sh
8
+ uv tool install prek==0.5.5
9
+ prek install --allow-missing-config
10
+ prek run --all-files
11
+ ```
12
+
13
+ The missing-config option allows older worktrees without this configuration to
14
+ keep working. Worktrees containing `.pre-commit-config.yaml` still run the checks.
15
+ The `pre-commit` hook checks the branch name, Python lint, and formatting. The
16
+ `commit-msg` hook checks Conventional Commits. Both Ruff hooks only check files;
17
+ they do not rewrite a commit's contents. Fix lint and formatting explicitly:
18
+
19
+ ```sh
20
+ uvx ruff==0.16.8 check --fix src tests scripts
21
+ uvx ruff==0.16.8 format src tests scripts
22
+ prek run --all-files
23
+ ```
24
+
25
+ The Ruff version and checked paths are pinned in
26
+ [the hook configuration](.pre-commit-config.yaml); the Python rules remain in
27
+ [pyproject.toml](pyproject.toml). CI uses these same hooks on all tracked files
28
+ within their configured paths. Existing package, integration, and release checks
29
+ run independently.
30
+
31
+ ## Branches and commits
32
+
33
+ [cchk.toml](cchk.toml) defines the allowed branch and commit types. Work branches
34
+ use `feat/`, `fix/`, `release/`, or `chore/`, followed by lowercase ASCII letters
35
+ and digits separated by single hyphens. Release versions may also contain dots,
36
+ as in `release/v1.2.0-rc.1`; every separator must have an alphanumeric character on
37
+ both sides. The default branch `main` is the standalone exception.
38
+
39
+ Commit types are independent of branch types: for example,
40
+ `docs: clarify setup` is valid on `chore/update-docs`. Commit-check uses Conventional
41
+ Commits with its default subject length of 5–80 characters. Pull requests check
42
+ their commits and title so the title can be used for a Conventional Commit when
43
+ squash merging.
44
+
45
+ Local hooks can be bypassed. CI reports `branch-policy`, `code-quality`, and
46
+ `commit-policy`; maintainers must configure required status checks separately to
47
+ make passing checks a merge requirement.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ toolframe-sql-sqlite
2
+ Copyright 2026 byfb
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.5
2
+ Name: toolframe-sql-sqlite
3
+ Version: 0.4.0
4
+ Summary: Isolated managed SQLite stores for Toolframe plugins
5
+ Project-URL: Homepage, https://github.com/toolframe/toolframe-sql-sqlite
6
+ Project-URL: Repository, https://github.com/toolframe/toolframe-sql-sqlite
7
+ Project-URL: Documentation, https://github.com/toolframe/toolframe-sql-sqlite#readme
8
+ Project-URL: Issues, https://github.com/toolframe/toolframe-sql-sqlite/issues
9
+ Author-email: byfb <62798989+byfb@users.noreply.github.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Requires-Python: >=3.14
14
+ Requires-Dist: toolframe-sdk==0.4.0
15
+ Description-Content-Type: text/markdown
16
+
17
+ # Toolframe SQLite provider
18
+
19
+ `sql-sqlite` owns `data/plugins/<plugin-id>/data.sqlite`, separately from core's
20
+ management database. Plugins use `RuntimeContext.sql()` and parameterized SQL;
21
+ the host supplies application, owner, generation, root and deadline identity.
22
+ No file path or raw connection is returned. This is lifecycle/data ownership
23
+ isolation for trusted local plugins, not an operating-system sandbox.
24
+
25
+ Install the provider into a running application before enabling plugins that
26
+ require managed SQL:
27
+
28
+ ```sh
29
+ toolframe --home APP plugin add pypi:toolframe-sql-sqlite==0.4.0 --enable
30
+ ```
31
+
32
+ Normal SQL supports queries, mutations, indexes declared in migrations, and
33
+ same-store transactions. Runtime DDL, transaction control, attachment, PRAGMAs
34
+ and provider metadata access are denied by SQLite's authorizer. Transactions are
35
+ bound to one root/generation and roll back on expiry, root loss or disposal. A
36
+ statement failure poisons a transaction. Mutation IDs and same-database receipts
37
+ allow callers to resolve an unknown acknowledgement without repeating a write.
38
+
39
+ Each application/owner store lazily pools one writer connection and one separate
40
+ reader connection. A transaction retains the writer until commit, rollback,
41
+ expiry or root cleanup; standalone mutations use the same writer. Other writes
42
+ wait asynchronously instead of opening competing write connections, leaving the
43
+ holder free to finish its next RPC. Committed-state reads and other owners can
44
+ proceed while a transaction is open. Return all writes within a transaction through
45
+ its transaction client/token; a second unscoped writer from the same root/store
46
+ is rejected as `nested_transaction` instead of waiting on itself.
47
+ A queued transaction also reserves its root/store: await an earlier write before
48
+ beginning a transaction, and await `begin` before issuing its token-bound writes.
49
+
50
+ Each connection slot permits at most 128 waiting calls. Admission obeys the
51
+ host-issued root deadline and cancellation; a full queue returns `storage_busy`
52
+ before that call runs SQL. Connections are reset before reuse and closed on
53
+ provider disposal. This coordinates one provider process, not arbitrary external
54
+ SQLite writers. SQL execution is still synchronous and external lock contention
55
+ retains SQLite's 50ms busy timeout. Pooling does not provide business idempotency
56
+ or make long-running SQL nonblocking.
57
+
58
+ Empty stores initialize automatically. Existing schema changes require a core
59
+ migration plan and explicit apply. Apply checks the plan/history, uses SQLite's
60
+ backup API, executes all pending migrations and history in one transaction, and
61
+ rolls back failures. Nontransactional statements are rejected. Committed schema
62
+ changes are never automatically reverted; backups require an explicit operator
63
+ repair workflow. Disabling/uninstalling a plugin retains its database.
64
+
65
+ The `toolframe.sql.admin` service is host-only. Business plugins declare a
66
+ requirement on `toolframe.sql` version 1. Cross-plugin data access uses the
67
+ owning plugin's business service. There are no cross-database transactions.
68
+
69
+ Development: `uv sync --group dev`, `uv run pytest -q`, `uv build --no-sources`.
70
+ The sibling SDK UV source is a development convenience; wheels depend only on the
71
+ published SDK contract.
72
+
73
+ For isolated local validation, GitHub Actions and manual TestPyPI/PyPI publishing,
74
+ see [CI and publishing](docs/ci.md).
75
+
76
+ For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
77
+
78
+ ## License
79
+
80
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
81
+
82
+ Version 0.3 adds `execute_returning` for mutations with a `RETURNING` clause. It
83
+ returns `rows` and `rowcount`, including within transactions and durable mutation
84
+ receipts. Existing SQLite SQL, migration checksums and `execute` results are
85
+ preserved; PostgreSQL variants in migration declarations do not change SQLite
86
+ history.
87
+
88
+ For development hooks and contribution rules, see [Contributing](CONTRIBUTING.md).
@@ -0,0 +1,72 @@
1
+ # Toolframe SQLite provider
2
+
3
+ `sql-sqlite` owns `data/plugins/<plugin-id>/data.sqlite`, separately from core's
4
+ management database. Plugins use `RuntimeContext.sql()` and parameterized SQL;
5
+ the host supplies application, owner, generation, root and deadline identity.
6
+ No file path or raw connection is returned. This is lifecycle/data ownership
7
+ isolation for trusted local plugins, not an operating-system sandbox.
8
+
9
+ Install the provider into a running application before enabling plugins that
10
+ require managed SQL:
11
+
12
+ ```sh
13
+ toolframe --home APP plugin add pypi:toolframe-sql-sqlite==0.4.0 --enable
14
+ ```
15
+
16
+ Normal SQL supports queries, mutations, indexes declared in migrations, and
17
+ same-store transactions. Runtime DDL, transaction control, attachment, PRAGMAs
18
+ and provider metadata access are denied by SQLite's authorizer. Transactions are
19
+ bound to one root/generation and roll back on expiry, root loss or disposal. A
20
+ statement failure poisons a transaction. Mutation IDs and same-database receipts
21
+ allow callers to resolve an unknown acknowledgement without repeating a write.
22
+
23
+ Each application/owner store lazily pools one writer connection and one separate
24
+ reader connection. A transaction retains the writer until commit, rollback,
25
+ expiry or root cleanup; standalone mutations use the same writer. Other writes
26
+ wait asynchronously instead of opening competing write connections, leaving the
27
+ holder free to finish its next RPC. Committed-state reads and other owners can
28
+ proceed while a transaction is open. Return all writes within a transaction through
29
+ its transaction client/token; a second unscoped writer from the same root/store
30
+ is rejected as `nested_transaction` instead of waiting on itself.
31
+ A queued transaction also reserves its root/store: await an earlier write before
32
+ beginning a transaction, and await `begin` before issuing its token-bound writes.
33
+
34
+ Each connection slot permits at most 128 waiting calls. Admission obeys the
35
+ host-issued root deadline and cancellation; a full queue returns `storage_busy`
36
+ before that call runs SQL. Connections are reset before reuse and closed on
37
+ provider disposal. This coordinates one provider process, not arbitrary external
38
+ SQLite writers. SQL execution is still synchronous and external lock contention
39
+ retains SQLite's 50ms busy timeout. Pooling does not provide business idempotency
40
+ or make long-running SQL nonblocking.
41
+
42
+ Empty stores initialize automatically. Existing schema changes require a core
43
+ migration plan and explicit apply. Apply checks the plan/history, uses SQLite's
44
+ backup API, executes all pending migrations and history in one transaction, and
45
+ rolls back failures. Nontransactional statements are rejected. Committed schema
46
+ changes are never automatically reverted; backups require an explicit operator
47
+ repair workflow. Disabling/uninstalling a plugin retains its database.
48
+
49
+ The `toolframe.sql.admin` service is host-only. Business plugins declare a
50
+ requirement on `toolframe.sql` version 1. Cross-plugin data access uses the
51
+ owning plugin's business service. There are no cross-database transactions.
52
+
53
+ Development: `uv sync --group dev`, `uv run pytest -q`, `uv build --no-sources`.
54
+ The sibling SDK UV source is a development convenience; wheels depend only on the
55
+ published SDK contract.
56
+
57
+ For isolated local validation, GitHub Actions and manual TestPyPI/PyPI publishing,
58
+ see [CI and publishing](docs/ci.md).
59
+
60
+ For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
61
+
62
+ ## License
63
+
64
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
65
+
66
+ Version 0.3 adds `execute_returning` for mutations with a `RETURNING` clause. It
67
+ returns `rows` and `rowcount`, including within transactions and durable mutation
68
+ receipts. Existing SQLite SQL, migration checksums and `execute` results are
69
+ preserved; PostgreSQL variants in migration declarations do not change SQLite
70
+ history.
71
+
72
+ For development hooks and contribution rules, see [Contributing](CONTRIBUTING.md).
@@ -0,0 +1,10 @@
1
+ [commit]
2
+ conventional_commits = true
3
+ allow_commit_types = ["feat", "fix", "docs", "style", "refactor", "test", "chore", "perf", "build", "ci"]
4
+
5
+ [branch]
6
+ conventional_branch = true
7
+ allow_branch_types = ["feat", "fix", "release", "chore"]
8
+ allow_branch_names = ["main"]
9
+ # scripts/check_branch_name.py enforces these names literally, without the
10
+ # additional standalone branch exceptions built into commit-check.