deqio 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 (39) hide show
  1. deqio-0.1.0/.github/workflows/publish.yml +90 -0
  2. deqio-0.1.0/.github/workflows/release-test.yml +75 -0
  3. deqio-0.1.0/.gitignore +25 -0
  4. deqio-0.1.0/.python-version +1 -0
  5. deqio-0.1.0/AGENTS.md +284 -0
  6. deqio-0.1.0/LICENSE +21 -0
  7. deqio-0.1.0/PKG-INFO +423 -0
  8. deqio-0.1.0/README.md +396 -0
  9. deqio-0.1.0/benchmarks/basic.json +4315 -0
  10. deqio-0.1.0/logs/.gitkeep +0 -0
  11. deqio-0.1.0/models/.gitkeep +0 -0
  12. deqio-0.1.0/models.json +442 -0
  13. deqio-0.1.0/pyproject.toml +55 -0
  14. deqio-0.1.0/src/deqio/__init__.py +3 -0
  15. deqio-0.1.0/src/deqio/__main__.py +5 -0
  16. deqio-0.1.0/src/deqio/backends.py +163 -0
  17. deqio-0.1.0/src/deqio/benchmark.py +353 -0
  18. deqio-0.1.0/src/deqio/benchmark_store.py +120 -0
  19. deqio-0.1.0/src/deqio/catalog.py +93 -0
  20. deqio-0.1.0/src/deqio/cli.py +81 -0
  21. deqio-0.1.0/src/deqio/config.py +205 -0
  22. deqio-0.1.0/src/deqio/console.py +179 -0
  23. deqio-0.1.0/src/deqio/data/__init__.py +1 -0
  24. deqio-0.1.0/src/deqio/data/benchmarks/basic.json +4315 -0
  25. deqio-0.1.0/src/deqio/data/config.json +14 -0
  26. deqio-0.1.0/src/deqio/data/models.json +442 -0
  27. deqio-0.1.0/src/deqio/installations.py +210 -0
  28. deqio-0.1.0/src/deqio/laya_mlx_sidecar.py +52 -0
  29. deqio-0.1.0/src/deqio/model_manager.py +508 -0
  30. deqio-0.1.0/src/deqio/nimble_prepare.py +119 -0
  31. deqio-0.1.0/src/deqio/nimble_sidecar.py +177 -0
  32. deqio-0.1.0/src/deqio/semif_sidecar.py +195 -0
  33. deqio-0.1.0/src/deqio/server.py +814 -0
  34. deqio-0.1.0/src/deqio/systemone_runtime.py +421 -0
  35. deqio-0.1.0/src/deqio/ui.py +934 -0
  36. deqio-0.1.0/src/deqio/workspace.py +49 -0
  37. deqio-0.1.0/tests/package_smoke.py +106 -0
  38. deqio-0.1.0/tests/test_server.py +781 -0
  39. deqio-0.1.0/uv.lock +1991 -0
