compose-application 0.1.0a1__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.
- compose_application-0.1.0a1/LICENSE.md +21 -0
- compose_application-0.1.0a1/PKG-INFO +161 -0
- compose_application-0.1.0a1/README.md +134 -0
- compose_application-0.1.0a1/pyproject.toml +73 -0
- compose_application-0.1.0a1/pyproject.toml.orig +51 -0
- compose_application-0.1.0a1/src/compose_application/__init__.py +8 -0
- compose_application-0.1.0a1/src/compose_application/headless_tabular.py +79 -0
- compose_application-0.1.0a1/src/compose_application/live.py +361 -0
- compose_application-0.1.0a1/src/compose_application/project_templates.py +373 -0
- compose_application-0.1.0a1/src/compose_application/projects.py +253 -0
- compose_application-0.1.0a1/src/compose_application/py.typed +1 -0
- compose_application-0.1.0a1/src/compose_application/reference.py +215 -0
- compose_application-0.1.0a1/src/compose_application/service.py +124 -0
- compose_application-0.1.0a1/src/compose_application/tabular.py +233 -0
- compose_application-0.1.0a1/src/compose_application/tabular_edits.py +93 -0
- compose_application-0.1.0a1/src/compose_application/terminal_templates.py +191 -0
- compose_application-0.1.0a1/src/compose_application/ui.py +178 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wispsy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: compose-application
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Optional composition of typed storage, APIs and spatial interfaces.
|
|
5
|
+
Author: ellainng
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE.md
|
|
8
|
+
Requires-Dist: expose-api[backpack]==0.2.0 ; extra == 'live'
|
|
9
|
+
Requires-Dist: spatial-ui==0.1.1 ; extra == 'live'
|
|
10
|
+
Requires-Dist: expose-api[backpack]==0.2.0 ; extra == 'service'
|
|
11
|
+
Requires-Dist: expose-api[backpack]==0.2.0 ; extra == 'tabular'
|
|
12
|
+
Requires-Dist: spatial-ui==0.1.1 ; extra == 'tabular'
|
|
13
|
+
Requires-Dist: headless-spreadsheets==0.1.1 ; extra == 'tabular'
|
|
14
|
+
Requires-Dist: expose-api[backpack]==0.2.0 ; extra == 'ui'
|
|
15
|
+
Requires-Dist: spatial-ui==0.1.1 ; extra == 'ui'
|
|
16
|
+
Requires-Dist: expose-api[backpack,enforce-type]==0.2.0 ; extra == 'validation'
|
|
17
|
+
Requires-Python: >=3.14
|
|
18
|
+
Project-URL: Source, https://github.com/wispsy/compose_application
|
|
19
|
+
Project-URL: Issues, https://github.com/wispsy/compose_application/issues
|
|
20
|
+
Project-URL: Project, https://github.com/orgs/wispsy/projects/18
|
|
21
|
+
Provides-Extra: live
|
|
22
|
+
Provides-Extra: service
|
|
23
|
+
Provides-Extra: tabular
|
|
24
|
+
Provides-Extra: ui
|
|
25
|
+
Provides-Extra: validation
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# compose_application
|
|
29
|
+
|
|
30
|
+
Initial PyPI preview: **0.1.0a1**. Optional profiles use published independent
|
|
31
|
+
packages; generated projects select exact package-index versions.
|
|
32
|
+
[Wispsy Releases](https://github.com/orgs/wispsy/projects/31) distinguishes
|
|
33
|
+
published artifacts from main development. Historical qualification manifests
|
|
34
|
+
remain unchanged; index qualification uses docs/release-sources-v1.json.
|
|
35
|
+
|
|
36
|
+
The optional [compiled validation reference](docs/validation-reference.md)
|
|
37
|
+
selects the expose-api Enforce Type adapter explicitly and qualifies it through
|
|
38
|
+
persistent checked HTTP and independent process restart.
|
|
39
|
+
|
|
40
|
+
Optional composition of typed storage, APIs and spatial interfaces.
|
|
41
|
+
|
|
42
|
+
`compose_application` is the application integration home for **Cohesion Block A**.
|
|
43
|
+
It coordinates optional use of `backpack-store`, `expose-api` and `spatial-ui`,
|
|
44
|
+
with `enforce-type` validation and a pocket-python Track B application target.
|
|
45
|
+
|
|
46
|
+
- Repository: `wispsy/compose_application`
|
|
47
|
+
- Distribution: `compose-application`
|
|
48
|
+
- Import: `compose_application`
|
|
49
|
+
- Python: 3.14 or newer
|
|
50
|
+
- Runtime dependencies: none in the initial package foundation
|
|
51
|
+
|
|
52
|
+
The component libraries remain independently useful and independently released.
|
|
53
|
+
Application profiles explicitly select integrations and dependencies. The source
|
|
54
|
+
provides owned persistent REST and typed UI references. Track B browser-local
|
|
55
|
+
runtime support retains its separate application gates.
|
|
56
|
+
|
|
57
|
+
## Plan and development queue
|
|
58
|
+
|
|
59
|
+
- [Tabular Interfaces plan](IMPLEMENTATION_PLAN.md) and
|
|
60
|
+
[cross-repository Project](https://github.com/orgs/wispsy/projects/19)
|
|
61
|
+
- [Cohesion Block A Project](https://github.com/orgs/wispsy/projects/18)
|
|
62
|
+
- [Architecture charter](docs/cohesion-block-a.md)
|
|
63
|
+
- [Shared contract register](docs/contracts.md)
|
|
64
|
+
- [Track B workload and prerequisite probes](docs/track-b-workload.md)
|
|
65
|
+
- [Roadmap and owning issues](docs/roadmap.md)
|
|
66
|
+
|
|
67
|
+
Issues hold scope, acceptance criteria and dependencies. The organization Project
|
|
68
|
+
coordinates the repositories without replacing their existing development queues.
|
|
69
|
+
The initial batch establishes contracts, canonical storage naming, the validation
|
|
70
|
+
adapter and an extraction inventory of Pretty Notebook's storage behavior.
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
uv sync --locked
|
|
76
|
+
uv run --locked python scripts/check_contracts.py
|
|
77
|
+
uv run --locked python -m unittest discover -s tests
|
|
78
|
+
uv run --locked python scripts/check_distribution.py
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The distribution check builds and installs both wheel and source distributions
|
|
82
|
+
into independent temporary environments outside the checkout. CI runs it on
|
|
83
|
+
Linux, macOS and Windows using Python 3.14.
|
|
84
|
+
|
|
85
|
+
No release has been published for this project. Package publication and hosted
|
|
86
|
+
deployment require their own selected scope and authorization. License terms
|
|
87
|
+
will be selected before publication.
|
|
88
|
+
## Service composition
|
|
89
|
+
|
|
90
|
+
The optional [CPython service profile](docs/service-profile.md) provides explicit
|
|
91
|
+
configuration and an asynchronous application context owning validated storage,
|
|
92
|
+
the typed resource and the ASGI app. Install with `uv sync --extra service`;
|
|
93
|
+
base imports remain independent of the integration packages.
|
|
94
|
+
|
|
95
|
+
The [persistent REST reference](docs/rest-reference.md) adds synthetic work-item
|
|
96
|
+
CRUD with checked revisions and real HTTP/process-restart acceptance. Run
|
|
97
|
+
`python -m compose_application.reference check` in the selected service environment.
|
|
98
|
+
|
|
99
|
+
The [compatibility matrix](docs/compatibility.md) qualifies immutable minimum
|
|
100
|
+
and current development profiles, installed artifacts and code-upgrade recovery.
|
|
101
|
+
CI retains exact per-platform receipts; browser application acceptance remains
|
|
102
|
+
separate from CPython service support.
|
|
103
|
+
|
|
104
|
+
## Typed UI reference
|
|
105
|
+
|
|
106
|
+
The optional [persistent typed UI](docs/ui-reference.md) combines public spatial_ui
|
|
107
|
+
forms with the checked REST reference. Use `uv sync --locked --extra ui`, then
|
|
108
|
+
`uv run --locked --extra ui python -m compose_application.ui serve --database ./work-items.sqlite3`.
|
|
109
|
+
The preview remains on loopback, with independent browser drafts, checked edits,
|
|
110
|
+
explicit conflict/merge choices and durable SQLite records. The `check` command
|
|
111
|
+
provides 15 form/REST checks across process restart; CI also exercises the actual
|
|
112
|
+
UI in Chromium and the optional profile in installed wheel/source environments.
|
|
113
|
+
|
|
114
|
+
The optional [protected native live reference](docs/live-reference.md) adds
|
|
115
|
+
same-origin cookie verification, per-principal native UI sessions and persistent
|
|
116
|
+
single-record WebSocket snapshots. Install with `uv sync --locked --extra live`.
|
|
117
|
+
The caller supplies existing credentials and a WebSocket-capable ASGI host;
|
|
118
|
+
publication and public hosting remain separate.
|
|
119
|
+
|
|
120
|
+
## Reference projects
|
|
121
|
+
|
|
122
|
+
Create a small application-owned reference with an explicit profile:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
python -m compose_application.projects ./garden-board --name garden-board --profile ui
|
|
126
|
+
cd garden-board
|
|
127
|
+
uv sync
|
|
128
|
+
uv run garden-board check
|
|
129
|
+
uv run garden-board serve --database ./work-items.sqlite3
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Select `service` for checked REST, `ui` for the loopback typed workspace, or
|
|
133
|
+
`live` for a protected native ASGI factory with caller-supplied credentials,
|
|
134
|
+
origin and host. Each project pins the accepted immutable composition source.
|
|
135
|
+
Generation installs nothing. Matching repeat requests leave owner edits and
|
|
136
|
+
data untouched. See the [layout, setup and acceptance](docs/reference-projects.md).
|
|
137
|
+
|
|
138
|
+
The optional [persistent read-only and editable table reference](docs/tabular-reference.md)
|
|
139
|
+
provides dataset sorting, literal search, column controls and pagination over
|
|
140
|
+
protected registered records without changing stored values or revisions.
|
|
141
|
+
Explicit editable mode adds checked scalar saves, preserved conflict drafts
|
|
142
|
+
and process-restart acceptance; a separate headless example uses the same rows.
|
|
143
|
+
|
|
144
|
+
## Terminal applications
|
|
145
|
+
|
|
146
|
+
Generate an application-owned Expose Interface + Carets project with:
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
uv run python -m compose_application.projects ./progress-desk --name progress-desk --profile terminal
|
|
150
|
+
cd progress-desk
|
|
151
|
+
uv sync
|
|
152
|
+
uv run progress-desk check
|
|
153
|
+
uv run progress-desk terminal
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`TerminalProjectSpec` selects independent immutable library sources and reuses
|
|
157
|
+
the existing exclusive creation/repeat-preservation behavior. Generated source
|
|
158
|
+
owns the finite application service, Carets model and typed commands; it does
|
|
159
|
+
not require a Compose Application runtime. `check` is headless; interactive
|
|
160
|
+
terminal input currently requires POSIX. Existing service/ui/live source
|
|
161
|
+
selections remain compatible. See [terminal projects](docs/terminal-projects.md).
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# compose_application
|
|
2
|
+
|
|
3
|
+
Initial PyPI preview: **0.1.0a1**. Optional profiles use published independent
|
|
4
|
+
packages; generated projects select exact package-index versions.
|
|
5
|
+
[Wispsy Releases](https://github.com/orgs/wispsy/projects/31) distinguishes
|
|
6
|
+
published artifacts from main development. Historical qualification manifests
|
|
7
|
+
remain unchanged; index qualification uses docs/release-sources-v1.json.
|
|
8
|
+
|
|
9
|
+
The optional [compiled validation reference](docs/validation-reference.md)
|
|
10
|
+
selects the expose-api Enforce Type adapter explicitly and qualifies it through
|
|
11
|
+
persistent checked HTTP and independent process restart.
|
|
12
|
+
|
|
13
|
+
Optional composition of typed storage, APIs and spatial interfaces.
|
|
14
|
+
|
|
15
|
+
`compose_application` is the application integration home for **Cohesion Block A**.
|
|
16
|
+
It coordinates optional use of `backpack-store`, `expose-api` and `spatial-ui`,
|
|
17
|
+
with `enforce-type` validation and a pocket-python Track B application target.
|
|
18
|
+
|
|
19
|
+
- Repository: `wispsy/compose_application`
|
|
20
|
+
- Distribution: `compose-application`
|
|
21
|
+
- Import: `compose_application`
|
|
22
|
+
- Python: 3.14 or newer
|
|
23
|
+
- Runtime dependencies: none in the initial package foundation
|
|
24
|
+
|
|
25
|
+
The component libraries remain independently useful and independently released.
|
|
26
|
+
Application profiles explicitly select integrations and dependencies. The source
|
|
27
|
+
provides owned persistent REST and typed UI references. Track B browser-local
|
|
28
|
+
runtime support retains its separate application gates.
|
|
29
|
+
|
|
30
|
+
## Plan and development queue
|
|
31
|
+
|
|
32
|
+
- [Tabular Interfaces plan](IMPLEMENTATION_PLAN.md) and
|
|
33
|
+
[cross-repository Project](https://github.com/orgs/wispsy/projects/19)
|
|
34
|
+
- [Cohesion Block A Project](https://github.com/orgs/wispsy/projects/18)
|
|
35
|
+
- [Architecture charter](docs/cohesion-block-a.md)
|
|
36
|
+
- [Shared contract register](docs/contracts.md)
|
|
37
|
+
- [Track B workload and prerequisite probes](docs/track-b-workload.md)
|
|
38
|
+
- [Roadmap and owning issues](docs/roadmap.md)
|
|
39
|
+
|
|
40
|
+
Issues hold scope, acceptance criteria and dependencies. The organization Project
|
|
41
|
+
coordinates the repositories without replacing their existing development queues.
|
|
42
|
+
The initial batch establishes contracts, canonical storage naming, the validation
|
|
43
|
+
adapter and an extraction inventory of Pretty Notebook's storage behavior.
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
uv sync --locked
|
|
49
|
+
uv run --locked python scripts/check_contracts.py
|
|
50
|
+
uv run --locked python -m unittest discover -s tests
|
|
51
|
+
uv run --locked python scripts/check_distribution.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The distribution check builds and installs both wheel and source distributions
|
|
55
|
+
into independent temporary environments outside the checkout. CI runs it on
|
|
56
|
+
Linux, macOS and Windows using Python 3.14.
|
|
57
|
+
|
|
58
|
+
No release has been published for this project. Package publication and hosted
|
|
59
|
+
deployment require their own selected scope and authorization. License terms
|
|
60
|
+
will be selected before publication.
|
|
61
|
+
## Service composition
|
|
62
|
+
|
|
63
|
+
The optional [CPython service profile](docs/service-profile.md) provides explicit
|
|
64
|
+
configuration and an asynchronous application context owning validated storage,
|
|
65
|
+
the typed resource and the ASGI app. Install with `uv sync --extra service`;
|
|
66
|
+
base imports remain independent of the integration packages.
|
|
67
|
+
|
|
68
|
+
The [persistent REST reference](docs/rest-reference.md) adds synthetic work-item
|
|
69
|
+
CRUD with checked revisions and real HTTP/process-restart acceptance. Run
|
|
70
|
+
`python -m compose_application.reference check` in the selected service environment.
|
|
71
|
+
|
|
72
|
+
The [compatibility matrix](docs/compatibility.md) qualifies immutable minimum
|
|
73
|
+
and current development profiles, installed artifacts and code-upgrade recovery.
|
|
74
|
+
CI retains exact per-platform receipts; browser application acceptance remains
|
|
75
|
+
separate from CPython service support.
|
|
76
|
+
|
|
77
|
+
## Typed UI reference
|
|
78
|
+
|
|
79
|
+
The optional [persistent typed UI](docs/ui-reference.md) combines public spatial_ui
|
|
80
|
+
forms with the checked REST reference. Use `uv sync --locked --extra ui`, then
|
|
81
|
+
`uv run --locked --extra ui python -m compose_application.ui serve --database ./work-items.sqlite3`.
|
|
82
|
+
The preview remains on loopback, with independent browser drafts, checked edits,
|
|
83
|
+
explicit conflict/merge choices and durable SQLite records. The `check` command
|
|
84
|
+
provides 15 form/REST checks across process restart; CI also exercises the actual
|
|
85
|
+
UI in Chromium and the optional profile in installed wheel/source environments.
|
|
86
|
+
|
|
87
|
+
The optional [protected native live reference](docs/live-reference.md) adds
|
|
88
|
+
same-origin cookie verification, per-principal native UI sessions and persistent
|
|
89
|
+
single-record WebSocket snapshots. Install with `uv sync --locked --extra live`.
|
|
90
|
+
The caller supplies existing credentials and a WebSocket-capable ASGI host;
|
|
91
|
+
publication and public hosting remain separate.
|
|
92
|
+
|
|
93
|
+
## Reference projects
|
|
94
|
+
|
|
95
|
+
Create a small application-owned reference with an explicit profile:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
python -m compose_application.projects ./garden-board --name garden-board --profile ui
|
|
99
|
+
cd garden-board
|
|
100
|
+
uv sync
|
|
101
|
+
uv run garden-board check
|
|
102
|
+
uv run garden-board serve --database ./work-items.sqlite3
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Select `service` for checked REST, `ui` for the loopback typed workspace, or
|
|
106
|
+
`live` for a protected native ASGI factory with caller-supplied credentials,
|
|
107
|
+
origin and host. Each project pins the accepted immutable composition source.
|
|
108
|
+
Generation installs nothing. Matching repeat requests leave owner edits and
|
|
109
|
+
data untouched. See the [layout, setup and acceptance](docs/reference-projects.md).
|
|
110
|
+
|
|
111
|
+
The optional [persistent read-only and editable table reference](docs/tabular-reference.md)
|
|
112
|
+
provides dataset sorting, literal search, column controls and pagination over
|
|
113
|
+
protected registered records without changing stored values or revisions.
|
|
114
|
+
Explicit editable mode adds checked scalar saves, preserved conflict drafts
|
|
115
|
+
and process-restart acceptance; a separate headless example uses the same rows.
|
|
116
|
+
|
|
117
|
+
## Terminal applications
|
|
118
|
+
|
|
119
|
+
Generate an application-owned Expose Interface + Carets project with:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
uv run python -m compose_application.projects ./progress-desk --name progress-desk --profile terminal
|
|
123
|
+
cd progress-desk
|
|
124
|
+
uv sync
|
|
125
|
+
uv run progress-desk check
|
|
126
|
+
uv run progress-desk terminal
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`TerminalProjectSpec` selects independent immutable library sources and reuses
|
|
130
|
+
the existing exclusive creation/repeat-preservation behavior. Generated source
|
|
131
|
+
owns the finite application service, Carets model and typed commands; it does
|
|
132
|
+
not require a Compose Application runtime. `check` is headless; interactive
|
|
133
|
+
terminal input currently requires POSIX. Existing service/ui/live source
|
|
134
|
+
selections remain compatible. See [terminal projects](docs/terminal-projects.md).
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "compose-application"
|
|
3
|
+
version = "0.1.0a1"
|
|
4
|
+
description = "Optional composition of typed storage, APIs and spatial interfaces."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE.md"]
|
|
8
|
+
requires-python = ">=3.14"
|
|
9
|
+
dependencies = []
|
|
10
|
+
|
|
11
|
+
[[project.authors]]
|
|
12
|
+
name = "ellainng"
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
validation = ["expose-api[backpack,enforce-type]==0.2.0"]
|
|
16
|
+
service = ["expose-api[backpack]==0.2.0"]
|
|
17
|
+
ui = [
|
|
18
|
+
"expose-api[backpack]==0.2.0",
|
|
19
|
+
"spatial-ui==0.1.1",
|
|
20
|
+
]
|
|
21
|
+
live = [
|
|
22
|
+
"expose-api[backpack]==0.2.0",
|
|
23
|
+
"spatial-ui==0.1.1",
|
|
24
|
+
]
|
|
25
|
+
tabular = [
|
|
26
|
+
"expose-api[backpack]==0.2.0",
|
|
27
|
+
"spatial-ui==0.1.1",
|
|
28
|
+
"headless-spreadsheets==0.1.1",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Source = "https://github.com/wispsy/compose_application"
|
|
33
|
+
Issues = "https://github.com/wispsy/compose_application/issues"
|
|
34
|
+
Project = "https://github.com/orgs/wispsy/projects/18"
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["uv_build>=0.12.19,<0.13.0"]
|
|
38
|
+
build-backend = "uv_build"
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
browser-tests = ["playwright==1.64.0"]
|
|
42
|
+
|
|
43
|
+
[tool.uv]
|
|
44
|
+
conflicts = [
|
|
45
|
+
[
|
|
46
|
+
{ extra = "validation" },
|
|
47
|
+
{ extra = "service" },
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
{ extra = "validation" },
|
|
51
|
+
{ extra = "ui" },
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
{ extra = "validation" },
|
|
55
|
+
{ extra = "live" },
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
{ extra = "tabular" },
|
|
59
|
+
{ extra = "validation" },
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
{ extra = "tabular" },
|
|
63
|
+
{ extra = "service" },
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
{ extra = "tabular" },
|
|
67
|
+
{ extra = "ui" },
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
{ extra = "tabular" },
|
|
71
|
+
{ extra = "live" },
|
|
72
|
+
],
|
|
73
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "compose-application"
|
|
3
|
+
version = "0.1.0a1"
|
|
4
|
+
description = "Optional composition of typed storage, APIs and spatial interfaces."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE.md"]
|
|
8
|
+
requires-python = ">=3.14"
|
|
9
|
+
authors = [{ name = "ellainng" }]
|
|
10
|
+
dependencies = []
|
|
11
|
+
|
|
12
|
+
[project.optional-dependencies]
|
|
13
|
+
validation = ["expose-api[backpack,enforce-type]==0.2.0"]
|
|
14
|
+
service = ["expose-api[backpack]==0.2.0"]
|
|
15
|
+
ui = [
|
|
16
|
+
"expose-api[backpack]==0.2.0",
|
|
17
|
+
"spatial-ui==0.1.1",
|
|
18
|
+
]
|
|
19
|
+
live = [
|
|
20
|
+
"expose-api[backpack]==0.2.0",
|
|
21
|
+
"spatial-ui==0.1.1",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
tabular = [
|
|
25
|
+
"expose-api[backpack]==0.2.0",
|
|
26
|
+
"spatial-ui==0.1.1",
|
|
27
|
+
"headless-spreadsheets==0.1.1",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Source = "https://github.com/wispsy/compose_application"
|
|
32
|
+
Issues = "https://github.com/wispsy/compose_application/issues"
|
|
33
|
+
Project = "https://github.com/orgs/wispsy/projects/18"
|
|
34
|
+
|
|
35
|
+
[build-system]
|
|
36
|
+
requires = ["uv_build>=0.12.19,<0.13.0"]
|
|
37
|
+
build-backend = "uv_build"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
browser-tests = ["playwright==1.64.0"]
|
|
41
|
+
|
|
42
|
+
[tool.uv]
|
|
43
|
+
conflicts = [
|
|
44
|
+
[{ extra = "validation" }, { extra = "service" }],
|
|
45
|
+
[{ extra = "validation" }, { extra = "ui" }],
|
|
46
|
+
[{ extra = "validation" }, { extra = "live" }],
|
|
47
|
+
[{ extra = "tabular" }, { extra = "validation" }],
|
|
48
|
+
[{ extra = "tabular" }, { extra = "service" }],
|
|
49
|
+
[{ extra = "tabular" }, { extra = "ui" }],
|
|
50
|
+
[{ extra = "tabular" }, { extra = "live" }],
|
|
51
|
+
]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Optional composition of typed storage, APIs and spatial interfaces.
|
|
2
|
+
|
|
3
|
+
Application assembly APIs are developed through the Cohesion Block A roadmap.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .service import ProfileError, Service, ServiceConfig, application
|
|
7
|
+
|
|
8
|
+
__all__ = ["ProfileError", "Service", "ServiceConfig", "application"]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Explicit in-process Headless Spreadsheets/Backpack table assembly."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
from contextlib import contextmanager
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from tempfile import TemporaryDirectory
|
|
8
|
+
|
|
9
|
+
from .tabular import TableItem
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@contextmanager
|
|
13
|
+
def headless_application(database):
|
|
14
|
+
"""The application owns registration, initialization and connection close."""
|
|
15
|
+
from backpack_store import ApplicationStore, DataclassCodec
|
|
16
|
+
from headless_spreadsheets import SourceColumn
|
|
17
|
+
from headless_spreadsheets.backpack import BackpackSource
|
|
18
|
+
with ApplicationStore.open(database) as store:
|
|
19
|
+
model = store.register(DataclassCodec(TableItem, type_key="reference.table_item"), namespace="tabular",
|
|
20
|
+
table="app_tabular_items", primary_key="key", columns={name: name for name in TableItem.__dataclass_fields__})
|
|
21
|
+
store.initialize("tabular")
|
|
22
|
+
source = BackpackSource(model, model_type=TableItem, key_field="key", table_id="work_items", schema_version="1", columns=[
|
|
23
|
+
SourceColumn("key", "Key", "text", False),
|
|
24
|
+
SourceColumn("title", "Title", "text", False, searchable=True, writable=True),
|
|
25
|
+
SourceColumn("done", "Done", "boolean", False, writable=True),
|
|
26
|
+
SourceColumn("rank", "Rank", "integer", True, writable=True),
|
|
27
|
+
SourceColumn("score", "Score", "number", False, writable=True)])
|
|
28
|
+
try:
|
|
29
|
+
yield source, model
|
|
30
|
+
finally:
|
|
31
|
+
source.close()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def accept_headless():
|
|
35
|
+
from backpack_store import RevisionConflictError, TransactionError
|
|
36
|
+
checks = 0
|
|
37
|
+
def check(condition):
|
|
38
|
+
nonlocal checks
|
|
39
|
+
if not condition:
|
|
40
|
+
raise RuntimeError("Headless persistence acceptance failed.")
|
|
41
|
+
checks += 1
|
|
42
|
+
with TemporaryDirectory(prefix="headless-table-") as directory:
|
|
43
|
+
path = Path(directory) / "items.sqlite"
|
|
44
|
+
with headless_application(path) as (source, model):
|
|
45
|
+
model.create(TableItem("a", "Zulu", "alice", rank=2))
|
|
46
|
+
model.create(TableItem("b", "Alpha", "alice", rank=1))
|
|
47
|
+
row = source.query(columns=["title", "key"], order=[("title", False)], search=dict(fields=["title"], term="Alpha")).rows[0]
|
|
48
|
+
check((row.key, row.revision, row.source_addresses) == ("b", "1", ("title", "key")))
|
|
49
|
+
result = source.edit(row.key, "title", "Headless saved", expected_revision=row.revision)
|
|
50
|
+
check((result.key, result.revision) == ("b", "2"))
|
|
51
|
+
check(model.get("a").value.title == "Zulu" and model.get("b").value.owner == "alice")
|
|
52
|
+
with headless_application(path) as (other, _):
|
|
53
|
+
try:
|
|
54
|
+
other.edit("b", "done", True, expected_revision="1")
|
|
55
|
+
except RevisionConflictError:
|
|
56
|
+
check(True)
|
|
57
|
+
else:
|
|
58
|
+
check(False)
|
|
59
|
+
check(other.get("b") == result)
|
|
60
|
+
try:
|
|
61
|
+
source.edit("b", "title", "", expected_revision="2")
|
|
62
|
+
except TransactionError:
|
|
63
|
+
check(source.get("b") == result)
|
|
64
|
+
else:
|
|
65
|
+
check(False)
|
|
66
|
+
with headless_application(path) as (reopened, _):
|
|
67
|
+
check(reopened.get("b") == result)
|
|
68
|
+
return dict(profile="cpython-tabular/1", consumer="headless-backpack", checks=checks, independent_reopen=True, passed=True)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def main():
|
|
72
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
73
|
+
parser.add_argument("command", choices=("check",))
|
|
74
|
+
parser.parse_args()
|
|
75
|
+
print(json.dumps(accept_headless(), sort_keys=True))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
main()
|