realitydiff 0.4.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 (43) hide show
  1. realitydiff-0.4.0/.codegraph/.gitignore +5 -0
  2. realitydiff-0.4.0/.github/workflows/pypi-publish.yml +53 -0
  3. realitydiff-0.4.0/.gitignore +224 -0
  4. realitydiff-0.4.0/LICENSE +21 -0
  5. realitydiff-0.4.0/PKG-INFO +115 -0
  6. realitydiff-0.4.0/README.md +100 -0
  7. realitydiff-0.4.0/data/.gitkeep +0 -0
  8. realitydiff-0.4.0/install.sh +465 -0
  9. realitydiff-0.4.0/pyproject.toml +45 -0
  10. realitydiff-0.4.0/src/realitydiff/__init__.py +8 -0
  11. realitydiff-0.4.0/src/realitydiff/__main__.py +4 -0
  12. realitydiff-0.4.0/src/realitydiff/api.py +270 -0
  13. realitydiff-0.4.0/src/realitydiff/blame.py +85 -0
  14. realitydiff-0.4.0/src/realitydiff/claim.py +104 -0
  15. realitydiff-0.4.0/src/realitydiff/cli.py +168 -0
  16. realitydiff-0.4.0/src/realitydiff/compress.py +94 -0
  17. realitydiff-0.4.0/src/realitydiff/config.py +66 -0
  18. realitydiff-0.4.0/src/realitydiff/diffing.py +210 -0
  19. realitydiff-0.4.0/src/realitydiff/hashing.py +24 -0
  20. realitydiff-0.4.0/src/realitydiff/models.py +239 -0
  21. realitydiff-0.4.0/src/realitydiff/reasoner.py +440 -0
  22. realitydiff-0.4.0/src/realitydiff/schedule.py +217 -0
  23. realitydiff-0.4.0/src/realitydiff/service.py +173 -0
  24. realitydiff-0.4.0/src/realitydiff/static/app.js +814 -0
  25. realitydiff-0.4.0/src/realitydiff/static/favicon.svg +4 -0
  26. realitydiff-0.4.0/src/realitydiff/static/index.html +175 -0
  27. realitydiff-0.4.0/src/realitydiff/static/styles.css +477 -0
  28. realitydiff-0.4.0/src/realitydiff/store.py +296 -0
  29. realitydiff-0.4.0/src/realitydiff/watcher.py +42 -0
  30. realitydiff-0.4.0/src/realitydiff/xai.py +506 -0
  31. realitydiff-0.4.0/tests/__init__.py +0 -0
  32. realitydiff-0.4.0/tests/test_api.py +54 -0
  33. realitydiff-0.4.0/tests/test_close_claim.py +204 -0
  34. realitydiff-0.4.0/tests/test_compress.py +28 -0
  35. realitydiff-0.4.0/tests/test_config.py +52 -0
  36. realitydiff-0.4.0/tests/test_git_beliefs.py +131 -0
  37. realitydiff-0.4.0/tests/test_pypi_publish_workflow.py +19 -0
  38. realitydiff-0.4.0/tests/test_reasoner.py +182 -0
  39. realitydiff-0.4.0/tests/test_robustness.py +73 -0
  40. realitydiff-0.4.0/tests/test_schedule.py +115 -0
  41. realitydiff-0.4.0/tests/test_ui.py +132 -0
  42. realitydiff-0.4.0/tests/test_xai_cache.py +30 -0
  43. realitydiff-0.4.0/uv.lock +757 -0