@@ -0,0 +1,90 @@
1
+ name: Publish Deqio to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ name: Test and build distributions
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17
+ with:
18
+ persist-credentials: false
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
22
+ with:
23
+ version: "0.12.18"
24
+ enable-cache: true
25
+
26
+ - name: Verify release tag matches package version
27
+ env:
28
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
29
+ run: |
30
+ python - <<'PY'
31
+ import os
32
+ import tomllib
33
+ from pathlib import Path
34
+
35
+ version = tomllib.loads(Path("pyproject.toml").read_text())['project']['version']
36
+ expected = f"v{version}"
37
+ actual = os.environ["RELEASE_TAG"]
38
+ if actual != expected:
39
+ raise SystemExit(f"release tag {actual!r} does not match package version {expected!r}")
40
+ print(f"release version OK: {actual}")
41
+ PY
42
+
43
+ - name: Run test suite
44
+ run: |
45
+ uv sync --frozen --extra dev
46
+ uv run --frozen pytest
47
+
48
+ - name: Build wheel and source distribution
49
+ run: uv build --no-sources
50
+
51
+ - name: Smoke test wheel from an isolated environment
52
+ run: uv run --isolated --no-project --with dist/*.whl tests/package_smoke.py
53
+
54
+ - name: Smoke test source distribution from an isolated environment
55
+ run: uv run --isolated --no-project --with dist/*.tar.gz tests/package_smoke.py
56
+
57
+ - name: Upload distributions
58
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
59
+ with:
60
+ name: deqio-dist
61
+ path: dist/
62
+ if-no-files-found: error
63
+
64
+ publish:
65
+ name: Publish to PyPI
66
+ needs: build
67
+ runs-on: ubuntu-latest
68
+ environment:
69
+ name: pypi
70
+ permissions:
71
+ id-token: write
72
+
73
+ steps:
74
+ - name: Install uv
75
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
76
+ with:
77
+ version: "0.12.18"
78
+ enable-cache: false
79
+
80
+ - name: Download distributions
81
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
82
+ with:
83
+ name: deqio-dist
84
+ path: dist/
85
+
86
+ - name: Generate PEP 740 attestations
87
+ uses: astral-sh/attest-action@f589a42a7efb6fe400b4f400de60b4bc90390027 # v0.0.6
88
+
89
+ - name: Publish with PyPI Trusted Publishing
90
+ run: uv publish
@@ -0,0 +1,75 @@
1
+ name: Publish Deqio to TestPyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ build:
8
+ name: Test and build distributions
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
16
+ with:
17
+ persist-credentials: false
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
21
+ with:
22
+ version: "0.12.18"
23
+ enable-cache: true
24
+
25
+ - name: Run test suite
26
+ run: |
27
+ uv sync --frozen --extra dev
28
+ uv run --frozen pytest
29
+
30
+ - name: Build wheel and source distribution
31
+ run: uv build --no-sources
32
+
33
+ - name: Smoke test wheel from an isolated environment
34
+ run: uv run --isolated --no-project --with dist/*.whl tests/package_smoke.py
35
+
36
+ - name: Smoke test source distribution from an isolated environment
37
+ run: uv run --isolated --no-project --with dist/*.tar.gz tests/package_smoke.py
38
+
39
+ - name: Upload distributions
40
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
41
+ with:
42
+ name: deqio-test-dist
43
+ path: dist/
44
+ if-no-files-found: error
45
+
46
+ publish:
47
+ name: Publish to TestPyPI
48
+ needs: build
49
+ runs-on: ubuntu-latest
50
+ environment:
51
+ name: testpypi
52
+ permissions:
53
+ contents: read
54
+ id-token: write
55
+
56
+ steps:
57
+ - name: Checkout publishing configuration
58
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
59
+ with:
60
+ persist-credentials: false
61
+
62
+ - name: Install uv
63
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
64
+ with:
65
+ version: "0.12.18"
66
+ enable-cache: false
67
+
68
+ - name: Download distributions
69
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
70
+ with:
71
+ name: deqio-test-dist
72
+ path: dist/
73
+
74
+ - name: Publish with TestPyPI Trusted Publishing
75
+ run: uv publish --index testpypi dist/*
deqio-0.1.0/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .DS_Store
5
+ .env
6
+
7
+ models/*
8
+ !models/.gitkeep
9
+
10
+ logs/*
11
+ !logs/.gitkeep
12
+
13
+ *.jsonl
14
+ *.patch
15
+ .pytest_cache/
16
+ .ruff_cache/
17
+ build/
18
+ dist/
19
+ *.egg-info/
20
+
21
+ TODO
22
+ .model-runtimes/
23
+
24
+ .deqio/
25
+ /config.json
@@ -0,0 +1 @@
1
+ 3.12
deqio-0.1.0/AGENTS.md ADDED
@@ -0,0 +1,284 @@
1
+ # AGENTS.md
2
+
3
+ ## Purpose
4
+
5
+ Deqio is a small multi-engine runtime for typed AI decisions.
6
+
7
+ It exposes one stable HTTP API and a lightweight browser UI over independent decision engines while keeping installation reproducible with `uv`.
8
+
9
+ Keep the project small, deterministic, observable, fast, and easy to reinstall.
10
+
11
+ ## Core principles
12
+
13
+ 1. Preserve the public HTTP API unless a task explicitly permits a breaking change.
14
+ 2. Keep model/engine-specific behavior behind runtime adapters.
15
+ 3. Do not vendor upstream engine source code or model weights.
16
+ 4. Do not commit `.venv`, `.model-runtimes`, model weights, local Deqio state, or request logs.
17
+ 5. Use `uv` exclusively for Python and dependency management.
18
+ 6. Keep one selected decision model resident per server process.
19
+ 7. Do not convert classification into autoregressive answer generation.
20
+ 8. Do not claim backend support that the upstream runtime does not actually provide.
21
+ 9. Keep the browser UI dependency-free: plain HTML, CSS, and JavaScript only.
22
+ 10. Treat probability calibration as engine-specific.
23
+
24
+ ## Naming
25
+
26
+ The project, Python package, CLI, logs, and local state use the Deqio name:
27
+
28
+ ```text
29
+ project: deqio
30
+ package: deqio
31
+ CLI: deqio
32
+ console: [deqio]
33
+ local state: .deqio/
34
+ ```
35
+
36
+ SemIf remains the name of one supported upstream engine. Do not rename upstream engine names, model IDs, package names, or protocol concepts to Deqio.
37
+
38
+ ## Runtime architecture
39
+
40
+ The main environment contains the Deqio core only. Every decision engine, including SemIf, runs in an isolated environment under:
41
+
42
+ ```text
43
+ .model-runtimes/<runtime-key>/
44
+ ```
45
+
46
+ This isolation is intentional. Independent engines can require conflicting PyTorch, Transformers, MLX, or accelerator versions.
47
+
48
+ Keep runtime environments separate from local model checkpoints. Downloaded or prepared weights that Deqio manages explicitly live under:
49
+
50
+ ```text
51
+ models/
52
+ ```
53
+
54
+ For example, the SemIf MLX snapshot and prepared Nimble checkpoint use this directory. Do not move these weights into `.model-runtimes/`: runtime environments should be rebuildable without forcing large model downloads or checkpoint merges again.
55
+
56
+ The model catalog is `models.json`.
57
+
58
+ The active selection is stored in `config.json` as:
59
+
60
+ ```text
61
+ engine
62
+ model_id
63
+ backend
64
+ model
65
+ ```
66
+
67
+ Supported wrapper backend labels are:
68
+
69
+ ```text
70
+ mlx
71
+ mps
72
+ cuda
73
+ ```
74
+
75
+ A catalog profile must exist for every allowed `(model_id, backend)` pair.
76
+
77
+ ## Package management
78
+
79
+ Do not use:
80
+
81
+ ```text
82
+ pip install
83
+ python -m venv
84
+ requirements.txt
85
+ poetry
86
+ pipenv
87
+ ```
88
+
89
+ Use:
90
+
91
+ ```bash
92
+ uv sync
93
+ uv add
94
+ uv remove
95
+ uv lock
96
+ uv run
97
+ uv venv
98
+ uv pip install --python ...
99
+ ```
100
+
101
+ The public CLI is:
102
+
103
+ ```bash
104
+ uv run deqio serve
105
+ uv run deqio models list
106
+ uv run deqio models installed
107
+ uv run deqio models setup
108
+ uv run deqio models use
109
+ uv run deqio models status
110
+ uv run deqio status
111
+ ```
112
+
113
+ ## Configuration
114
+
115
+ Default configuration lives in `config.json`.
116
+
117
+ Environment overrides use the `DEQIO_` prefix, including:
118
+
119
+ ```text
120
+ DEQIO_CONFIG
121
+ DEQIO_ENGINE
122
+ DEQIO_MODEL_ID
123
+ DEQIO_BACKEND
124
+ DEQIO_MODEL
125
+ DEQIO_MODEL_REVISION
126
+ DEQIO_MAX_TOKENS
127
+ DEQIO_MLX_CACHE_MIB
128
+ DEQIO_LOG
129
+ DEQIO_TORCH_DTYPE
130
+ DEQIO_RUNTIME_DIR
131
+ DEQIO_MODEL_CATALOG
132
+ DEQIO_SIDECAR_STARTUP_SECONDS
133
+ ```
134
+
135
+ Keep project configuration under the `DEQIO_` namespace. `SemIf` remains the name of one upstream engine.
136
+
137
+ ## Public HTTP API
138
+
139
+ Keep these endpoints backward compatible:
140
+
141
+ ```text
142
+ GET /
143
+ GET /health
144
+ GET /ui
145
+ GET /v1/models
146
+ GET /v1/models/installed
147
+ GET /v1/stats
148
+ GET /v1/recent
149
+
150
+ POST /v1/noul
151
+ POST /v1/choice
152
+ POST /v1/decision
153
+ POST /v1/shared
154
+ POST /v1/cache/clear
155
+ POST /v1/models/activate
156
+ ```
157
+
158
+ `/v1/decision` is a compatibility alias for `/v1/choice`.
159
+
160
+ External engines should be normalized to the same response shape. If an engine does not expose raw logits, return an empty `option_logits` object. Never fabricate logits from probabilities and label them as raw logits.
161
+
162
+ ## Model catalog rules
163
+
164
+ `models.json` is the source of truth for selectable models.
165
+
166
+ Every entry needs:
167
+
168
+ - stable local `id`
169
+ - `engine`
170
+ - human-readable label and description
171
+ - upstream source URL
172
+ - explicit compatible backends
173
+ - model identifier/path for each backend
174
+ - isolated runtime install packages when applicable
175
+
176
+ Do not silently fall back from an unsupported backend to CPU or another backend.
177
+
178
+ Installed-profile state is local machine state under `.deqio/` and must not be committed. Installation and activation are separate concerns: the live activation endpoint must never install packages or silently download a new runtime. It may only switch to a profile already detected as installed.
179
+
180
+ Live model switching must keep one resident model at a time. Unload the old runtime before loading the new one, block inference during the transition, persist `config.json` only after the new runtime passes warmup, and attempt to restore the previous runtime on failure.
181
+
182
+ Do not alias MPS to MLX or MLX to MPS. They are distinct Apple Silicon runtime stacks.
183
+
184
+ ## Change workflow
185
+
186
+ Before work:
187
+
188
+ ```bash
189
+ git status --short
190
+ ```
191
+
192
+ After changes:
193
+
194
+ ```bash
195
+ uv run python -m compileall -q src tests
196
+ uv run pytest
197
+ git diff --check
198
+ git diff
199
+ ```
200
+
201
+ Produce a patch with:
202
+
203
+ ```bash
204
+ git diff --binary > change.patch
205
+ ```
206
+
207
+ Before applying a supplied patch:
208
+
209
+ ```bash
210
+ git apply --check change.patch
211
+ git apply change.patch
212
+ ```
213
+
214
+ Do not use `git apply --reject` unless explicitly requested.
215
+
216
+ Do not use destructive Git commands unless explicitly requested.
217
+
218
+ ## Validation
219
+
220
+ Minimum validation after Python changes:
221
+
222
+ ```bash
223
+ uv run python -m compileall -q src tests
224
+ uv run pytest
225
+ ```
226
+
227
+ Changes to model management must also verify:
228
+
229
+ ```bash
230
+ uv run deqio models list
231
+ uv run deqio models installed
232
+ uv run deqio status
233
+ ```
234
+
235
+ Changes to serving must verify:
236
+
237
+ ```text
238
+ /health
239
+ /v1/noul
240
+ /v1/choice
241
+ /v1/shared
242
+ ```
243
+
244
+ Changes to UI must verify:
245
+
246
+ 1. `/ui` loads.
247
+ 2. Noul requests can be submitted.
248
+ 3. Choice options can be added and removed.
249
+ 4. Shared decisions can be submitted.
250
+ 5. generated JSON matches the API request.
251
+ 6. responses render without page reload.
252
+ 7. active engine/model/backend are visible.
253
+ 8. installed model profiles are listed.
254
+ 9. switching an installed profile keeps the same public API URL.
255
+
256
+ ## Logging
257
+
258
+ Console logging is part of the developer-facing interface.
259
+
260
+ Rules:
261
+
262
+ - identify the public server as `[deqio]`;
263
+ - prefix external runtime output as `[sidecar:<engine>]`;
264
+ - suppress internal sidecar HTTP access-log noise;
265
+ - keep the main Uvicorn access log disabled;
266
+ - log wrapper-owned `/v1/noul`, `/v1/choice`, `/v1/decision`, and `/v1/shared` requests clearly;
267
+ - print the UI, API docs, and health URLs at startup;
268
+ - describe random sidecar ports as internal inference-only;
269
+ - keep useful model download, loading, accelerator, and runtime diagnostics visible.
270
+
271
+ Do not persist the full request state by default.
272
+
273
+ ## Performance
274
+
275
+ Avoid changes that:
276
+
277
+ - reload model weights per request;
278
+ - create duplicate resident models;
279
+ - add text generation to typed decisions;
280
+ - disable native batching/shared-state behavior without reason;
281
+ - merge incompatible engine dependencies into the main environment;
282
+ - put UI rendering or model-selection work in the normal decision request path.
283
+
284
+ External engines should remain resident in a localhost-only child process for the lifetime of the main server.
deqio-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Deqio contributors
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.