ontary 0.10.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 (163) hide show
  1. ontary-0.10.0/.github/workflows/release.yml +64 -0
  2. ontary-0.10.0/.github/workflows/verify.yml +180 -0
  3. ontary-0.10.0/.gitignore +9 -0
  4. ontary-0.10.0/CHANGELOG.md +771 -0
  5. ontary-0.10.0/CLAUDE.md +21 -0
  6. ontary-0.10.0/LICENSE +21 -0
  7. ontary-0.10.0/Makefile +22 -0
  8. ontary-0.10.0/PKG-INFO +151 -0
  9. ontary-0.10.0/README.md +109 -0
  10. ontary-0.10.0/docs/api-reference.ja.md +1397 -0
  11. ontary-0.10.0/docs/api-reference.md +1404 -0
  12. ontary-0.10.0/docs/authority.md +177 -0
  13. ontary-0.10.0/docs/compatibility.md +597 -0
  14. ontary-0.10.0/docs/connectors.md +160 -0
  15. ontary-0.10.0/docs/cookbook.md +347 -0
  16. ontary-0.10.0/docs/effects.md +177 -0
  17. ontary-0.10.0/docs/mcp-serving.md +155 -0
  18. ontary-0.10.0/docs/ontology-design.ja.md +354 -0
  19. ontary-0.10.0/docs/ontology-design.md +372 -0
  20. ontary-0.10.0/docs/queries.md +295 -0
  21. ontary-0.10.0/docs/releasing.md +165 -0
  22. ontary-0.10.0/docs/storage.md +461 -0
  23. ontary-0.10.0/docs/v1-gate.md +197 -0
  24. ontary-0.10.0/examples/__init__.py +0 -0
  25. ontary-0.10.0/examples/tickets/README.md +86 -0
  26. ontary-0.10.0/examples/tickets/__init__.py +0 -0
  27. ontary-0.10.0/examples/tickets/connector.py +144 -0
  28. ontary-0.10.0/examples/tickets/fixtures.py +122 -0
  29. ontary-0.10.0/examples/tickets/ontology.py +310 -0
  30. ontary-0.10.0/examples/tickets/run_connector.py +69 -0
  31. ontary-0.10.0/examples/tickets/run_effects.py +62 -0
  32. ontary-0.10.0/examples/tickets/run_mcp.py +70 -0
  33. ontary-0.10.0/pyproject.toml +128 -0
  34. ontary-0.10.0/renovate.json +13 -0
  35. ontary-0.10.0/scripts/dump_store.py +200 -0
  36. ontary-0.10.0/scripts/install_smoke.py +161 -0
  37. ontary-0.10.0/scripts/scan_curve.py +391 -0
  38. ontary-0.10.0/src/ontary/__init__.py +182 -0
  39. ontary-0.10.0/src/ontary/_runtime.py +16 -0
  40. ontary-0.10.0/src/ontary/_typed_api.py +742 -0
  41. ontary-0.10.0/src/ontary/actions.py +1161 -0
  42. ontary-0.10.0/src/ontary/audit.py +187 -0
  43. ontary-0.10.0/src/ontary/authoring.py +1071 -0
  44. ontary-0.10.0/src/ontary/cli.py +497 -0
  45. ontary-0.10.0/src/ontary/client.py +916 -0
  46. ontary-0.10.0/src/ontary/connect/__init__.py +65 -0
  47. ontary-0.10.0/src/ontary/connect/base.py +91 -0
  48. ontary-0.10.0/src/ontary/connect/canonical.py +106 -0
  49. ontary-0.10.0/src/ontary/connect/dlt_source.py +107 -0
  50. ontary-0.10.0/src/ontary/connect/mapper.py +410 -0
  51. ontary-0.10.0/src/ontary/connect/mapping.py +237 -0
  52. ontary-0.10.0/src/ontary/connect/pipeline.py +68 -0
  53. ontary-0.10.0/src/ontary/declarations.py +193 -0
  54. ontary-0.10.0/src/ontary/diagnose.py +1187 -0
  55. ontary-0.10.0/src/ontary/effects.py +77 -0
  56. ontary-0.10.0/src/ontary/erase.py +121 -0
  57. ontary-0.10.0/src/ontary/errors.py +699 -0
  58. ontary-0.10.0/src/ontary/explain.py +172 -0
  59. ontary-0.10.0/src/ontary/fingerprint.py +161 -0
  60. ontary-0.10.0/src/ontary/functions.py +429 -0
  61. ontary-0.10.0/src/ontary/ingest.py +369 -0
  62. ontary-0.10.0/src/ontary/mcp_server.py +1183 -0
  63. ontary-0.10.0/src/ontary/meta.py +683 -0
  64. ontary-0.10.0/src/ontary/migrate.py +303 -0
  65. ontary-0.10.0/src/ontary/model.py +226 -0
  66. ontary-0.10.0/src/ontary/ontology.py +113 -0
  67. ontary-0.10.0/src/ontary/outbox.py +176 -0
  68. ontary-0.10.0/src/ontary/outbox_drain.py +272 -0
  69. ontary-0.10.0/src/ontary/py.typed +0 -0
  70. ontary-0.10.0/src/ontary/query.py +2140 -0
  71. ontary-0.10.0/src/ontary/scope.py +1181 -0
  72. ontary-0.10.0/src/ontary/security.py +82 -0
  73. ontary-0.10.0/src/ontary/store/__init__.py +47 -0
  74. ontary-0.10.0/src/ontary/store/_shared.py +539 -0
  75. ontary-0.10.0/src/ontary/store/_sql.py +785 -0
  76. ontary-0.10.0/src/ontary/store/errors.py +11 -0
  77. ontary-0.10.0/src/ontary/store/inmemory.py +971 -0
  78. ontary-0.10.0/src/ontary/store/migration.py +644 -0
  79. ontary-0.10.0/src/ontary/store/postgres.py +1122 -0
  80. ontary-0.10.0/src/ontary/store/protocol.py +515 -0
  81. ontary-0.10.0/src/ontary/store/schema.py +131 -0
  82. ontary-0.10.0/src/ontary/store/sqlite.py +1025 -0
  83. ontary-0.10.0/src/ontary/store/values.py +151 -0
  84. ontary-0.10.0/src/ontary/testing.py +135 -0
  85. ontary-0.10.0/src/ontary/typesys.py +123 -0
  86. ontary-0.10.0/src/ontary/upcast.py +96 -0
  87. ontary-0.10.0/tests/conftest.py +270 -0
  88. ontary-0.10.0/tests/fixtures/upgrade/v0.10.0/expected.json +583 -0
  89. ontary-0.10.0/tests/fixtures/upgrade/v0.10.0/tickets.sqlite +0 -0
  90. ontary-0.10.0/tests/fixtures/upgrade/v0.7.0/expected.json +337 -0
  91. ontary-0.10.0/tests/fixtures/upgrade/v0.7.0/tickets.sqlite +0 -0
  92. ontary-0.10.0/tests/fixtures/upgrade/v0.8.0/expected.json +337 -0
  93. ontary-0.10.0/tests/fixtures/upgrade/v0.8.0/tickets.sqlite +0 -0
  94. ontary-0.10.0/tests/fixtures/upgrade/v0.9.0/expected.json +583 -0
  95. ontary-0.10.0/tests/fixtures/upgrade/v0.9.0/tickets.sqlite +0 -0
  96. ontary-0.10.0/tests/fixtures/upgrade/writers/write_v0_10_0.py +612 -0
  97. ontary-0.10.0/tests/fixtures/upgrade/writers/write_v0_7_0.py +761 -0
  98. ontary-0.10.0/tests/fixtures/upgrade/writers/write_v0_8_0.py +737 -0
  99. ontary-0.10.0/tests/fixtures/upgrade/writers/write_v0_9_0.py +630 -0
  100. ontary-0.10.0/tests/test_actions.py +5103 -0
  101. ontary-0.10.0/tests/test_aggregate_by_shape.py +487 -0
  102. ontary-0.10.0/tests/test_audit_effects.py +25 -0
  103. ontary-0.10.0/tests/test_audit_invocation_id.py +177 -0
  104. ontary-0.10.0/tests/test_audit_principal.py +627 -0
  105. ontary-0.10.0/tests/test_authoring.py +840 -0
  106. ontary-0.10.0/tests/test_authoring_actions.py +418 -0
  107. ontary-0.10.0/tests/test_authoring_effects.py +259 -0
  108. ontary-0.10.0/tests/test_capabilities.py +366 -0
  109. ontary-0.10.0/tests/test_cli.py +492 -0
  110. ontary-0.10.0/tests/test_cli_erase.py +179 -0
  111. ontary-0.10.0/tests/test_cli_serve.py +272 -0
  112. ontary-0.10.0/tests/test_client.py +913 -0
  113. ontary-0.10.0/tests/test_connect_base.py +156 -0
  114. ontary-0.10.0/tests/test_connect_canonical.py +74 -0
  115. ontary-0.10.0/tests/test_connect_dlt.py +125 -0
  116. ontary-0.10.0/tests/test_connect_mapper.py +736 -0
  117. ontary-0.10.0/tests/test_connect_mapping.py +333 -0
  118. ontary-0.10.0/tests/test_declarations.py +830 -0
  119. ontary-0.10.0/tests/test_diagnose.py +306 -0
  120. ontary-0.10.0/tests/test_diagnose_lints.py +616 -0
  121. ontary-0.10.0/tests/test_docs.py +2430 -0
  122. ontary-0.10.0/tests/test_docs_design.py +217 -0
  123. ontary-0.10.0/tests/test_effect_outbox.py +666 -0
  124. ontary-0.10.0/tests/test_effects_dispatch.py +635 -0
  125. ontary-0.10.0/tests/test_effects_emit.py +391 -0
  126. ontary-0.10.0/tests/test_erase.py +440 -0
  127. ontary-0.10.0/tests/test_errors.py +1114 -0
  128. ontary-0.10.0/tests/test_errors_kinds.py +59 -0
  129. ontary-0.10.0/tests/test_examples_smoke.py +481 -0
  130. ontary-0.10.0/tests/test_examples_tickets_e2e.py +956 -0
  131. ontary-0.10.0/tests/test_explain.py +292 -0
  132. ontary-0.10.0/tests/test_function_audit_boundary.py +524 -0
  133. ontary-0.10.0/tests/test_functions.py +1139 -0
  134. ontary-0.10.0/tests/test_ingest.py +830 -0
  135. ontary-0.10.0/tests/test_mcp.py +1492 -0
  136. ontary-0.10.0/tests/test_mcp_multi_consumer.py +1062 -0
  137. ontary-0.10.0/tests/test_mcp_resolver_seam.py +359 -0
  138. ontary-0.10.0/tests/test_meta.py +551 -0
  139. ontary-0.10.0/tests/test_multi_tenancy.py +564 -0
  140. ontary-0.10.0/tests/test_ontology.py +249 -0
  141. ontary-0.10.0/tests/test_ontology_evolution.py +1428 -0
  142. ontary-0.10.0/tests/test_packaging.py +499 -0
  143. ontary-0.10.0/tests/test_pagination.py +1069 -0
  144. ontary-0.10.0/tests/test_providers.py +475 -0
  145. ontary-0.10.0/tests/test_query.py +4716 -0
  146. ontary-0.10.0/tests/test_read_parameter_shape.py +586 -0
  147. ontary-0.10.0/tests/test_release_workflow.py +300 -0
  148. ontary-0.10.0/tests/test_runtime.py +424 -0
  149. ontary-0.10.0/tests/test_scope.py +757 -0
  150. ontary-0.10.0/tests/test_scope_declaration_integrity.py +461 -0
  151. ontary-0.10.0/tests/test_security.py +168 -0
  152. ontary-0.10.0/tests/test_store.py +93 -0
  153. ontary-0.10.0/tests/test_store_conformance.py +4383 -0
  154. ontary-0.10.0/tests/test_store_postgres.py +332 -0
  155. ontary-0.10.0/tests/test_store_sql.py +514 -0
  156. ontary-0.10.0/tests/test_store_version.py +2121 -0
  157. ontary-0.10.0/tests/test_testing.py +229 -0
  158. ontary-0.10.0/tests/test_typed_functions.py +430 -0
  159. ontary-0.10.0/tests/test_typed_reads.py +902 -0
  160. ontary-0.10.0/tests/test_typing_surface.py +541 -0
  161. ontary-0.10.0/tests/test_upgrade_fixtures.py +455 -0
  162. ontary-0.10.0/tests/test_v1_gate_coverage.py +774 -0
  163. ontary-0.10.0/uv.lock +2569 -0
