necoherence 0.2.2__tar.gz → 0.3.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.
- necoherence-0.3.0/.gitignore +63 -0
- necoherence-0.3.0/PKG-INFO +135 -0
- necoherence-0.3.0/README.md +115 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/pyproject.toml +14 -5
- necoherence-0.3.0/src/necoherence/__init__.py +934 -0
- necoherence-0.3.0/src/necoherence/composition_wire_base.py +268 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/core.py +71 -16
- necoherence-0.3.0/src/necoherence/declaration_wire.py +149 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/dynamic_admission.py +171 -62
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/files.py +179 -30
- necoherence-0.3.0/src/necoherence/library_check.py +92 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/network_effect.py +188 -191
- necoherence-0.3.0/src/necoherence/persistent.py +378 -0
- necoherence-0.3.0/src/necoherence/profile_wire.py +124 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/reconcile.py +17 -27
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/record.py +1 -1
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/request_progression.py +319 -63
- necoherence-0.3.0/src/necoherence/semantic_composition.py +1977 -0
- necoherence-0.3.0/src/necoherence/semantic_empty_types.py +135 -0
- necoherence-0.3.0/src/necoherence/semantic_execution.py +760 -0
- necoherence-0.3.0/src/necoherence/semantic_graph_wire.py +52 -0
- necoherence-0.3.0/src/necoherence/semantic_identity.py +45 -0
- necoherence-0.3.0/src/necoherence/semantic_residual_record.py +73 -0
- necoherence-0.3.0/src/necoherence/signature_composition_wire.py +896 -0
- necoherence-0.3.0/src/necoherence/signature_support.py +110 -0
- necoherence-0.3.0/src/necoherence/signature_values.py +2370 -0
- necoherence-0.3.0/src/necoherence/store.py +138 -0
- necoherence-0.3.0/src/necoherence/type_signatures.py +979 -0
- necoherence-0.3.0/src/necoherence/typed_mapping.py +391 -0
- necoherence-0.3.0/src/necoherence/wire_schema.py +165 -0
- necoherence-0.3.0/tests/composition_fixtures.py +216 -0
- necoherence-0.3.0/tests/composition_problem_encoding.py +230 -0
- necoherence-0.3.0/tests/fixtures/variant-guard-incomplete-coverage.json +1 -0
- necoherence-0.3.0/tests/test_composition_identity_encoding.py +10 -0
- necoherence-0.3.0/tests/test_composition_json_equal_numbers.py +43 -0
- necoherence-0.3.0/tests/test_composition_lean_get_fields.py +178 -0
- necoherence-0.3.0/tests/test_composition_lean_wire_paths.py +140 -0
- necoherence-0.3.0/tests/test_composition_record_keys.py +116 -0
- necoherence-0.3.0/tests/test_composition_wire_decode_vectors.py +111 -0
- necoherence-0.3.0/tests/test_composition_wire_meaning.py +41 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_core.py +59 -10
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_default_materialization.py +65 -9
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_dynamic_admission.py +81 -28
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_examples.py +7 -1
- necoherence-0.3.0/tests/test_exchange_json_stage.py +66 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_files.py +41 -34
- necoherence-0.3.0/tests/test_format_rule_inclusion.py +271 -0
- necoherence-0.3.0/tests/test_json_number_exponent.py +96 -0
- necoherence-0.3.0/tests/test_lazy_exports.py +45 -0
- necoherence-0.3.0/tests/test_lean_alignment.py +223 -0
- necoherence-0.3.0/tests/test_lean_canonical_string_vectors.py +130 -0
- necoherence-0.3.0/tests/test_lean_recognition_vectors.py +362 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_lean_value_decisions.py +50 -23
- necoherence-0.3.0/tests/test_nested_json_depth.py +112 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_network_effect.py +92 -47
- necoherence-0.3.0/tests/test_network_effect_invariants.py +142 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_network_effect_progression.py +9 -9
- necoherence-0.3.0/tests/test_persistent.py +122 -0
- necoherence-0.3.0/tests/test_prepared_value_context.py +220 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_profile_artifact_admission.py +25 -0
- necoherence-0.3.0/tests/test_profile_declaration_wire_types.py +273 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_profile_predicate_vectors.py +219 -9
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_profile_wire_vectors.py +47 -2
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_reconcile.py +4 -4
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_recursive_values.py +8 -6
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_representation_acceptance.py +5 -3
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_request_progression.py +46 -11
- necoherence-0.3.0/tests/test_request_progression_invariants.py +234 -0
- necoherence-0.3.0/tests/test_semantic_composition.py +342 -0
- necoherence-0.3.0/tests/test_semantic_discriminator.py +18 -0
- necoherence-0.3.0/tests/test_semantic_execution.py +455 -0
- necoherence-0.3.0/tests/test_semantic_graph_wire.py +99 -0
- necoherence-0.3.0/tests/test_semantic_grapheme.py +61 -0
- necoherence-0.3.0/tests/test_semantic_residual_record.py +119 -0
- necoherence-0.3.0/tests/test_signature_support.py +47 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_store.py +35 -2
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_type_signatures.py +90 -37
- necoherence-0.3.0/tests/test_value_type_children.py +45 -0
- necoherence-0.3.0/tests/test_value_validation.py +357 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_wrapper_base64_vectors.py +33 -24
- necoherence-0.3.0/tests/test_wrapper_text_acceptance.py +43 -0
- necoherence-0.2.2/.gitignore +0 -58
- necoherence-0.2.2/PKG-INFO +0 -82
- necoherence-0.2.2/README-ja.md +0 -66
- necoherence-0.2.2/README.md +0 -66
- necoherence-0.2.2/src/necoherence/__init__.py +0 -479
- necoherence-0.2.2/src/necoherence/signature_support.py +0 -89
- necoherence-0.2.2/src/necoherence/signature_values.py +0 -1309
- necoherence-0.2.2/src/necoherence/store.py +0 -102
- necoherence-0.2.2/src/necoherence/type_signatures.py +0 -714
- necoherence-0.2.2/tests/test_format_rule_inclusion.py +0 -185
- necoherence-0.2.2/tests/test_mutation_detection.py +0 -142
- necoherence-0.2.2/tests/test_semantic_discriminator.py +0 -15
- necoherence-0.2.2/tests/test_semantic_grapheme.py +0 -32
- {necoherence-0.2.2 → necoherence-0.3.0}/LICENSE +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/examples/01_fold_arithmetic.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/examples/02_recurse_gcd.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/examples/03_closure_reachability.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/call.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/iteration.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/src/necoherence/transition.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_call.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_iteration.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_record.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/test_transition.py +0 -0
- {necoherence-0.2.2 → necoherence-0.3.0}/tests/v4_samples.py +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 barineco
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.egg-info/
|
|
6
|
+
.venv/
|
|
7
|
+
packages/lean/.lake
|
|
8
|
+
packages/rust/adapter/target/
|
|
9
|
+
packages/rust/adapter/http/target/
|
|
10
|
+
packages/typescript/adapter/node_modules/
|
|
11
|
+
packages/typescript/adapter/dist/
|
|
12
|
+
packages/typescript/adapter/.package-consumer/
|
|
13
|
+
packages/typescript/adapter/*.tgz
|
|
14
|
+
packages/python/adapter/dist/
|
|
15
|
+
packages/python/adapter/http/dist/
|
|
16
|
+
packages/python/adapter/http/.clean-install*/
|
|
17
|
+
packages/python/adapter/http/.pytest_cache/
|
|
18
|
+
packages/python/adapter/http/.mypy_cache/
|
|
19
|
+
packages/typescript/adapter/http/node_modules/
|
|
20
|
+
packages/typescript/adapter/http/dist/
|
|
21
|
+
packages/typescript/adapter/http/*.tgz
|
|
22
|
+
packages/typescript/adapter/http/.package-consumer/
|
|
23
|
+
packages/java/adapter/http/build/
|
|
24
|
+
packages/gleam/adapter/http/build
|
|
25
|
+
packages/gleam/adapter/http/*.tar
|
|
26
|
+
packages/python/adapter/.clean-install*/
|
|
27
|
+
packages/python/adapter/.verify-*/
|
|
28
|
+
packages/java/adapter/build/
|
|
29
|
+
packages/java/adapter/lib/
|
|
30
|
+
packages/gleam/adapter/build
|
|
31
|
+
packages/gleam/adapter/*.tar
|
|
32
|
+
generator/lean/.lake
|
|
33
|
+
generator/rust/target/
|
|
34
|
+
solver/lean/.lake
|
|
35
|
+
solver/rust/target/
|
|
36
|
+
solver/verification/gleam_driver/build
|
|
37
|
+
solver/composition/lean/.lake
|
|
38
|
+
solver/composition/rust/target/
|
|
39
|
+
verification/lean/.lake
|
|
40
|
+
residual-coherence/lean/.lake
|
|
41
|
+
verification/rust/target/
|
|
42
|
+
verification/network_effect/gleam_driver/build
|
|
43
|
+
verification/network_effect/java_driver/classes/
|
|
44
|
+
verification/network_effect/rust_driver/target/
|
|
45
|
+
verification/execution/gleam_driver/build
|
|
46
|
+
verification/execution/generated-packages/
|
|
47
|
+
verification/execution/rust_driver/target
|
|
48
|
+
solver/composition/verification/rust_driver/target
|
|
49
|
+
verification/declaration/gleam_driver/build
|
|
50
|
+
verification/declaration/signature_admission/gleam/build
|
|
51
|
+
verification/declaration/default_materialization_gleam/build
|
|
52
|
+
verification/declaration/rust_driver/target
|
|
53
|
+
verification/shared_operations/gleam_driver/build
|
|
54
|
+
verification/shared_operations/gleam_cost/build
|
|
55
|
+
verification/shared_operations/lean_driver/.lake
|
|
56
|
+
verification/shared_operations/rust_driver/target/
|
|
57
|
+
residual-coherence/dist/
|
|
58
|
+
residual-coherence/*.egg-info/
|
|
59
|
+
residual-coherence/.clean-install*/
|
|
60
|
+
residual-coherence/.pytest_cache/
|
|
61
|
+
residual-coherence/.mypy_cache/
|
|
62
|
+
|
|
63
|
+
*.profraw
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: necoherence
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Revision-aware state transition utilities for Python
|
|
5
|
+
Project-URL: Homepage, https://github.com/barineco/necoherence
|
|
6
|
+
Project-URL: Repository, https://github.com/barineco/necoherence
|
|
7
|
+
Project-URL: Issues, https://github.com/barineco/necoherence/issues
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.14
|
|
11
|
+
Requires-Dist: neco-quotient-application==0.1.0
|
|
12
|
+
Requires-Dist: neco-quotient-certificate==0.2.0
|
|
13
|
+
Requires-Dist: neco-quotient-encoding==0.1.0
|
|
14
|
+
Requires-Dist: neco-quotient-retention==0.1.0
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: hypothesis; extra == 'dev'
|
|
17
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
18
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Necoherence (Python)
|
|
22
|
+
|
|
23
|
+
[プロジェクトの概要](../../../README.md)
|
|
24
|
+
|
|
25
|
+
このパッケージは、Necoherence の Python 実装です。
|
|
26
|
+
|
|
27
|
+
- Python 3.14 以降
|
|
28
|
+
|
|
29
|
+
実行時の依存関係は次の 4 パッケージです。
|
|
30
|
+
|
|
31
|
+
- `neco-quotient-certificate`
|
|
32
|
+
- `neco-quotient-application`
|
|
33
|
+
- `neco-quotient-retention`
|
|
34
|
+
- `neco-quotient-encoding`
|
|
35
|
+
|
|
36
|
+
## 検証結果
|
|
37
|
+
|
|
38
|
+
値の検証結果は、「確定」「残余」「停止」「失敗」に分類されます。分類の判定順序については [docs/terminology.md](../../../docs/terminology.md#確定残余停止失敗) を参照してください。本実装では、次の関数で結果を分類します。
|
|
39
|
+
|
|
40
|
+
- `signature_values.classify_semantic_obligations`: 値の検証で未解決となった理由の分類
|
|
41
|
+
- `signature_support.classify_unresolved_obligations`: 合成処理で未解決となった理由の分類
|
|
42
|
+
|
|
43
|
+
## データモデル宣言
|
|
44
|
+
|
|
45
|
+
仕様と照合の条件については、[docs/data-model.md](../../../docs/data-model.md) を参照してください。
|
|
46
|
+
|
|
47
|
+
期待するデータモデル宣言の参照識別子、出典、信頼できるバイト列は、入力バイト列とは独立した引数として渡します。
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from necoherence.type_signatures import (
|
|
51
|
+
ExpectedSignatureBasis,
|
|
52
|
+
admit_signature_generation,
|
|
53
|
+
decode_profile_artifact,
|
|
54
|
+
signature_basis,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def decide(expected, sources, trusted, input_bytes, library, entrypoints, type_id, value):
|
|
58
|
+
profile = decode_profile_artifact(expected, sources, trusted, input_bytes)
|
|
59
|
+
signatures = {**library, "profile": profile}
|
|
60
|
+
basis = signature_basis(signatures, entrypoints)
|
|
61
|
+
exchange = {
|
|
62
|
+
"schema": "ncoh-checked-generation@5",
|
|
63
|
+
"basis": basis,
|
|
64
|
+
"signatures": signatures,
|
|
65
|
+
"composition": None,
|
|
66
|
+
"entrypoints": entrypoints,
|
|
67
|
+
}
|
|
68
|
+
checked = admit_signature_generation(ExpectedSignatureBasis(basis, None), exchange)
|
|
69
|
+
return checked.values.validate(type_id, value)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
主なエラー型とその要因:
|
|
73
|
+
|
|
74
|
+
- `WireFailure`: データモデル宣言のワイヤ転送形式が不正
|
|
75
|
+
- `DeclarationFailure`: データモデル宣言またはライブラリが宣言規則に違反している
|
|
76
|
+
- `AdmissionFailure`: データモデル宣言の参照や出典が期待値と不一致
|
|
77
|
+
- `MeaningFailure`: 型の解釈に必要な定義がデータモデル宣言に不足している
|
|
78
|
+
- `ValueFailure`: 値が型制約の検証で拒否された
|
|
79
|
+
|
|
80
|
+
## その他の機能
|
|
81
|
+
|
|
82
|
+
[プロジェクトの概要](../../../README.md) に記載の機能に加え、次の機能を提供します。
|
|
83
|
+
|
|
84
|
+
- 宣言の検証: 識別子の重複や未定義の型・定義への参照など、型や操作の宣言エラーを静的に検出
|
|
85
|
+
- 生成コード用ランタイム: 生成された Python コードが実行時に呼び出す、値検証およびコーデックの共通処理
|
|
86
|
+
|
|
87
|
+
ネットワーク副作用コマンドを HTTP 経由で実行する場合は、[`http/`](http/) の HTTP アダプターを使用します。
|
|
88
|
+
|
|
89
|
+
## コード生成の受け入れ
|
|
90
|
+
|
|
91
|
+
形式 `ncoh-checked-generation@5` の JSON を受け入れる関数:
|
|
92
|
+
|
|
93
|
+
- `basis` の計算: `necoherence.type_signatures.signature_basis`
|
|
94
|
+
- 受け入れ検証: `necoherence.type_signatures.admit_signature_generation`
|
|
95
|
+
|
|
96
|
+
生成識別値 `basis` と受け入れ検証の規則は [docs/generation.md](../../../docs/generation.md) を参照してください。
|
|
97
|
+
|
|
98
|
+
## 残余の書き出し
|
|
99
|
+
|
|
100
|
+
関数 `necoherence.semantic_residual_record.encode_semantic_residual` は、値の検証が返した未解決の義務を、`neco-quotient` の正規のバイト列として書き出します。引数として生成の `basis`、型の参照、値、義務の列を受け取ります。記録は `schema`、`basis`、入力、義務の列の 4 つのフィールドを持ち、各フィールドの通信形式は既存の宣言の通信形式と同じです。義務の列は順序と重複によらず同じバイト列になります。
|
|
101
|
+
|
|
102
|
+
符号化の失敗時は、`neco-quotient` の失敗情報を含む `SemanticResidualFailure` 例外が発生します。
|
|
103
|
+
|
|
104
|
+
## 合成の実行
|
|
105
|
+
|
|
106
|
+
検証を通過した合成を実行する関数:
|
|
107
|
+
|
|
108
|
+
- 実行の開始: `necoherence.semantic_execution.start`
|
|
109
|
+
- 実行の再開: `necoherence.semantic_execution.resume`
|
|
110
|
+
|
|
111
|
+
実行の開始には `AdmittedComposition` を渡します。これは受け入れ検証の結果 ( `CheckedSignatureGeneration` ) の `admitted_composition` から取得します。
|
|
112
|
+
|
|
113
|
+
実行の入力、関数の実装、進捗状態の意味は [docs/composition.md](../../../docs/composition.md#合成の実行) を参照してください。
|
|
114
|
+
|
|
115
|
+
## 付属のツール
|
|
116
|
+
|
|
117
|
+
型と操作の宣言から Python の型定義とコーデックを生成するコード生成ツールは、[generator/](../../../generator/) 配下にあります。ライセンスは AGPL-3.0-only です。
|
|
118
|
+
|
|
119
|
+
## 使用例
|
|
120
|
+
|
|
121
|
+
具体的な使用例は [examples/](examples/) にあります。
|
|
122
|
+
|
|
123
|
+
## 開発時
|
|
124
|
+
|
|
125
|
+
次のコマンドでテストおよび型検査を実行できます。
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
python3 -m pip install ".[dev]"
|
|
129
|
+
python3 -m pytest -q
|
|
130
|
+
python3 -m mypy src tests
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## ライセンス
|
|
134
|
+
|
|
135
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Necoherence (Python)
|
|
2
|
+
|
|
3
|
+
[プロジェクトの概要](../../../README.md)
|
|
4
|
+
|
|
5
|
+
このパッケージは、Necoherence の Python 実装です。
|
|
6
|
+
|
|
7
|
+
- Python 3.14 以降
|
|
8
|
+
|
|
9
|
+
実行時の依存関係は次の 4 パッケージです。
|
|
10
|
+
|
|
11
|
+
- `neco-quotient-certificate`
|
|
12
|
+
- `neco-quotient-application`
|
|
13
|
+
- `neco-quotient-retention`
|
|
14
|
+
- `neco-quotient-encoding`
|
|
15
|
+
|
|
16
|
+
## 検証結果
|
|
17
|
+
|
|
18
|
+
値の検証結果は、「確定」「残余」「停止」「失敗」に分類されます。分類の判定順序については [docs/terminology.md](../../../docs/terminology.md#確定残余停止失敗) を参照してください。本実装では、次の関数で結果を分類します。
|
|
19
|
+
|
|
20
|
+
- `signature_values.classify_semantic_obligations`: 値の検証で未解決となった理由の分類
|
|
21
|
+
- `signature_support.classify_unresolved_obligations`: 合成処理で未解決となった理由の分類
|
|
22
|
+
|
|
23
|
+
## データモデル宣言
|
|
24
|
+
|
|
25
|
+
仕様と照合の条件については、[docs/data-model.md](../../../docs/data-model.md) を参照してください。
|
|
26
|
+
|
|
27
|
+
期待するデータモデル宣言の参照識別子、出典、信頼できるバイト列は、入力バイト列とは独立した引数として渡します。
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from necoherence.type_signatures import (
|
|
31
|
+
ExpectedSignatureBasis,
|
|
32
|
+
admit_signature_generation,
|
|
33
|
+
decode_profile_artifact,
|
|
34
|
+
signature_basis,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def decide(expected, sources, trusted, input_bytes, library, entrypoints, type_id, value):
|
|
38
|
+
profile = decode_profile_artifact(expected, sources, trusted, input_bytes)
|
|
39
|
+
signatures = {**library, "profile": profile}
|
|
40
|
+
basis = signature_basis(signatures, entrypoints)
|
|
41
|
+
exchange = {
|
|
42
|
+
"schema": "ncoh-checked-generation@5",
|
|
43
|
+
"basis": basis,
|
|
44
|
+
"signatures": signatures,
|
|
45
|
+
"composition": None,
|
|
46
|
+
"entrypoints": entrypoints,
|
|
47
|
+
}
|
|
48
|
+
checked = admit_signature_generation(ExpectedSignatureBasis(basis, None), exchange)
|
|
49
|
+
return checked.values.validate(type_id, value)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
主なエラー型とその要因:
|
|
53
|
+
|
|
54
|
+
- `WireFailure`: データモデル宣言のワイヤ転送形式が不正
|
|
55
|
+
- `DeclarationFailure`: データモデル宣言またはライブラリが宣言規則に違反している
|
|
56
|
+
- `AdmissionFailure`: データモデル宣言の参照や出典が期待値と不一致
|
|
57
|
+
- `MeaningFailure`: 型の解釈に必要な定義がデータモデル宣言に不足している
|
|
58
|
+
- `ValueFailure`: 値が型制約の検証で拒否された
|
|
59
|
+
|
|
60
|
+
## その他の機能
|
|
61
|
+
|
|
62
|
+
[プロジェクトの概要](../../../README.md) に記載の機能に加え、次の機能を提供します。
|
|
63
|
+
|
|
64
|
+
- 宣言の検証: 識別子の重複や未定義の型・定義への参照など、型や操作の宣言エラーを静的に検出
|
|
65
|
+
- 生成コード用ランタイム: 生成された Python コードが実行時に呼び出す、値検証およびコーデックの共通処理
|
|
66
|
+
|
|
67
|
+
ネットワーク副作用コマンドを HTTP 経由で実行する場合は、[`http/`](http/) の HTTP アダプターを使用します。
|
|
68
|
+
|
|
69
|
+
## コード生成の受け入れ
|
|
70
|
+
|
|
71
|
+
形式 `ncoh-checked-generation@5` の JSON を受け入れる関数:
|
|
72
|
+
|
|
73
|
+
- `basis` の計算: `necoherence.type_signatures.signature_basis`
|
|
74
|
+
- 受け入れ検証: `necoherence.type_signatures.admit_signature_generation`
|
|
75
|
+
|
|
76
|
+
生成識別値 `basis` と受け入れ検証の規則は [docs/generation.md](../../../docs/generation.md) を参照してください。
|
|
77
|
+
|
|
78
|
+
## 残余の書き出し
|
|
79
|
+
|
|
80
|
+
関数 `necoherence.semantic_residual_record.encode_semantic_residual` は、値の検証が返した未解決の義務を、`neco-quotient` の正規のバイト列として書き出します。引数として生成の `basis`、型の参照、値、義務の列を受け取ります。記録は `schema`、`basis`、入力、義務の列の 4 つのフィールドを持ち、各フィールドの通信形式は既存の宣言の通信形式と同じです。義務の列は順序と重複によらず同じバイト列になります。
|
|
81
|
+
|
|
82
|
+
符号化の失敗時は、`neco-quotient` の失敗情報を含む `SemanticResidualFailure` 例外が発生します。
|
|
83
|
+
|
|
84
|
+
## 合成の実行
|
|
85
|
+
|
|
86
|
+
検証を通過した合成を実行する関数:
|
|
87
|
+
|
|
88
|
+
- 実行の開始: `necoherence.semantic_execution.start`
|
|
89
|
+
- 実行の再開: `necoherence.semantic_execution.resume`
|
|
90
|
+
|
|
91
|
+
実行の開始には `AdmittedComposition` を渡します。これは受け入れ検証の結果 ( `CheckedSignatureGeneration` ) の `admitted_composition` から取得します。
|
|
92
|
+
|
|
93
|
+
実行の入力、関数の実装、進捗状態の意味は [docs/composition.md](../../../docs/composition.md#合成の実行) を参照してください。
|
|
94
|
+
|
|
95
|
+
## 付属のツール
|
|
96
|
+
|
|
97
|
+
型と操作の宣言から Python の型定義とコーデックを生成するコード生成ツールは、[generator/](../../../generator/) 配下にあります。ライセンスは AGPL-3.0-only です。
|
|
98
|
+
|
|
99
|
+
## 使用例
|
|
100
|
+
|
|
101
|
+
具体的な使用例は [examples/](examples/) にあります。
|
|
102
|
+
|
|
103
|
+
## 開発時
|
|
104
|
+
|
|
105
|
+
次のコマンドでテストおよび型検査を実行できます。
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
python3 -m pip install ".[dev]"
|
|
109
|
+
python3 -m pytest -q
|
|
110
|
+
python3 -m mypy src tests
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## ライセンス
|
|
114
|
+
|
|
115
|
+
[MIT](LICENSE)
|
|
@@ -7,13 +7,18 @@ build-backend = "hatchling.build"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "necoherence"
|
|
10
|
-
version = "0.
|
|
10
|
+
version = "0.3.0"
|
|
11
11
|
description = "Revision-aware state transition utilities for Python"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
license = "MIT"
|
|
14
14
|
license-files = ["LICENSE"]
|
|
15
|
-
requires-python = ">=3.
|
|
16
|
-
dependencies = [
|
|
15
|
+
requires-python = ">=3.14"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"neco-quotient-certificate==0.2.0",
|
|
18
|
+
"neco-quotient-application==0.1.0",
|
|
19
|
+
"neco-quotient-retention==0.1.0",
|
|
20
|
+
"neco-quotient-encoding==0.1.0",
|
|
21
|
+
]
|
|
17
22
|
|
|
18
23
|
[project.urls]
|
|
19
24
|
Homepage = "https://github.com/barineco/necoherence"
|
|
@@ -28,13 +33,17 @@ packages = ["src/necoherence"]
|
|
|
28
33
|
|
|
29
34
|
[tool.hatch.build.targets.wheel.force-include]
|
|
30
35
|
"README.md" = "necoherence/README.md"
|
|
31
|
-
"README-ja.md" = "necoherence/README-ja.md"
|
|
32
36
|
|
|
33
37
|
[tool.hatch.build.targets.sdist]
|
|
34
|
-
include = ["src/necoherence", "tests", "examples", "README.md", "
|
|
38
|
+
include = ["/src/necoherence", "/tests", "/examples", "/README.md", "/LICENSE", "/pyproject.toml"]
|
|
35
39
|
|
|
36
40
|
[tool.pytest.ini_options]
|
|
37
41
|
pythonpath = ["src"]
|
|
42
|
+
testpaths = ["tests"]
|
|
38
43
|
|
|
39
44
|
[tool.mypy]
|
|
40
45
|
mypy_path = "src"
|
|
46
|
+
|
|
47
|
+
[[tool.mypy.overrides]]
|
|
48
|
+
module = ["neco_quotient_certificate", "neco_quotient_certificate.*", "neco_quotient_application", "neco_quotient_application.*", "neco_quotient_retention", "neco_quotient_retention.*", "neco_quotient_encoding", "neco_quotient_encoding.*"]
|
|
49
|
+
ignore_missing_imports = true
|