@@ -0,0 +1,5 @@
1
+ # CodeGraph data files — local to each machine, not for committing.
2
+ # Ignore everything in .codegraph/ except this file itself, so transient
3
+ # files (the database, daemon.pid, sockets, logs) never show up in git.
4
+ *
5
+ !.gitignore
@@ -0,0 +1,53 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distribution
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Check out repository
16
+ uses: actions/checkout@v7.0.1
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v10.3.2
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - name: Build package
24
+ run: uv build
25
+
26
+ - name: Upload distribution
27
+ uses: actions/upload-artifact@v7.0.2
28
+ with:
29
+ name: python-package-distributions
30
+ path: dist/
31
+ if-no-files-found: error
32
+
33
+ publish:
34
+ name: Publish to PyPI
35
+ needs: build
36
+ runs-on: ubuntu-latest
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/realitydiff
40
+ permissions:
41
+ id-token: write
42
+ attestations: write
43
+ contents: read
44
+ actions: read
45
+ steps:
46
+ - name: Download distribution
47
+ uses: actions/download-artifact@v8.0.2
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+
52
+ - name: Publish package distributions to PyPI
53
+ uses: pypa/gh-action-pypi-publish@v1.14.3
@@ -0,0 +1,224 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # Reality Diff local belief store
221
+ data/*.sqlite
222
+ data/*.sqlite-journal
223
+ data/*.sqlite-shm
224
+ data/*.sqlite-wal
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Reality Diff contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.5
2
+ Name: realitydiff
3
+ Version: 0.4.0
4
+ Summary: Git for beliefs — living claims that watch the internet and version confidence.
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: fastapi>=0.115.0
8
+ Requires-Dist: httpx>=0.28.0
9
+ Requires-Dist: pydantic>=2.10.0
10
+ Requires-Dist: uvicorn[standard]>=0.34.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
13
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Reality Diff
17
+
18
+ Git for beliefs — a version history of a claim: evidence, confidence, and why that number moved. For people tracking a story that is still unfolding (products, policy, markets) who want a trail, not a vibe.
19
+
20
+ ## Why I built this
21
+
22
+ News feeds overwrite your memory. Last week’s confidence on a rumor disappears under today’s take. I wanted git-style operations on a belief: commit when evidence actually moves, diff two weeks, blame a confidence jump, browse the claim as of a SHA, or revert a panic. So I built Reality Diff.
23
+
24
+ ## News feed vs this
25
+
26
+ | | Typical news / search | Reality Diff |
27
+ | --- | --- | --- |
28
+ | Memory | Overwritten | Versioned history per claim |
29
+ | Confidence | Vibes / headlines | Explicit score + reason when it moves |
30
+ | Compare | Manual screenshots | `diff` between commits |
31
+ | Undo | None | `revert` to an earlier belief state |
32
+
33
+ ## Features
34
+
35
+ **Claims**
36
+
37
+ - Open a claim (e.g. “Apple is going to replace Siri with an LLM”)
38
+ - Living object: evidence for/against, unknowns, predictions, confidence
39
+ - Commits only when **meaningful** new evidence appears (cosmetic rewrites dropped)
40
+
41
+ **Git-style ops**
42
+
43
+ - `commit` · `diff` · `blame` · `revert` · `watch` · `log`
44
+ - Browse the belief as of any SHA
45
+ - Background watch via OS timer (macOS LaunchAgent / Linux systemd / Windows task) or the UI interval picker
46
+
47
+ **Surfaces**
48
+
49
+ - Local web UI (`realitydiff serve` → <http://localhost:8000>)
50
+ - CLI for agents and scripts
51
+ - REST API for the same actions
52
+
53
+ ## Install
54
+
55
+ One line (macOS or Linux, no sudo):
56
+
57
+ ```bash
58
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh
59
+ ```
60
+
61
+ It installs [uv](https://docs.astral.sh/uv/) into `~/.local/bin` if you don't have it, installs `realitydiff` as an isolated uv tool, and can save your `XAI_API_KEY` to `~/.config/realitydiff/env` (permissions 600). It never uses sudo and only touches your shell rc if you say yes.
62
+
63
+ ```bash
64
+ # options go after `sh -s --`
65
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh -s -- --yes # no prompts
66
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh -s -- --ref <tag-or-commit>
67
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh -s -- --uninstall
68
+ ```
69
+
70
+ Prefer to read it first? Download `install.sh`, look it over, then run `sh install.sh --help`.
71
+
72
+ Or install by hand:
73
+
74
+ ```bash
75
+ uv tool install "realitydiff @ https://github.com/kavin0x/RealityDiff/archive/main.tar.gz"
76
+ # or
77
+ pipx install "realitydiff @ https://github.com/kavin0x/RealityDiff/archive/main.tar.gz"
78
+ ```
79
+
80
+ Then:
81
+
82
+ ```bash
83
+ realitydiff serve --host 127.0.0.1 # open http://127.0.0.1:8000
84
+ ```
85
+
86
+ The installed CLI keeps claims in `~/.local/share/realitydiff/` (set `REALITYDIFF_DB` to change it). Inside a checkout it still uses `data/`.
87
+
88
+ ## Try it (from a checkout)
89
+
90
+ ```bash
91
+ export XAI_API_KEY=...
92
+ uv sync --extra dev
93
+ uv run realitydiff serve
94
+ # open http://localhost:8000
95
+ ```
96
+
97
+ ```bash
98
+ uv run realitydiff open "Apple is going to replace Siri with an LLM."
99
+ uv run realitydiff watch <claim_id>
100
+ uv run realitydiff log <claim_id>
101
+ uv run realitydiff diff <claim_id> <sha_a> <sha_b>
102
+ ```
103
+
104
+ ```bash
105
+ uv run realitydiff service install --interval 300
106
+ uv run pytest
107
+ ```
108
+
109
+ ## Stack
110
+
111
+ Python 3.11+ · uv · local web UI + REST · xAI Responses API (web + X search) · MIT
112
+
113
+ ## License
114
+
115
+ [MIT](LICENSE)
@@ -0,0 +1,100 @@
1
+ # Reality Diff
2
+
3
+ Git for beliefs — a version history of a claim: evidence, confidence, and why that number moved. For people tracking a story that is still unfolding (products, policy, markets) who want a trail, not a vibe.
4
+
5
+ ## Why I built this
6
+
7
+ News feeds overwrite your memory. Last week’s confidence on a rumor disappears under today’s take. I wanted git-style operations on a belief: commit when evidence actually moves, diff two weeks, blame a confidence jump, browse the claim as of a SHA, or revert a panic. So I built Reality Diff.
8
+
9
+ ## News feed vs this
10
+
11
+ | | Typical news / search | Reality Diff |
12
+ | --- | --- | --- |
13
+ | Memory | Overwritten | Versioned history per claim |
14
+ | Confidence | Vibes / headlines | Explicit score + reason when it moves |
15
+ | Compare | Manual screenshots | `diff` between commits |
16
+ | Undo | None | `revert` to an earlier belief state |
17
+
18
+ ## Features
19
+
20
+ **Claims**
21
+
22
+ - Open a claim (e.g. “Apple is going to replace Siri with an LLM”)
23
+ - Living object: evidence for/against, unknowns, predictions, confidence
24
+ - Commits only when **meaningful** new evidence appears (cosmetic rewrites dropped)
25
+
26
+ **Git-style ops**
27
+
28
+ - `commit` · `diff` · `blame` · `revert` · `watch` · `log`
29
+ - Browse the belief as of any SHA
30
+ - Background watch via OS timer (macOS LaunchAgent / Linux systemd / Windows task) or the UI interval picker
31
+
32
+ **Surfaces**
33
+
34
+ - Local web UI (`realitydiff serve` → <http://localhost:8000>)
35
+ - CLI for agents and scripts
36
+ - REST API for the same actions
37
+
38
+ ## Install
39
+
40
+ One line (macOS or Linux, no sudo):
41
+
42
+ ```bash
43
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh
44
+ ```
45
+
46
+ It installs [uv](https://docs.astral.sh/uv/) into `~/.local/bin` if you don't have it, installs `realitydiff` as an isolated uv tool, and can save your `XAI_API_KEY` to `~/.config/realitydiff/env` (permissions 600). It never uses sudo and only touches your shell rc if you say yes.
47
+
48
+ ```bash
49
+ # options go after `sh -s --`
50
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh -s -- --yes # no prompts
51
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh -s -- --ref <tag-or-commit>
52
+ curl -fsSL https://raw.githubusercontent.com/kavin0x/RealityDiff/main/install.sh | sh -s -- --uninstall
53
+ ```
54
+
55
+ Prefer to read it first? Download `install.sh`, look it over, then run `sh install.sh --help`.
56
+
57
+ Or install by hand:
58
+
59
+ ```bash
60
+ uv tool install "realitydiff @ https://github.com/kavin0x/RealityDiff/archive/main.tar.gz"
61
+ # or
62
+ pipx install "realitydiff @ https://github.com/kavin0x/RealityDiff/archive/main.tar.gz"
63
+ ```
64
+
65
+ Then:
66
+
67
+ ```bash
68
+ realitydiff serve --host 127.0.0.1 # open http://127.0.0.1:8000
69
+ ```
70
+
71
+ The installed CLI keeps claims in `~/.local/share/realitydiff/` (set `REALITYDIFF_DB` to change it). Inside a checkout it still uses `data/`.
72
+
73
+ ## Try it (from a checkout)
74
+
75
+ ```bash
76
+ export XAI_API_KEY=...
77
+ uv sync --extra dev
78
+ uv run realitydiff serve
79
+ # open http://localhost:8000
80
+ ```
81
+
82
+ ```bash
83
+ uv run realitydiff open "Apple is going to replace Siri with an LLM."
84
+ uv run realitydiff watch <claim_id>
85
+ uv run realitydiff log <claim_id>
86
+ uv run realitydiff diff <claim_id> <sha_a> <sha_b>
87
+ ```
88
+
89
+ ```bash
90
+ uv run realitydiff service install --interval 300
91
+ uv run pytest
92
+ ```
93
+
94
+ ## Stack
95
+
96
+ Python 3.11+ · uv · local web UI + REST · xAI Responses API (web + X search) · MIT
97
+
98
+ ## License
99
+
100
+ [MIT](LICENSE)
File without changes