@@ -0,0 +1,64 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*']
6
+
7
+ jobs:
8
+ gate:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: astral-sh/setup-uv@v5
13
+ with:
14
+ python-version: "3.12"
15
+ enable-cache: true
16
+ - name: Check tag matches project version
17
+ run: |
18
+ tag_version="${GITHUB_REF_NAME#v}"
19
+ project_version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
20
+ if [ "$tag_version" != "$project_version" ]; then
21
+ echo "Tag version $tag_version does not match project version $project_version"
22
+ exit 1
23
+ fi
24
+ - name: Install dependencies
25
+ run: uv sync --all-extras
26
+ - name: make verify
27
+ run: make verify
28
+ - name: Build sdist + wheel
29
+ run: uv build --out-dir dist
30
+ - name: Install the wheel into an empty environment
31
+ run: |
32
+ uv venv --python 3.12 /tmp/clean
33
+ VIRTUAL_ENV=/tmp/clean uv pip install dist/*.whl
34
+ - name: Smoke-test the installed package
35
+ run: /tmp/clean/bin/python scripts/install_smoke.py
36
+ - name: Upload the distributions
37
+ uses: actions/upload-artifact@v4
38
+ with:
39
+ name: dist
40
+ path: dist/
41
+
42
+ publish:
43
+ # The only job that can reach PyPI. It holds `id-token: write` so PyPI's
44
+ # trusted publishing can mint a short-lived token from the OIDC identity of
45
+ # THIS workflow on THIS repository (registered once on PyPI, see
46
+ # docs/releasing.md "One-time setup"). No long-lived API token is stored
47
+ # anywhere. It publishes exactly the bytes `gate` built and smoke-tested;
48
+ # it never rebuilds.
49
+ needs: gate
50
+ runs-on: ubuntu-latest
51
+ environment: pypi
52
+ permissions:
53
+ id-token: write
54
+ contents: read
55
+ steps:
56
+ - name: Download the distributions
57
+ uses: actions/download-artifact@v4
58
+ with:
59
+ name: dist
60
+ path: dist/
61
+ - name: Publish the distributions to PyPI
62
+ uses: pypa/gh-action-pypi-publish@release/v1
63
+ with:
64
+ packages-dir: dist/
@@ -0,0 +1,180 @@
1
+ name: verify
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ verify:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v5
14
+ with:
15
+ python-version: "3.12"
16
+ enable-cache: true
17
+ - name: Install dependencies
18
+ run: uv sync --all-extras
19
+ - name: make verify
20
+ run: make verify
21
+
22
+ # The Postgres backend's real gate (M8a). `verify` above runs the conformance
23
+ # suite against SQLite and in-memory only, because `make verify` is defined as
24
+ # offline and no-DB and breaking that would make the gate unrunnable on a
25
+ # laptop. So the third backend gets a job with a real server: same suite, same
26
+ # assertions, one more `STORE_FACTORIES` entry. Without this, `PostgresStore`
27
+ # would be exactly the "nothing ever tested this" hole M6 found in packaging.
28
+ postgres:
29
+ runs-on: ubuntu-latest
30
+ services:
31
+ postgres:
32
+ image: postgres:16
33
+ env:
34
+ POSTGRES_PASSWORD: postgres
35
+ ports:
36
+ - 5432:5432
37
+ options: >-
38
+ --health-cmd pg_isready
39
+ --health-interval 10s
40
+ --health-timeout 5s
41
+ --health-retries 5
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: astral-sh/setup-uv@v5
45
+ with:
46
+ python-version: "3.12"
47
+ enable-cache: true
48
+ - name: Install dependencies
49
+ run: uv sync --all-extras
50
+ - name: Conformance suite + backend tests against Postgres
51
+ env:
52
+ ONTARY_TEST_POSTGRES_DSN: postgresql://postgres:postgres@localhost:5432/postgres
53
+ run: |
54
+ uv run pytest tests/test_store_conformance.py tests/test_store_postgres.py \
55
+ tests/test_multi_tenancy.py tests/test_erase.py tests/test_actions.py \
56
+ tests/test_examples_tickets_e2e.py -q
57
+
58
+ # Storage envelope curve (spec `storage-envelope.md` AC1/AC2/AC10). This
59
+ # is the PUBLISHED, reader-reproducible Postgres curve -- run on this
60
+ # fixed `postgres:16` service, not a developer machine (spec §4: "a
61
+ # laptop number is not reproducible by a reader"). It asserts no timing
62
+ # threshold and never gates the merge (L23); `continue-on-error` means
63
+ # its failure or absence is reported in this job's own log, never
64
+ # silently treated as a measured number (L30). `docs/storage.md` now
65
+ # quotes `PostgresStore` figures derived from this exact step's own CI
66
+ # runs, not a laptop: the local Homebrew 17.11 run this comment used
67
+ # to point readers at was superseded by 55ad234 during this feature's own
68
+ # development, and is kept in that section only as labelled, superseded provenance.
69
+ # Reconcile a future log against `docs/storage.md#storage-envelope`'s
70
+ # own publication rule instead: a slower worst point earns a new run
71
+ # table and lowers the published floor; anything else is recorded in
72
+ # the observed-run log there without one.
73
+ - name: Storage envelope curve (informational, non-gating)
74
+ continue-on-error: true
75
+ run: |
76
+ uv run python scripts/scan_curve.py 1000 5000 25000 --uncached \
77
+ --dsn postgresql://postgres:postgres@localhost:5432/postgres
78
+
79
+ upgrade-fixture-honesty:
80
+ runs-on: ubuntu-latest
81
+ strategy:
82
+ matrix:
83
+ tag: [v0.7.0, v0.8.0, v0.9.0, v0.10.0]
84
+ steps:
85
+ - uses: actions/checkout@v4
86
+ - name: Resolve the old ref (tag, or the PR head for the untagged current version)
87
+ id: resolve-old-ref
88
+ run: |
89
+ version=$(grep -m1 '^version = "' pyproject.toml | sed -E 's/^version = "([^"]+)"$/\1/')
90
+ if git ls-remote --tags origin "refs/tags/${{ matrix.tag }}" | grep -q .; then
91
+ echo "ref=${{ matrix.tag }}" >> "$GITHUB_OUTPUT"
92
+ echo "mode=tag" >> "$GITHUB_OUTPUT"
93
+ elif [ "${{ matrix.tag }}" = "v$version" ]; then
94
+ echo "ref=${{ github.sha }}" >> "$GITHUB_OUTPUT"
95
+ echo "mode=untagged-current" >> "$GITHUB_OUTPUT"
96
+ echo "::warning::upgrade-fixture-honesty (${{ matrix.tag }}): tag not found; running the CURRENT version's leg against the PR head ${{ github.sha }} (mode=untagged-current)"
97
+ else
98
+ echo "::error::upgrade-fixture-honesty (${{ matrix.tag }}): tag not found on origin and ${{ matrix.tag }} is not the current version (v$version); a missing tag for a non-current version is a defect, not a fallback"
99
+ exit 1
100
+ fi
101
+ - uses: actions/checkout@v4
102
+ with:
103
+ ref: ${{ steps.resolve-old-ref.outputs.ref }}
104
+ path: old
105
+ - uses: astral-sh/setup-uv@v5
106
+ with:
107
+ python-version: "3.12"
108
+ enable-cache: true
109
+ - name: Prove the old checkout is the exact tag
110
+ run: |
111
+ mode="${{ steps.resolve-old-ref.outputs.mode }}"
112
+ if [ "$mode" = "tag" ]; then
113
+ actual=$(git -C old describe --tags --exact-match)
114
+ test "$actual" = "${{ matrix.tag }}"
115
+ elif [ "$mode" = "untagged-current" ]; then
116
+ old_version=$(grep -m1 '^version = "' old/pyproject.toml | sed -E 's/^version = "([^"]+)"$/\1/')
117
+ test "v$old_version" = "${{ matrix.tag }}"
118
+ echo "::warning::upgrade-fixture-honesty (${{ matrix.tag }}): tag not found; running the CURRENT version's leg against the PR head ${{ github.sha }} (mode=untagged-current)"
119
+ else
120
+ echo "::error::upgrade-fixture-honesty (${{ matrix.tag }}): unknown mode '$mode' from the resolve step"
121
+ exit 1
122
+ fi
123
+ - name: Install the tagged package into an isolated environment
124
+ run: |
125
+ uv venv old/.venv
126
+ uv pip install --python old/.venv/bin/python ./old
127
+ - name: Save the committed fixtures before regeneration
128
+ run: |
129
+ cp "tests/fixtures/upgrade/${{ matrix.tag }}/tickets.sqlite" \
130
+ "$RUNNER_TEMP/committed-tickets.sqlite"
131
+ cp "tests/fixtures/upgrade/${{ matrix.tag }}/expected.json" \
132
+ "$RUNNER_TEMP/committed-expected.json"
133
+ - name: Regenerate with the tagged package and frozen writer
134
+ run: |
135
+ tag="${{ matrix.tag }}"
136
+ writer_version="${tag#v}"
137
+ writer_version="${writer_version//./_}"
138
+ PYTHONPATH="$PWD/old" old/.venv/bin/python \
139
+ "tests/fixtures/upgrade/writers/write_v${writer_version}.py"
140
+ - name: Compare regenerated fixtures with committed fixtures
141
+ run: |
142
+ uv run python scripts/dump_store.py \
143
+ "tests/fixtures/upgrade/${{ matrix.tag }}/tickets.sqlite" \
144
+ > "$RUNNER_TEMP/regenerated-store.json"
145
+ uv run python scripts/dump_store.py "$RUNNER_TEMP/committed-tickets.sqlite" \
146
+ > "$RUNNER_TEMP/committed-store.json"
147
+ diff -u "$RUNNER_TEMP/committed-store.json" \
148
+ "$RUNNER_TEMP/regenerated-store.json"
149
+ diff -u "$RUNNER_TEMP/committed-expected.json" \
150
+ "tests/fixtures/upgrade/${{ matrix.tag }}/expected.json"
151
+
152
+ # The check that had never existed (M6 step 3). `verify` above runs from the
153
+ # source tree with every extra installed -- precisely the environment an
154
+ # outside adopter does NOT have. Their first command is
155
+ # `pip install ontary`, and nothing verified that path until a manual
156
+ # clean-venv install turned up `ontary-mcp` dying on a bare
157
+ # `ModuleNotFoundError`. Deliberately NO extras and no dev dependencies here:
158
+ # installing pytest would defeat the point, which is why the smoke test is a
159
+ # plain script rather than a test module.
160
+ package:
161
+ runs-on: ubuntu-latest
162
+ steps:
163
+ - uses: actions/checkout@v4
164
+ - uses: astral-sh/setup-uv@v5
165
+ with:
166
+ python-version: "3.12"
167
+ enable-cache: true
168
+ - name: Build sdist + wheel
169
+ run: uv build --out-dir dist
170
+ - name: Install the wheel into an empty environment
171
+ run: |
172
+ uv venv --python 3.12 /tmp/clean
173
+ VIRTUAL_ENV=/tmp/clean uv pip install dist/*.whl
174
+ - name: Smoke-test the installed package
175
+ run: /tmp/clean/bin/python scripts/install_smoke.py
176
+ - name: Upload the distributions
177
+ uses: actions/upload-artifact@v4
178
+ with:
179
+ name: dist
180
+ path: dist/
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ .pytest_cache/
7
+ *.db
8
+ .DS_Store
9
+ uv.lock.bak