You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the Python binding package for the Cognitive Nexus 0.8 release.
- bump anda_cognitive_nexus_py to 0.3.0 and depend on 0.8 Rust crates
- add an idempotent async close API for flushing file-backed stores
- convert Python KIP parameters directly into JSON-compatible values
- return ValueError for unsupported parameters instead of panicking
- add PyO3 extension-module link args and a release-py wheel profile
- point maturin at the binding crate manifest and refresh README examples
- cover invalid parameters, nested parameters, and close idempotency
- document the Python binding changes in the 0.8.0 changelog
Co-Authored-By: Anda Bot <noreply@anda.bot>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,14 @@ All notable changes to this workspace are documented in this file.
10
10
-**KIP recall and portability commands** — Extended `SEARCH` with retrieval modes (`keyword`, `semantic`, `hybrid`) and score thresholds, and added `EXPORT` for serializing matched knowledge into idempotent UPSERT capsules.
11
11
-**Commitment capsule** — Added the `Commitment.kip` capsule and updated built-in capsule metadata so agents can model durable commitments alongside events and people.
12
12
-**Cognitive Nexus KIP execution coverage** — Implemented KML/KQL/META support for the expanded KIP surface, including update execution, merge handling, search scoring, export generation, and version-conflict reporting.
13
-
-**Regression coverage for KIP and Cognitive Nexus behavior** — Added parser and executor tests for optimistic concurrency, update expressions, merge semantics, search modes, export capsules, and the split database implementation.
13
+
-**Python binding close API** — Added an idempotent async `PyAndaDB.close()` method so Python clients can explicitly flush and close file-backed Cognitive Nexus stores.
14
+
-**Regression coverage for KIP, Cognitive Nexus, and Python binding behavior** — Added parser, executor, and Python tests for optimistic concurrency, update expressions, merge semantics, search modes, export capsules, split database behavior, parameter conversion failures, nested parameters, and close idempotency.
14
15
15
16
### Changed
16
17
17
18
-**Workspace crates moved to the 0.8 line** — Bumped `anda_db`, `anda_kip`, and `anda_cognitive_nexus` to `0.8.0`, and updated dependent workspace crates to require the matching `0.8` APIs.
19
+
-**Python binding moved to the 0.3 line** — Bumped `anda_cognitive_nexus_py` to `0.3.0`, updated it to depend on the `0.8` Rust crates, and switched the Python package metadata to derive its version from the binding crate manifest.
20
+
-**Python wheel build profile clarified** — Added a `release-py` profile for PyO3 extension wheels and pointed maturin at the binding crate manifest.
18
21
-**Cognitive Nexus database implementation split by responsibility** — Replaced the monolithic `db.rs` with focused modules for KML execution, KQL execution, proposition matching, META commands, shared database setup, and tests.
19
22
-**KIP specification and tool schemas refreshed** — Updated the specification, syntax guide, self/system instructions, and function definition JSON files to describe the RC KIP semantics and the new read/write command set.
20
23
-**System metadata semantics clarified** — Documented reserved engine-maintained `_` metadata fields, versioning behavior, and protected-scope constraints for write operations.
@@ -23,3 +26,5 @@ All notable changes to this workspace are documented in this file.
23
26
24
27
-**Safer endpoint matching syntax** — Tightened embedded endpoint clause handling so nested concept/proposition endpoints remain unnamed, with explicit guidance for binding endpoints through separate clauses.
25
28
-**More robust query and mutation behavior** — Hardened Cognitive Nexus helper/type paths around KIP execution, protected scopes, cache invalidation, and proposition matching while preserving concurrent read and exclusive write semantics.
29
+
-**Safer Python parameter handling** — Replaced panic-prone JSON string round-tripping with direct JSON-compatible Python value conversion and clear `ValueError` failures for unsupported values, non-finite floats, non-string keys, and excessive nesting.
30
+
-**Python extension import/build robustness** — Made logger initialization non-fatal when a host process already installed a logger, added PyO3 macOS extension link arguments, and documented the correct module import path in the Python README.
After this step, the `anda` module is available to be imported in any Python script run from this activated environment.
59
+
After this step, the `anda_cognitive_nexus_py` module is available to be imported in any Python script run from this activated environment.
60
+
61
+
To build a release wheel, use the `release-py` profile so panics unwind into
62
+
Python exceptions instead of aborting the interpreter:
63
+
64
+
```bash
65
+
maturin build --profile release-py
66
+
```
60
67
61
68
## Running Tests
62
69
@@ -85,7 +92,7 @@ To quickly verify your setup, you can run the following Python script:
85
92
86
93
```python
87
94
# main.py
88
-
import anda
95
+
importanda_cognitive_nexus_py asanda
89
96
90
97
# This is the "hello world" function currently implemented
91
98
result = anda.sum_as_string(10, 20)
@@ -111,7 +118,7 @@ python main.py
111
118
The API now exposes configuration and enums as Python classes, not dicts or strings. Construct configs using `AndaDbConfig` and `StoreLocationType` directly:
112
119
113
120
```python
114
-
import anda
121
+
importanda_cognitive_nexus_py asanda
115
122
116
123
# Construct the config using Python classes (not dicts)
117
124
config = anda.AndaDbConfig(
@@ -126,9 +133,16 @@ config = anda.AndaDbConfig(
126
133
import asyncio
127
134
asyncdefmain():
128
135
db =await anda.PyAndaDB.create(config)
129
-
# Execute a KIP command (async)
130
-
result =await db.execute_kip("KIP_COMMAND_STRING")
131
-
print(result) # result is a Python dict, not a JSON string
136
+
try:
137
+
# Execute a KIP command (async), optionally with :name parameters
138
+
result =await db.execute_kip(
139
+
"FIND(?t.name) WHERE { ?t {type: :t} } LIMIT 10",
140
+
parameters={"t": "$ConceptType"},
141
+
)
142
+
print(result) # result is a Python dict, not a JSON string
143
+
finally:
144
+
# Flush pending data to storage; required for file-backed stores.
0 commit comments