memvara 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 (138) hide show
  1. memvara-0.1.0/.dockerignore +19 -0
  2. memvara-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
  3. memvara-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. memvara-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +50 -0
  5. memvara-0.1.0/.github/workflows/ci.yml +122 -0
  6. memvara-0.1.0/.gitignore +17 -0
  7. memvara-0.1.0/CHANGELOG.md +808 -0
  8. memvara-0.1.0/CONTRIBUTING.md +210 -0
  9. memvara-0.1.0/Dockerfile +116 -0
  10. memvara-0.1.0/LICENSE +202 -0
  11. memvara-0.1.0/PKG-INFO +1403 -0
  12. memvara-0.1.0/README.md +1361 -0
  13. memvara-0.1.0/SECURITY.md +203 -0
  14. memvara-0.1.0/bench/baseline.py +126 -0
  15. memvara-0.1.0/bench/compare.py +240 -0
  16. memvara-0.1.0/bench/evalkit.py +2403 -0
  17. memvara-0.1.0/bench/locomo.py +829 -0
  18. memvara-0.1.0/bench/longmemeval.py +736 -0
  19. memvara-0.1.0/bench/mem0_real.py +306 -0
  20. memvara-0.1.0/bench/multihop.py +333 -0
  21. memvara-0.1.0/bench/perf.py +109 -0
  22. memvara-0.1.0/demo/README.md +473 -0
  23. memvara-0.1.0/demo/__init__.py +18 -0
  24. memvara-0.1.0/demo/baselines.py +802 -0
  25. memvara-0.1.0/demo/harness.py +567 -0
  26. memvara-0.1.0/demo/runs/2026-08-13-agent-reader.answers.jsonl +100 -0
  27. memvara-0.1.0/demo/runs/2026-08-13-agent-reader.scored.jsonl +100 -0
  28. memvara-0.1.0/demo/runs/README.md +71 -0
  29. memvara-0.1.0/demo/scenario.py +1003 -0
  30. memvara-0.1.0/docs/DEPLOY.md +421 -0
  31. memvara-0.1.0/docs/INTERNALS.md +594 -0
  32. memvara-0.1.0/docs/RELEASING.md +247 -0
  33. memvara-0.1.0/docs/ROADMAP.md +524 -0
  34. memvara-0.1.0/docs/UPGRADING.md +257 -0
  35. memvara-0.1.0/docs/WAVE4.md +73 -0
  36. memvara-0.1.0/docs/WAVE5.md +92 -0
  37. memvara-0.1.0/docs/WORKPLAN.md +330 -0
  38. memvara-0.1.0/memvara/__init__.py +130 -0
  39. memvara-0.1.0/memvara/aio.py +670 -0
  40. memvara-0.1.0/memvara/compat/__init__.py +56 -0
  41. memvara-0.1.0/memvara/compat/_notes.py +183 -0
  42. memvara-0.1.0/memvara/compat/mem0.py +544 -0
  43. memvara-0.1.0/memvara/compat/mem0_import.py +569 -0
  44. memvara-0.1.0/memvara/consolidate/__init__.py +99 -0
  45. memvara-0.1.0/memvara/consolidate/decay.py +118 -0
  46. memvara-0.1.0/memvara/consolidate/merge.py +248 -0
  47. memvara-0.1.0/memvara/consolidate/sweep.py +141 -0
  48. memvara-0.1.0/memvara/core.py +2118 -0
  49. memvara-0.1.0/memvara/embed/__init__.py +35 -0
  50. memvara-0.1.0/memvara/embed/base.py +151 -0
  51. memvara-0.1.0/memvara/embed/fingerprint.py +147 -0
  52. memvara-0.1.0/memvara/embed/local.py +50 -0
  53. memvara-0.1.0/memvara/entities.py +446 -0
  54. memvara-0.1.0/memvara/integrations/__init__.py +85 -0
  55. memvara-0.1.0/memvara/integrations/_common.py +148 -0
  56. memvara-0.1.0/memvara/integrations/crewai.py +571 -0
  57. memvara-0.1.0/memvara/integrations/langchain.py +511 -0
  58. memvara-0.1.0/memvara/integrations/langgraph.py +948 -0
  59. memvara-0.1.0/memvara/integrations/llamaindex.py +369 -0
  60. memvara-0.1.0/memvara/llm/__init__.py +26 -0
  61. memvara-0.1.0/memvara/llm/_shape.py +242 -0
  62. memvara-0.1.0/memvara/llm/anthropic.py +155 -0
  63. memvara-0.1.0/memvara/llm/base.py +265 -0
  64. memvara-0.1.0/memvara/llm/openai.py +174 -0
  65. memvara-0.1.0/memvara/py.typed +0 -0
  66. memvara-0.1.0/memvara/redact.py +501 -0
  67. memvara-0.1.0/memvara/rerank/__init__.py +73 -0
  68. memvara-0.1.0/memvara/rerank/base.py +64 -0
  69. memvara-0.1.0/memvara/rerank/cross.py +105 -0
  70. memvara-0.1.0/memvara/rerank/lexical.py +130 -0
  71. memvara-0.1.0/memvara/rerank/stage.py +105 -0
  72. memvara-0.1.0/memvara/retrieve/__init__.py +45 -0
  73. memvara-0.1.0/memvara/retrieve/analyze.py +124 -0
  74. memvara-0.1.0/memvara/retrieve/calibrate.py +162 -0
  75. memvara-0.1.0/memvara/retrieve/fusion.py +71 -0
  76. memvara-0.1.0/memvara/retrieve/hybrid.py +842 -0
  77. memvara-0.1.0/memvara/retrieve/scoring.py +283 -0
  78. memvara-0.1.0/memvara/retrieve/traverse.py +678 -0
  79. memvara-0.1.0/memvara/schema.py +526 -0
  80. memvara-0.1.0/memvara/server/__init__.py +43 -0
  81. memvara-0.1.0/memvara/server/__main__.py +11 -0
  82. memvara-0.1.0/memvara/server/cli.py +102 -0
  83. memvara-0.1.0/memvara/server/config.py +259 -0
  84. memvara-0.1.0/memvara/server/mcp.py +209 -0
  85. memvara-0.1.0/memvara/server/protocol.py +99 -0
  86. memvara-0.1.0/memvara/server/tools.py +635 -0
  87. memvara-0.1.0/memvara/server/validate.py +143 -0
  88. memvara-0.1.0/memvara/store/__init__.py +11 -0
  89. memvara-0.1.0/memvara/store/base.py +806 -0
  90. memvara-0.1.0/memvara/store/sqlite.py +2837 -0
  91. memvara-0.1.0/memvara/telemetry.py +565 -0
  92. memvara-0.1.0/memvara/types.py +987 -0
  93. memvara-0.1.0/memvara/write/__init__.py +19 -0
  94. memvara-0.1.0/memvara/write/fast.py +288 -0
  95. memvara-0.1.0/memvara/write/gate.py +152 -0
  96. memvara-0.1.0/memvara/write/pipeline.py +757 -0
  97. memvara-0.1.0/memvara/write/reconcile.py +636 -0
  98. memvara-0.1.0/pyproject.toml +91 -0
  99. memvara-0.1.0/release/README.md +131 -0
  100. memvara-0.1.0/release/publish_npm.py +175 -0
  101. memvara-0.1.0/release/publish_pypi.py +358 -0
  102. memvara-0.1.0/tests/conftest.py +91 -0
  103. memvara-0.1.0/tests/test_aio.py +425 -0
  104. memvara-0.1.0/tests/test_alias_probes.py +406 -0
  105. memvara-0.1.0/tests/test_api.py +2346 -0
  106. memvara-0.1.0/tests/test_bench_eval.py +2034 -0
  107. memvara-0.1.0/tests/test_bitemporal.py +845 -0
  108. memvara-0.1.0/tests/test_compat.py +833 -0
  109. memvara-0.1.0/tests/test_decay.py +551 -0
  110. memvara-0.1.0/tests/test_demo.py +1688 -0
  111. memvara-0.1.0/tests/test_demo_scenario.py +691 -0
  112. memvara-0.1.0/tests/test_edges.py +1209 -0
  113. memvara-0.1.0/tests/test_entities.py +842 -0
  114. memvara-0.1.0/tests/test_fast.py +189 -0
  115. memvara-0.1.0/tests/test_fusion.py +195 -0
  116. memvara-0.1.0/tests/test_gate.py +229 -0
  117. memvara-0.1.0/tests/test_hybrid.py +1903 -0
  118. memvara-0.1.0/tests/test_integration.py +565 -0
  119. memvara-0.1.0/tests/test_integrations.py +1475 -0
  120. memvara-0.1.0/tests/test_integrations_langgraph.py +1282 -0
  121. memvara-0.1.0/tests/test_internals.py +494 -0
  122. memvara-0.1.0/tests/test_llm.py +573 -0
  123. memvara-0.1.0/tests/test_llm_openai.py +248 -0
  124. memvara-0.1.0/tests/test_merge.py +506 -0
  125. memvara-0.1.0/tests/test_packaging.py +553 -0
  126. memvara-0.1.0/tests/test_pipeline.py +1270 -0
  127. memvara-0.1.0/tests/test_predicates.py +668 -0
  128. memvara-0.1.0/tests/test_reconcile.py +672 -0
  129. memvara-0.1.0/tests/test_redact.py +829 -0
  130. memvara-0.1.0/tests/test_rerank.py +590 -0
  131. memvara-0.1.0/tests/test_schema.py +276 -0
  132. memvara-0.1.0/tests/test_scoring.py +584 -0
  133. memvara-0.1.0/tests/test_server.py +1149 -0
  134. memvara-0.1.0/tests/test_store.py +2439 -0
  135. memvara-0.1.0/tests/test_telemetry.py +707 -0
  136. memvara-0.1.0/tests/test_traverse.py +954 -0
  137. memvara-0.1.0/tests/test_types.py +489 -0
  138. memvara-0.1.0/tests/test_vecindex.py +712 -0
