tablassert 8.1.0__tar.gz → 8.2.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 (37) hide show
  1. tablassert-8.2.0/PKG-INFO +221 -0
  2. tablassert-8.2.0/README.md +167 -0
  3. {tablassert-8.1.0 → tablassert-8.2.0}/pyproject.toml +4 -2
  4. {tablassert-8.1.0 → tablassert-8.2.0}/rust/Cargo.lock +9 -13
  5. tablassert-8.2.0/rust/Cargo.toml +65 -0
  6. {tablassert-8.1.0 → tablassert-8.2.0}/rust/examples/count_tables.rs +2 -1
  7. {tablassert-8.1.0 → tablassert-8.2.0}/rust/src/fullmap.rs +950 -77
  8. {tablassert-8.1.0 → tablassert-8.2.0}/rust/src/json.rs +23 -15
  9. {tablassert-8.1.0 → tablassert-8.2.0}/rust/src/lib.rs +4 -22
  10. {tablassert-8.1.0 → tablassert-8.2.0}/rust/tests/build_golden.rs +18 -9
  11. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/__init__.py +2 -2
  12. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/agent.py +46 -13
  13. tablassert-8.2.0/src/tablassert/biolink.py +749 -0
  14. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/cli.py +62 -0
  15. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/coerce.py +327 -3
  16. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/errors.py +3 -0
  17. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/fullmap.py +19 -7
  18. tablassert-8.2.0/src/tablassert/graph_registry.py +184 -0
  19. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/lib.py +354 -46
  20. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/models.py +83 -1
  21. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/rig.py +17 -2
  22. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/rs.pyi +0 -1
  23. tablassert-8.1.0/PKG-INFO +0 -123
  24. tablassert-8.1.0/README.md +0 -70
  25. tablassert-8.1.0/rust/Cargo.toml +0 -51
  26. tablassert-8.1.0/src/tablassert/biolink.py +0 -310
  27. {tablassert-8.1.0 → tablassert-8.2.0}/LICENSE +0 -0
  28. {tablassert-8.1.0 → tablassert-8.2.0}/rust/src/ndjson.rs +0 -0
  29. {tablassert-8.1.0 → tablassert-8.2.0}/rust/src/uuid.rs +0 -0
  30. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/_lazy.py +0 -0
  31. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/enums.py +0 -0
  32. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/ingests.py +0 -0
  33. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/log.py +0 -0
  34. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/nlp.py +0 -0
  35. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/progress.py +0 -0
  36. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/qc.py +0 -0
  37. {tablassert-8.1.0 → tablassert-8.2.0}/src/tablassert/utils.py +0 -0
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: tablassert
3
+ Version: 8.2.0
4
+ Classifier: License :: OSI Approved :: Apache Software License
5
+ Classifier: Development Status :: 5 - Production/Stable
6
+ Classifier: Intended Audience :: Science/Research
7
+ Classifier: Intended Audience :: Healthcare Industry
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
10
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
11
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
12
+ Classifier: Topic :: Database
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Classifier: Programming Language :: Rust
19
+ Classifier: Framework :: Pydantic
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Environment :: Console
23
+ Requires-Dist: biolink-model>=4.4.3
24
+ Requires-Dist: loguru>=0.7.3
25
+ Requires-Dist: polars>=1.39.0
26
+ Requires-Dist: rapidfuzz>=3.14.3
27
+ Requires-Dist: pydantic>=2.12.5
28
+ Requires-Dist: pyyaml>=6.0.3
29
+ Requires-Dist: cyclopts>=1.0.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Requires-Dist: fastexcel>=0.20.2
32
+ Requires-Dist: smolagents>=1.26.0 ; extra == 'agent'
33
+ Requires-Dist: litellm>=1.93.0 ; extra == 'agent'
34
+ Requires-Dist: pdfminer-six>=20221105 ; extra == 'agent'
35
+ Requires-Dist: dspy>=3.2.1 ; extra == 'optimize'
36
+ Requires-Dist: scikit-learn>=1.8.0 ; extra == 'qc'
37
+ Requires-Dist: sentence-transformers>=5.3.0 ; extra == 'qc'
38
+ Requires-Dist: polars[rtcompat]>=1.40.1 ; extra == 'rt'
39
+ Provides-Extra: agent
40
+ Provides-Extra: optimize
41
+ Provides-Extra: qc
42
+ Provides-Extra: rt
43
+ License-File: LICENSE
44
+ Summary: Extract knowledge assertions from tabular data into NCATS Translator-compliant KGX NDJSON — declaratively, with entity resolution and quality control built in.
45
+ Keywords: knowledge graph,bioinformatics,entity resolution,ner,ncats translator,kgx,yaml configuration,table mining,declarative pipeline,data quality control,tablassert
46
+ Author-email: Skye Lane Goetz <sgoetz@isbscience.org>
47
+ License-Expression: Apache-2.0
48
+ Requires-Python: >=3.11
49
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
50
+ Project-URL: Documentation, https://skyeav.github.io/Tablassert/
51
+ Project-URL: Homepage, https://github.com/SkyeAv/Tablassert
52
+ Project-URL: Source, https://github.com/SkyeAv/Tablassert
53
+
54
+ # Tablassert
55
+
56
+ [![PyPI](https://img.shields.io/pypi/v/tablassert.svg)](https://pypi.org/project/tablassert/)
57
+ [![Python](https://img.shields.io/pypi/pyversions/tablassert.svg)](https://pypi.org/project/tablassert/)
58
+ [![CI](https://github.com/SkyeAv/Tablassert/actions/workflows/ci.yml/badge.svg)](https://github.com/SkyeAv/Tablassert/actions/workflows/ci.yml)
59
+ [![License](https://img.shields.io/pypi/l/tablassert.svg)](https://github.com/SkyeAv/Tablassert/blob/main/LICENSE)
60
+ [![Docs](https://img.shields.io/github/deployments/SkyeAv/Tablassert/github-pages?label=docs)](https://skyeav.github.io/Tablassert/)
61
+
62
+ > Extract knowledge assertions from tabular data into NCATS Translator-compliant KGX NDJSON —
63
+ > declaratively, with entity resolution built in and optional quality control.
64
+
65
+ Tablassert turns biomedical spreadsheets (Excel, CSV, TSV) into knowledge graphs ready for NCATS
66
+ Translator. Declare how your columns map to subject–predicate–object statements in YAML; Tablassert
67
+ resolves free text to standard CURIEs, attaches provenance and statistical annotations, and emits
68
+ KGX-compliant nodes and edges.
69
+
70
+ **[Full Documentation](https://skyeav.github.io/Tablassert/)** — installation guides, tutorial,
71
+ configuration reference, and API docs.
72
+
73
+ ## Quick Start
74
+
75
+ ```bash
76
+ pip install tablassert
77
+ ```
78
+
79
+ Given a CSV of gene–disease associations with p-values and sample sizes, declare the mapping in a
80
+ table config (`table.yaml`):
81
+
82
+ ```yaml
83
+ template:
84
+ source:
85
+ kind: text
86
+ local: ./gene-disease.csv
87
+ url: https://example.com/data.csv
88
+ row_slice: [1, auto]
89
+ delimiter: ","
90
+ statement:
91
+ subject: { method: column, encoding: A, prioritize: [Gene] }
92
+ predicate: associated_with
93
+ object: { method: column, encoding: B, prioritize: [Disease] }
94
+ provenance: { repo: PMID, publication: "12345678" }
95
+ annotations:
96
+ - { annotation: p_value, method: column, encoding: C }
97
+ - { annotation: supporting_study_size, method: column, encoding: D }
98
+ ```
99
+
100
+ Wrap it in a graph config (`graph.yaml`) pointing at your fullmap entity-resolution database:
101
+
102
+ ```yaml
103
+ name: MY_KG
104
+ version: 1.0.0
105
+ description: Gene–disease associations extracted from tabular sources.
106
+ tables:
107
+ - ./table.yaml
108
+ fullmap: /path/to/fullmap
109
+ ```
110
+
111
+ Build the knowledge graph:
112
+
113
+ ```bash
114
+ tablassert build-kg graph.yaml
115
+ ```
116
+
117
+ Output is one JSON object per line — nodes with Biolink categories, edges with annotations:
118
+
119
+ ```json
120
+ {"id":"HGNC:11998","name":"TP53","category":["biolink:Gene"],"taxon":"NCBITaxon:9606"}
121
+ {"id":"MONDO:0008903","name":"lung cancer","category":["biolink:Disease"]}
122
+ ```
123
+
124
+ ```json
125
+ {"subject":"HGNC:11998","predicate":"biolink:associated_with","object":"MONDO:0008903","p_value":"1.0000e-03","supporting_study_size":"450"}
126
+ ```
127
+
128
+ See the [Tutorial](https://skyeav.github.io/Tablassert/tutorial/) for the full walkthrough.
129
+
130
+ ## Key Features
131
+
132
+ - **Declarative YAML configuration** — define data transformations without writing code
133
+ - **Built-in entity resolution** — map free text to genes, diseases, and chemicals with standard
134
+ CURIEs, taxonomic filtering, and provenance, backed by an embedded redb database
135
+ - **Optional quality control** — a three-stage audit (exact → fuzzy → BioBERT embeddings) flags
136
+ low-confidence mappings
137
+ - **KGX compliance** — emits NCATS Translator-compatible node/edge NDJSON with Biolink categories
138
+ and predicates
139
+ - **Autonomous agent** — `tablassert agent` derives, builds, and refines configs for whole papers
140
+ - **Performance & reproducibility** — lazy Polars pipelines and a deterministic UV-based
141
+ development environment
142
+
143
+ ## Installation
144
+
145
+ ```bash
146
+ pip install tablassert
147
+ ```
148
+
149
+ Or with uv: `uv tool install tablassert`. The base install builds knowledge graphs from
150
+ CSV/TSV/Excel sources; optional extras add runtime and pipeline capabilities:
151
+
152
+ | Extra | Adds | Install |
153
+ | ----- | ---- | ------- |
154
+ | `rt` | CPU-compatible Polars runtime | `pip install "tablassert[rt]"` |
155
+ | `qc` | three-stage QC audit (exact → fuzzy → BioBERT embeddings) | `pip install "tablassert[qc]"` |
156
+ | `agent` | autonomous agent (smolagents, litellm, PDF context) | `pip install "tablassert[agent]"` |
157
+ | `optimize` | GEPA prompt optimization for `agent --optimize` (dspy) | `pip install "tablassert[optimize]"` |
158
+
159
+ QC is opt-in at build time (`build-kg --qc`). See the
160
+ [Installation guide](https://skyeav.github.io/Tablassert/installation/) for the full matrix and the
161
+ [CLI Reference](https://skyeav.github.io/Tablassert/cli/) for every flag.
162
+
163
+ ## Entity Resolution API
164
+
165
+ ```python
166
+ from pathlib import Path
167
+ from tablassert.lib import resolve_many
168
+
169
+ results = resolve_many(
170
+ col="gene",
171
+ entities=["TP53", "BRCA1"],
172
+ fullmap=Path("/path/to/fullmap"),
173
+ taxon="9606",
174
+ )
175
+ # [{"original_gene": "TP53", "gene": "HGNC:11998", "gene_name": "TP53", ...}, ...]
176
+ ```
177
+
178
+ Point `resolve_many()` at a fullmap database to resolve any iterable of entity strings to CURIEs —
179
+ no LazyFrame setup or NLP preprocessing required. See the
180
+ [Batch Resolution API](https://skyeav.github.io/Tablassert/api/lib/) for the full reference.
181
+
182
+ ## Documentation
183
+
184
+ - **[Installation](https://skyeav.github.io/Tablassert/installation/)** — install methods, extras, and development setup
185
+ - **[Tutorial](https://skyeav.github.io/Tablassert/tutorial/)** — step-by-step example with synthetic data
186
+ - **[CLI Reference](https://skyeav.github.io/Tablassert/cli/)** — complete command-line flag reference
187
+ - **[Use Case Gallery](https://skyeav.github.io/Tablassert/examples/)** — real-world configuration patterns
188
+ - **[Configuration](https://skyeav.github.io/Tablassert/configuration/graph/)** — graph and table configuration reference
189
+ - **[Agent](https://skyeav.github.io/Tablassert/agent/)** — the autonomous agent pipeline
190
+ - **[API Reference](https://skyeav.github.io/Tablassert/api/fullmap/)** — core functions documentation
191
+
192
+ ## Developing
193
+
194
+ ```bash
195
+ uv sync --group dev --extra qc
196
+ uv run maturin develop --manifest-path rust/Cargo.toml
197
+ make check
198
+ ```
199
+
200
+ See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the full development loop, quality gates, and pull
201
+ request guidelines.
202
+
203
+ ## Citation
204
+
205
+ If you use Tablassert, please cite it as described in [CITATION.cff](CITATION.cff). The approach is
206
+ described in:
207
+
208
+ > Skye Lane Goetz, Alex K. Glen, and Gwênlyn Glusman. “MicrobiomeKG: bridging microbiome research
209
+ > and host health through knowledge graphs.” *Frontiers in Systems Biology* 5 (2025).
210
+ > [doi:10.3389/fsysb.2025.1544432](https://doi.org/10.3389/fsysb.2025.1544432)
211
+
212
+ ## License
213
+
214
+ [Apache License 2.0](LICENSE)
215
+
216
+ ## Contributors
217
+
218
+ - [Skye Lane Goetz](mailto:sgoetz@isbscience.org) — Institute for Systems Biology
219
+ - [Gwênlyn Glusman](mailto:gglusman@isbscience.org) — Institute for Systems Biology
220
+ - Jared C. Roach — Institute for Systems Biology
221
+
@@ -0,0 +1,167 @@
1
+ # Tablassert
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/tablassert.svg)](https://pypi.org/project/tablassert/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/tablassert.svg)](https://pypi.org/project/tablassert/)
5
+ [![CI](https://github.com/SkyeAv/Tablassert/actions/workflows/ci.yml/badge.svg)](https://github.com/SkyeAv/Tablassert/actions/workflows/ci.yml)
6
+ [![License](https://img.shields.io/pypi/l/tablassert.svg)](https://github.com/SkyeAv/Tablassert/blob/main/LICENSE)
7
+ [![Docs](https://img.shields.io/github/deployments/SkyeAv/Tablassert/github-pages?label=docs)](https://skyeav.github.io/Tablassert/)
8
+
9
+ > Extract knowledge assertions from tabular data into NCATS Translator-compliant KGX NDJSON —
10
+ > declaratively, with entity resolution built in and optional quality control.
11
+
12
+ Tablassert turns biomedical spreadsheets (Excel, CSV, TSV) into knowledge graphs ready for NCATS
13
+ Translator. Declare how your columns map to subject–predicate–object statements in YAML; Tablassert
14
+ resolves free text to standard CURIEs, attaches provenance and statistical annotations, and emits
15
+ KGX-compliant nodes and edges.
16
+
17
+ **[Full Documentation](https://skyeav.github.io/Tablassert/)** — installation guides, tutorial,
18
+ configuration reference, and API docs.
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ pip install tablassert
24
+ ```
25
+
26
+ Given a CSV of gene–disease associations with p-values and sample sizes, declare the mapping in a
27
+ table config (`table.yaml`):
28
+
29
+ ```yaml
30
+ template:
31
+ source:
32
+ kind: text
33
+ local: ./gene-disease.csv
34
+ url: https://example.com/data.csv
35
+ row_slice: [1, auto]
36
+ delimiter: ","
37
+ statement:
38
+ subject: { method: column, encoding: A, prioritize: [Gene] }
39
+ predicate: associated_with
40
+ object: { method: column, encoding: B, prioritize: [Disease] }
41
+ provenance: { repo: PMID, publication: "12345678" }
42
+ annotations:
43
+ - { annotation: p_value, method: column, encoding: C }
44
+ - { annotation: supporting_study_size, method: column, encoding: D }
45
+ ```
46
+
47
+ Wrap it in a graph config (`graph.yaml`) pointing at your fullmap entity-resolution database:
48
+
49
+ ```yaml
50
+ name: MY_KG
51
+ version: 1.0.0
52
+ description: Gene–disease associations extracted from tabular sources.
53
+ tables:
54
+ - ./table.yaml
55
+ fullmap: /path/to/fullmap
56
+ ```
57
+
58
+ Build the knowledge graph:
59
+
60
+ ```bash
61
+ tablassert build-kg graph.yaml
62
+ ```
63
+
64
+ Output is one JSON object per line — nodes with Biolink categories, edges with annotations:
65
+
66
+ ```json
67
+ {"id":"HGNC:11998","name":"TP53","category":["biolink:Gene"],"taxon":"NCBITaxon:9606"}
68
+ {"id":"MONDO:0008903","name":"lung cancer","category":["biolink:Disease"]}
69
+ ```
70
+
71
+ ```json
72
+ {"subject":"HGNC:11998","predicate":"biolink:associated_with","object":"MONDO:0008903","p_value":"1.0000e-03","supporting_study_size":"450"}
73
+ ```
74
+
75
+ See the [Tutorial](https://skyeav.github.io/Tablassert/tutorial/) for the full walkthrough.
76
+
77
+ ## Key Features
78
+
79
+ - **Declarative YAML configuration** — define data transformations without writing code
80
+ - **Built-in entity resolution** — map free text to genes, diseases, and chemicals with standard
81
+ CURIEs, taxonomic filtering, and provenance, backed by an embedded redb database
82
+ - **Optional quality control** — a three-stage audit (exact → fuzzy → BioBERT embeddings) flags
83
+ low-confidence mappings
84
+ - **KGX compliance** — emits NCATS Translator-compatible node/edge NDJSON with Biolink categories
85
+ and predicates
86
+ - **Autonomous agent** — `tablassert agent` derives, builds, and refines configs for whole papers
87
+ - **Performance & reproducibility** — lazy Polars pipelines and a deterministic UV-based
88
+ development environment
89
+
90
+ ## Installation
91
+
92
+ ```bash
93
+ pip install tablassert
94
+ ```
95
+
96
+ Or with uv: `uv tool install tablassert`. The base install builds knowledge graphs from
97
+ CSV/TSV/Excel sources; optional extras add runtime and pipeline capabilities:
98
+
99
+ | Extra | Adds | Install |
100
+ | ----- | ---- | ------- |
101
+ | `rt` | CPU-compatible Polars runtime | `pip install "tablassert[rt]"` |
102
+ | `qc` | three-stage QC audit (exact → fuzzy → BioBERT embeddings) | `pip install "tablassert[qc]"` |
103
+ | `agent` | autonomous agent (smolagents, litellm, PDF context) | `pip install "tablassert[agent]"` |
104
+ | `optimize` | GEPA prompt optimization for `agent --optimize` (dspy) | `pip install "tablassert[optimize]"` |
105
+
106
+ QC is opt-in at build time (`build-kg --qc`). See the
107
+ [Installation guide](https://skyeav.github.io/Tablassert/installation/) for the full matrix and the
108
+ [CLI Reference](https://skyeav.github.io/Tablassert/cli/) for every flag.
109
+
110
+ ## Entity Resolution API
111
+
112
+ ```python
113
+ from pathlib import Path
114
+ from tablassert.lib import resolve_many
115
+
116
+ results = resolve_many(
117
+ col="gene",
118
+ entities=["TP53", "BRCA1"],
119
+ fullmap=Path("/path/to/fullmap"),
120
+ taxon="9606",
121
+ )
122
+ # [{"original_gene": "TP53", "gene": "HGNC:11998", "gene_name": "TP53", ...}, ...]
123
+ ```
124
+
125
+ Point `resolve_many()` at a fullmap database to resolve any iterable of entity strings to CURIEs —
126
+ no LazyFrame setup or NLP preprocessing required. See the
127
+ [Batch Resolution API](https://skyeav.github.io/Tablassert/api/lib/) for the full reference.
128
+
129
+ ## Documentation
130
+
131
+ - **[Installation](https://skyeav.github.io/Tablassert/installation/)** — install methods, extras, and development setup
132
+ - **[Tutorial](https://skyeav.github.io/Tablassert/tutorial/)** — step-by-step example with synthetic data
133
+ - **[CLI Reference](https://skyeav.github.io/Tablassert/cli/)** — complete command-line flag reference
134
+ - **[Use Case Gallery](https://skyeav.github.io/Tablassert/examples/)** — real-world configuration patterns
135
+ - **[Configuration](https://skyeav.github.io/Tablassert/configuration/graph/)** — graph and table configuration reference
136
+ - **[Agent](https://skyeav.github.io/Tablassert/agent/)** — the autonomous agent pipeline
137
+ - **[API Reference](https://skyeav.github.io/Tablassert/api/fullmap/)** — core functions documentation
138
+
139
+ ## Developing
140
+
141
+ ```bash
142
+ uv sync --group dev --extra qc
143
+ uv run maturin develop --manifest-path rust/Cargo.toml
144
+ make check
145
+ ```
146
+
147
+ See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the full development loop, quality gates, and pull
148
+ request guidelines.
149
+
150
+ ## Citation
151
+
152
+ If you use Tablassert, please cite it as described in [CITATION.cff](CITATION.cff). The approach is
153
+ described in:
154
+
155
+ > Skye Lane Goetz, Alex K. Glen, and Gwênlyn Glusman. “MicrobiomeKG: bridging microbiome research
156
+ > and host health through knowledge graphs.” *Frontiers in Systems Biology* 5 (2025).
157
+ > [doi:10.3389/fsysb.2025.1544432](https://doi.org/10.3389/fsysb.2025.1544432)
158
+
159
+ ## License
160
+
161
+ [Apache License 2.0](LICENSE)
162
+
163
+ ## Contributors
164
+
165
+ - [Skye Lane Goetz](mailto:sgoetz@isbscience.org) — Institute for Systems Biology
166
+ - [Gwênlyn Glusman](mailto:gglusman@isbscience.org) — Institute for Systems Biology
167
+ - Jared C. Roach — Institute for Systems Biology
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tablassert"
3
- version = "8.1.0"
3
+ version = "8.2.0"
4
4
  description = "Extract knowledge assertions from tabular data into NCATS Translator-compliant KGX NDJSON — declaratively, with entity resolution and quality control built in."
5
5
  authors = [
6
6
  { name = "Skye Lane Goetz", email = "sgoetz@isbscience.org" }
@@ -84,10 +84,12 @@ qc = [
84
84
  ]
85
85
  agent = [
86
86
  "smolagents>=1.26.0",
87
- "dspy>=3.2.1",
88
87
  "litellm>=1.93.0",
89
88
  "pdfminer.six>=20221105",
90
89
  ]
90
+ optimize = [
91
+ "dspy>=3.2.1",
92
+ ]
91
93
 
92
94
  [dependency-groups]
93
95
  dev = [
@@ -54,15 +54,6 @@ version = "1.0.4"
54
54
  source = "registry+https://github.com/rust-lang/crates.io-index"
55
55
  checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
56
56
 
57
- [[package]]
58
- name = "crc32fast"
59
- version = "1.5.0"
60
- source = "registry+https://github.com/rust-lang/crates.io-index"
61
- checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
62
- dependencies = [
63
- "cfg-if",
64
- ]
65
-
66
57
  [[package]]
67
58
  name = "crossbeam-deque"
68
59
  version = "0.8.7"
@@ -148,8 +139,8 @@ version = "1.1.9"
148
139
  source = "registry+https://github.com/rust-lang/crates.io-index"
149
140
  checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
150
141
  dependencies = [
151
- "crc32fast",
152
142
  "miniz_oxide",
143
+ "zlib-rs",
153
144
  ]
154
145
 
155
146
  [[package]]
@@ -422,9 +413,8 @@ dependencies = [
422
413
 
423
414
  [[package]]
424
415
  name = "redb"
425
- version = "2.6.3"
426
- source = "registry+https://github.com/rust-lang/crates.io-index"
427
- checksum = "8eca1e9d98d5a7e9002d0013e18d5a9b000aee942eb134883a82f06ebffb6c01"
416
+ version = "4.1.0"
417
+ source = "git+https://github.com/cberner/redb.git?rev=a35e7cc86f191d08a444d5973469b34673d586fc#a35e7cc86f191d08a444d5973469b34673d586fc"
428
418
  dependencies = [
429
419
  "libc",
430
420
  ]
@@ -670,6 +660,12 @@ version = "0.8.17"
670
660
  source = "registry+https://github.com/rust-lang/crates.io-index"
671
661
  checksum = "985eec839aaf2a1270af8f4ebcf63cf9401cfd90f0902f97c28d9f104ffbde72"
672
662
 
663
+ [[package]]
664
+ name = "zlib-rs"
665
+ version = "0.6.7"
666
+ source = "registry+https://github.com/rust-lang/crates.io-index"
667
+ checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12"
668
+
673
669
  [[package]]
674
670
  name = "zmij"
675
671
  version = "1.0.23"
@@ -0,0 +1,65 @@
1
+ [package]
2
+ name = "tablassert-rs"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ [lib]
7
+ name = "tablassert_rs"
8
+ crate-type = ["cdylib", "rlib"]
9
+
10
+ [features]
11
+ default = []
12
+ extension-module = ["pyo3/extension-module"]
13
+
14
+ [dependencies]
15
+ bincode = "1"
16
+ # `zlib-rs` backend: the fastest api-compatible DEFLATE decompressor (pure
17
+ # Rust, runtime SIMD multiversioning — no C toolchain needed for wheels).
18
+ # The fullmap build's producer threads decompress ~30-40 GB of BABEL `.gz`;
19
+ # the default miniz_oxide backend is the slowest option. See the flate2
20
+ # README ("if you want maximum performance... use zlib-rs").
21
+ flate2 = { version = "1", features = ["zlib-rs"], default-features = false }
22
+ memmap2 = "0.9"
23
+ mimalloc = { version = "0.1", default-features = false }
24
+ pyo3 = "0.29"
25
+ rayon = "1"
26
+ # Pinned to cberner/redb master (the 4.2.0-to-be, rev a35e7cc 2026-08-10) for
27
+ # two Phase-4 wins not yet published on crates.io (latest stable is 4.1.0):
28
+ # 1. automatic ascending-key insert optimization (~half the pages -> ~half-
29
+ # size shard files + faster reads; our shard inserts are hash-ascending);
30
+ # 2. the experimental cursor API (~3x faster sorted bulk inserts), used by
31
+ # `write_shard_records` via `experimental_cursor`.
32
+ # The file format is still v3, so this is a drop-in engine swap (no schema
33
+ # bump, existing DBs keep opening). Swap back to `redb = "4.2"` once 4.2.0
34
+ # publishes and re-verify the changelog.
35
+ redb = { git = "https://github.com/cberner/redb.git", rev = "a35e7cc86f191d08a444d5973469b34673d586fc", features = ["experimental_cursor"] }
36
+ rlimit = "0.10"
37
+ rustc-hash = "1"
38
+ serde = { version = "1", features = ["derive"] }
39
+ serde_json = { version = "1", features = ["preserve_order"] }
40
+ uuid = { version = "1", features = ["v3"] }
41
+ xxhash-rust = { version = "0.8", features = ["xxh64", "xxh3"] }
42
+
43
+ [dev-dependencies]
44
+ bincode = "1"
45
+ flate2 = { version = "1", features = ["zlib-rs"], default-features = false }
46
+ redb = { git = "https://github.com/cberner/redb.git", rev = "a35e7cc86f191d08a444d5973469b34673d586fc", features = ["experimental_cursor"] }
47
+ serde = { version = "1", features = ["derive"] }
48
+ serde_json = "1"
49
+ tempfile = "3"
50
+
51
+ [lints.rust]
52
+ unused_imports = "deny"
53
+ unused_variables = "deny"
54
+ dead_code = "deny"
55
+
56
+ # Curated low-false-positive clippy lints enforced across the crate (lib +
57
+ # tests + examples). Deliberately NOT denied: needless_pass_by_value and
58
+ # doc_markdown (too noisy / stylistic for this codebase).
59
+ [lints.clippy]
60
+ use_self = "deny"
61
+ uninlined_format_args = "deny"
62
+ redundant_closure_for_method_calls = "deny"
63
+ explicit_iter_loop = "deny"
64
+ match_same_arms = "deny"
65
+ unnested_or_patterns = "deny"
@@ -1,5 +1,6 @@
1
1
  //! Count rows in each table of one or more fullmap redb files.
2
2
  //! Usage: cargo run --release --example count_tables -- <db1> [db2 ...]
3
+ use redb::ReadableDatabase;
3
4
  use redb::ReadableTableMetadata;
4
5
  use redb::TableDefinition;
5
6
 
@@ -11,7 +12,7 @@ const CURIES: TableDefinition<u32, &[u8]> = TableDefinition::new("curies");
11
12
 
12
13
  fn main() {
13
14
  for arg in std::env::args().skip(1) {
14
- let db = redb::Database::open(&arg).expect("open db");
15
+ let db = redb::ReadOnlyDatabase::open(&arg).expect("open db");
15
16
  let read = db.begin_read().expect("begin read");
16
17
  let records = read
17
18
  .open_table(RECORDS)