erinys-memory 0.5.1__py3-none-any.whl
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.
- erinys_memory/__init__.py +2 -0
- erinys_memory/_sqlite.py +50 -0
- erinys_memory/cli.py +982 -0
- erinys_memory/collider.py +379 -0
- erinys_memory/config.py +66 -0
- erinys_memory/db.py +409 -0
- erinys_memory/decay.py +38 -0
- erinys_memory/distill.py +502 -0
- erinys_memory/embedding.py +43 -0
- erinys_memory/graph.py +257 -0
- erinys_memory/policy.py +234 -0
- erinys_memory/preference_extract.py +119 -0
- erinys_memory/provenance.py +42 -0
- erinys_memory/schema.sql +231 -0
- erinys_memory/search.py +1080 -0
- erinys_memory/server.py +1484 -0
- erinys_memory/session.py +217 -0
- erinys_memory/temporal.py +304 -0
- erinys_memory-0.5.1.dist-info/METADATA +214 -0
- erinys_memory-0.5.1.dist-info/RECORD +23 -0
- erinys_memory-0.5.1.dist-info/WHEEL +4 -0
- erinys_memory-0.5.1.dist-info/entry_points.txt +3 -0
- erinys_memory-0.5.1.dist-info/licenses/LICENSE +21 -0
erinys_memory/_sqlite.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Central sqlite3 implementation selector.
|
|
2
|
+
|
|
3
|
+
sqlite-vec (ERINYS's vector index) needs ``Connection.enable_load_extension``.
|
|
4
|
+
CPython ships that method disabled on some builds — macOS system Python and
|
|
5
|
+
pyenv built without ``--enable-loadable-sqlite-extensions`` are the common
|
|
6
|
+
offenders, while python.org / Homebrew / conda / GitHub Actions builds all
|
|
7
|
+
enable it.
|
|
8
|
+
|
|
9
|
+
**Import ``sqlite3`` from this module** (``from ._sqlite import sqlite3``) rather
|
|
10
|
+
than the standard library directly. Doing so guarantees every module shares one
|
|
11
|
+
implementation, so exception classes (``IntegrityError``, ``OperationalError``,
|
|
12
|
+
...) are identical across the codebase. If db.py used ``pysqlite3`` while other
|
|
13
|
+
modules caught ``stdlib sqlite3`` errors, those ``except`` clauses would silently
|
|
14
|
+
miss real failures.
|
|
15
|
+
|
|
16
|
+
Selection order:
|
|
17
|
+
1. stdlib ``sqlite3`` when it can load extensions (the common case);
|
|
18
|
+
2. ``pysqlite3`` if installed (fallback for extension-disabled builds);
|
|
19
|
+
3. stdlib ``sqlite3`` otherwise — a clear, actionable error is then raised at
|
|
20
|
+
connection time in ``db._load_sqlite_vec`` rather than a cryptic
|
|
21
|
+
``AttributeError``.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import sqlite3 as _stdlib_sqlite3
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _select_sqlite3():
|
|
30
|
+
try:
|
|
31
|
+
probe = _stdlib_sqlite3.connect(":memory:")
|
|
32
|
+
try:
|
|
33
|
+
capable = hasattr(probe, "enable_load_extension")
|
|
34
|
+
finally:
|
|
35
|
+
probe.close()
|
|
36
|
+
except Exception:
|
|
37
|
+
capable = False
|
|
38
|
+
if capable:
|
|
39
|
+
return _stdlib_sqlite3
|
|
40
|
+
try:
|
|
41
|
+
import pysqlite3.dbapi2 as _pysqlite3 # type: ignore
|
|
42
|
+
|
|
43
|
+
return _pysqlite3
|
|
44
|
+
except ImportError:
|
|
45
|
+
return _stdlib_sqlite3
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
sqlite3 = _select_sqlite3()
|
|
49
|
+
|
|
50
|
+
__all__ = ["sqlite3"]
|