@@ -0,0 +1,19 @@
1
+ # Deny everything, then name what the build actually needs. The allow-list direction is
2
+ # deliberate: a deny-list forgets, and the things it forgets here are `.git` (the whole
3
+ # history, in every layer that touches the context), `.coverage`, and — the one that
4
+ # matters — any `memory.db` a developer left in the tree. A memory store is user data,
5
+ # and shipping one inside a published image is a data leak that no later `RUN rm` undoes,
6
+ # because the file is already in the layer beneath it.
7
+ *
8
+
9
+ # `pyproject.toml` names `readme` and `license-files`, so hatchling fails the build
10
+ # without these two present; they are not optional niceties.
11
+ !pyproject.toml
12
+ !README.md
13
+ !LICENSE
14
+ !memvara
15
+
16
+ # Byte-compiled from the host, and possibly for a different interpreter than the image
17
+ # runs. `pip install` compiles fresh inside the builder.
18
+ memvara/**/__pycache__
19
+ memvara/**/*.pyc
@@ -0,0 +1,63 @@
1
+ name: Bug report
2
+ description: Something behaves differently from what the docs say
3
+ labels: [bug]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ **Not for security issues.** Vulnerabilities go through the private advisory flow
9
+ in [SECURITY.md](https://github.com/memvara/memvara/blob/main/SECURITY.md), not here.
10
+
11
+ - type: textarea
12
+ id: what
13
+ attributes:
14
+ label: What happened, and what you expected instead
15
+ validations:
16
+ required: true
17
+
18
+ - type: textarea
19
+ id: repro
20
+ attributes:
21
+ label: Reproduction
22
+ description: >
23
+ A script we can run. It must work offline with no API key — everything in this
24
+ library does, so a repro that needs a network call almost always means the bug is
25
+ somewhere else. Use `Memvara(":memory:")` and pass explicit `datetime` values
26
+ rather than relying on the clock.
27
+ render: python
28
+ validations:
29
+ required: true
30
+
31
+ - type: input
32
+ id: version
33
+ attributes:
34
+ label: memvara version
35
+ description: "`python3 -c 'import memvara; print(memvara.__version__)'`, or the commit if you installed from a checkout."
36
+ validations:
37
+ required: true
38
+
39
+ - type: input
40
+ id: python
41
+ attributes:
42
+ label: Python version
43
+ description: "`python3 -V`"
44
+ validations:
45
+ required: true
46
+
47
+ - type: input
48
+ id: platform
49
+ attributes:
50
+ label: Platform
51
+ description: "OS and architecture — e.g. macOS 15 arm64, Ubuntu 24.04 x86_64, Windows 11."
52
+ validations:
53
+ required: true
54
+
55
+ - type: textarea
56
+ id: config
57
+ attributes:
58
+ label: Non-default configuration
59
+ description: >
60
+ Any `embedder=`, `llm=`, `store=`, `redactor=` or scope arguments, and whether the
61
+ store is on disk or `:memory:`. Skip if everything was default.
62
+ validations:
63
+ required: false
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Report a security vulnerability
4
+ url: https://github.com/memvara/memvara/security/advisories/new
5
+ about: Private advisory, not a public issue. See SECURITY.md for what is in scope.
@@ -0,0 +1,50 @@
1
+ name: Feature request
2
+ description: Propose something the library should do
3
+ labels: [enhancement]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Before writing code, read
9
+ [Scope](https://github.com/memvara/memvara/blob/main/CONTRIBUTING.md#scope) in
10
+ CONTRIBUTING.md. It says what is likely to be accepted, and — with a four-question
11
+ test you can apply yourself — what belongs in the separate commercial layer and
12
+ will be declined here even if it is good. Better to find that out now than after
13
+ the PR.
14
+
15
+ - type: textarea
16
+ id: problem
17
+ attributes:
18
+ label: What can't you do today
19
+ description: The problem, not the solution. What did you try, and where did it stop?
20
+ validations:
21
+ required: true
22
+
23
+ - type: textarea
24
+ id: proposal
25
+ attributes:
26
+ label: What you'd like instead
27
+ description: >
28
+ A sketch of the API is enough. If it changes bitemporal semantics, the predicate
29
+ schema, retrieval scoring, scope resolution, or what `why()` returns, say so —
30
+ those are load-bearing and the discussion is different.
31
+ validations:
32
+ required: true
33
+
34
+ - type: input
35
+ id: version
36
+ attributes:
37
+ label: memvara version
38
+ description: So we know whether it already exists.
39
+ validations:
40
+ required: true
41
+
42
+ - type: textarea
43
+ id: alternatives
44
+ attributes:
45
+ label: What you ruled out
46
+ description: >
47
+ Including whether this can be done today behind one of the existing protocols
48
+ (`Store`, `Embedder`, `LLM`, `Recorder`, `Redactor`) without a change to the core.
49
+ validations:
50
+ required: false
@@ -0,0 +1,122 @@
1
+ # The suite enforces `fail_under = 100`. Until this workflow existed it enforced it on
2
+ # exactly one developer machine running one Python — which is not enforcement, it is a
3
+ # local habit. The matrix is the point: `requires-python = ">=3.10"` is a promise, and
4
+ # 3.10 through 3.12 had never executed a line of this library.
5
+ name: CI
6
+
7
+ on:
8
+ push:
9
+ branches: [main]
10
+ pull_request:
11
+ workflow_dispatch:
12
+
13
+ concurrency:
14
+ # A second push to the same branch makes the first run's answer irrelevant.
15
+ group: ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ test:
20
+ name: py${{ matrix.python }} on ${{ matrix.os }}
21
+ runs-on: ${{ matrix.os }}
22
+ strategy:
23
+ # Never cancel siblings: "3.10 fails and 3.13 passes" is the single most useful
24
+ # thing this matrix can tell us, and fail-fast throws it away.
25
+ fail-fast: false
26
+ matrix:
27
+ python: ["3.10", "3.11", "3.12", "3.13"]
28
+ os: [ubuntu-latest]
29
+ include:
30
+ # Two more OSes on one version each. The store touches mmap, file locking and
31
+ # path handling — all three differ on Windows, and none of it is exercised by
32
+ # running Linux four times.
33
+ - python: "3.13"
34
+ os: macos-latest
35
+ - python: "3.13"
36
+ os: windows-latest
37
+
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: ${{ matrix.python }}
44
+ cache: pip
45
+
46
+ - name: Install
47
+ run: |
48
+ python -m pip install --upgrade pip
49
+ python -m pip install -e ".[dev]"
50
+
51
+ - name: Test
52
+ run: python -m pytest -q
53
+
54
+ coverage:
55
+ # Separate job, one version. Coverage is a property of the suite, not of the
56
+ # interpreter, so measuring it four times would just be four chances to flake.
57
+ name: coverage (gated at 100%)
58
+ runs-on: ubuntu-latest
59
+ steps:
60
+ - uses: actions/checkout@v4
61
+ - uses: actions/setup-python@v5
62
+ with:
63
+ python-version: "3.13"
64
+ cache: pip
65
+ - run: |
66
+ python -m pip install --upgrade pip
67
+ python -m pip install -e ".[dev]"
68
+ # `coverage report` exits non-zero below fail_under, so this step is the gate.
69
+ - run: |
70
+ python -m coverage run -m pytest -q
71
+ python -m coverage report
72
+
73
+ types:
74
+ # The package ships `py.typed`, so these annotations are what a user's checker
75
+ # consumes — and `search()` is `@overload`ed, which is the kind of declaration that
76
+ # can be wrong in a way no runtime test notices: a bad overload type-checks a call
77
+ # that then fails. The overload tests skip without mypy installed, so without this
78
+ # job they were enforced only on machines that happened to have it.
79
+ name: mypy
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v4
83
+ - uses: actions/setup-python@v5
84
+ with:
85
+ python-version: "3.13"
86
+ cache: pip
87
+ - run: |
88
+ python -m pip install --upgrade pip
89
+ python -m pip install -e ".[dev]"
90
+ - run: python -m mypy -p memvara
91
+
92
+ offline:
93
+ # The headline claim is "numpy and nothing else, runs offline with no API key". That
94
+ # is worth testing rather than asserting: install the bare package with no extras and
95
+ # import every module, so an accidental top-level `import anthropic` in some adapter
96
+ # cannot pass CI.
97
+ name: core imports with no extras
98
+ runs-on: ubuntu-latest
99
+ steps:
100
+ - uses: actions/checkout@v4
101
+ - uses: actions/setup-python@v5
102
+ with:
103
+ python-version: "3.13"
104
+ - run: |
105
+ python -m pip install --upgrade pip
106
+ python -m pip install .
107
+ - name: Import every module from a directory that is not the repo
108
+ run: |
109
+ cd /tmp
110
+ python -c "
111
+ import importlib, pkgutil, memvara
112
+ failed = []
113
+ for m in pkgutil.walk_packages(memvara.__path__, 'memvara.'):
114
+ try:
115
+ importlib.import_module(m.name)
116
+ except ImportError as e:
117
+ # Optional adapters may import their provider lazily; a hard failure
118
+ # here means a top-level dependency leaked into the core install.
119
+ failed.append((m.name, str(e)))
120
+ assert not failed, failed
121
+ print('all modules import with numpy alone')
122
+ "
@@ -0,0 +1,17 @@
1
+ dist/
2
+ .coverage
3
+ __pycache__/
4
+ *.pyc
5
+ .pytest_cache/
6
+
7
+ # Local editor/agent scratch. `.claude/launch.json` names an absolute path on one
8
+ # machine, so it is configuration for a workstation rather than for the project.
9
+ .claude/
10
+
11
+ # Secrets never belong in a repository, and this one is Apache-2.0 and public: a commit
12
+ # here is a disclosure, not a mistake to be fixed by a later commit. Listed even though
13
+ # nothing in this repo reads a `.env`, because the rule has to exist *before* the file
14
+ # does — an ignore added after `git add -A` protects nothing.
15
+ .env
16
+ .env.*
17
+ !.env.example