lorebase-scribe 0.3.0__tar.gz → 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.
- lorebase_scribe-0.4.0/LICENSE +201 -0
- lorebase_scribe-0.4.0/PKG-INFO +53 -0
- lorebase_scribe-0.4.0/README.md +12 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/pyproject.toml +27 -6
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/__init__.py +1 -1
- lorebase_scribe-0.4.0/src/lorebase_scribe/liveness.py +168 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/settings.py +16 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/telemetry.py +33 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/worker.py +177 -23
- lorebase_scribe-0.4.0/tests/test_liveness.py +106 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_telemetry.py +22 -2
- lorebase_scribe-0.4.0/tests/test_worker.py +263 -0
- lorebase_scribe-0.3.0/PKG-INFO +0 -23
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/.gitignore +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/__main__.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/checkpoints.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/consolidation.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/cron.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/embeddings.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/__init__.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/assemble.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/candidates.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/discovery.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/llm_discovery.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/matching.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/ontology.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/parsing.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/pipeline.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/relations.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/sandbox.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/settings.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/text.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/tier2.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/extraction/values.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/jobs.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/__init__.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/detector.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/duplicates.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/extraction.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/semantic.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/sources.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/sweep.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/reconcile/versions.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/scheduler.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/service.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/__init__.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/access.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/connectors.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/delta.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/http_json.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/mapping.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/profile.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/records.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/sql.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/sources/sync.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/src/lorebase_scribe/webhooks.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/conftest.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/conftest.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/extraction_support.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/support.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_audit_checkpoints.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_consolidation.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_document_versions.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_embeddings.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_extraction.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_extraction_local_edit_postgres.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_ingestion_modes.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_lineage_startup.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_local_edits.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_reconciliation.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_schema_suggestions.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_source_sync.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_source_unseen.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_sql_sources.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/integration/test_worker.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/sandbox_targets.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_checkpoint_sinks.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_connectors.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_cron.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_delta.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_extraction_discovery.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_extraction_link_values.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_extraction_local_edit.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_extraction_rules.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_extraction_text.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_extraction_vault_items.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_http_json_connector.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_ingestion_modes.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_llm_discovery.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_mapping.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_parser_sandbox.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_reconcile_merge_check.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_reconcile_semantic.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_reconcile_triggers.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_record_connectors.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_service.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_settings.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_source_connections.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_source_profile.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_sql_connectors.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_webhook_job.py +0 -0
- {lorebase_scribe-0.3.0 → lorebase_scribe-0.4.0}/tests/test_webhook_sender.py +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Antonio Antenore
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: lorebase-scribe
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Lorebase Scribe: job worker, scheduler and Source synchronization
|
|
5
|
+
Project-URL: Homepage, https://github.com/aantenore/lorebase
|
|
6
|
+
Project-URL: Documentation, https://aantenore.github.io/lorebase/
|
|
7
|
+
Project-URL: Repository, https://github.com/aantenore/lorebase
|
|
8
|
+
Project-URL: Changelog, https://github.com/aantenore/lorebase/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/aantenore/lorebase/issues
|
|
10
|
+
Author: Antonio Antenore
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: knowledge-graph,mcp,ontology,postgres,versioning
|
|
14
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Requires-Dist: asyncpg>=0.29
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: lorebase-core<0.5,>=0.4
|
|
25
|
+
Requires-Dist: lorebase-inference<0.5,>=0.4
|
|
26
|
+
Requires-Dist: lorebase-platform<0.5,>=0.4
|
|
27
|
+
Requires-Dist: lorebase-store<0.5,>=0.4
|
|
28
|
+
Requires-Dist: opentelemetry-api>=1.25
|
|
29
|
+
Requires-Dist: pydantic>=2.7
|
|
30
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0.30
|
|
31
|
+
Provides-Extra: documents
|
|
32
|
+
Requires-Dist: pypdf>=4.2; extra == 'documents'
|
|
33
|
+
Requires-Dist: python-docx>=1.1; extra == 'documents'
|
|
34
|
+
Provides-Extra: mssql
|
|
35
|
+
Requires-Dist: pymssql>=2.3; extra == 'mssql'
|
|
36
|
+
Provides-Extra: mysql
|
|
37
|
+
Requires-Dist: asyncmy>=0.2.10; extra == 'mysql'
|
|
38
|
+
Provides-Extra: parquet
|
|
39
|
+
Requires-Dist: pyarrow>=15; extra == 'parquet'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# lorebase-scribe
|
|
43
|
+
|
|
44
|
+
Part of [Lorebase](https://github.com/aantenore/lorebase), an open-source ontology platform: a versioned, governed knowledge graph on Postgres with git-like branching and three-way merge.
|
|
45
|
+
|
|
46
|
+
Scribe, the job worker and scheduler of Lorebase: Source synchronization, extraction, webhooks, index jobs and maintenance passes.
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
uv tool install lorebase-scribe # or: pip install lorebase-scribe
|
|
50
|
+
lorebase-scribe --help
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Documentation: [Scribe](https://aantenore.github.io/lorebase/scribe/) and the [documentation site](https://aantenore.github.io/lorebase/). License: Apache-2.0.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# lorebase-scribe
|
|
2
|
+
|
|
3
|
+
Part of [Lorebase](https://github.com/aantenore/lorebase), an open-source ontology platform: a versioned, governed knowledge graph on Postgres with git-like branching and three-way merge.
|
|
4
|
+
|
|
5
|
+
Scribe, the job worker and scheduler of Lorebase: Source synchronization, extraction, webhooks, index jobs and maintenance passes.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
uv tool install lorebase-scribe # or: pip install lorebase-scribe
|
|
9
|
+
lorebase-scribe --help
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Documentation: [Scribe](https://aantenore.github.io/lorebase/scribe/) and the [documentation site](https://aantenore.github.io/lorebase/). License: Apache-2.0.
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "lorebase-scribe"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "Lorebase Scribe: job worker, scheduler and Source synchronization"
|
|
5
5
|
requires-python = ">=3.12"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Antonio Antenore" }]
|
|
10
|
+
keywords = ["ontology", "knowledge-graph", "mcp", "postgres", "versioning"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Topic :: Database",
|
|
19
|
+
]
|
|
6
20
|
# lorebase-store: job queue, commit pipeline, merges, webhooks, index jobs and GC.
|
|
7
21
|
# lorebase-inference: model interfaces for the extraction jobs to come.
|
|
8
22
|
# httpx: webhook deliveries, CSV Sources served over HTTP(S) and http_json Sources.
|
|
9
23
|
# asyncpg and sqlalchemy: reading Postgres Sources (the drivers the store already uses).
|
|
10
24
|
dependencies = [
|
|
11
|
-
"lorebase-core>=0.
|
|
12
|
-
"lorebase-platform>=0.
|
|
13
|
-
"lorebase-store>=0.
|
|
14
|
-
"lorebase-inference>=0.
|
|
25
|
+
"lorebase-core>=0.4,<0.5",
|
|
26
|
+
"lorebase-platform>=0.4,<0.5",
|
|
27
|
+
"lorebase-store>=0.4,<0.5",
|
|
28
|
+
"lorebase-inference>=0.4,<0.5",
|
|
15
29
|
"sqlalchemy[asyncio]>=2.0.30",
|
|
16
30
|
"asyncpg>=0.29",
|
|
17
31
|
"httpx>=0.27",
|
|
@@ -43,8 +57,15 @@ dev = ["testcontainers[mysql,mssql]>=4.8"]
|
|
|
43
57
|
[project.scripts]
|
|
44
58
|
lorebase-scribe = "lorebase_scribe.__main__:main"
|
|
45
59
|
|
|
60
|
+
[project.urls]
|
|
61
|
+
Homepage = "https://github.com/aantenore/lorebase"
|
|
62
|
+
Documentation = "https://aantenore.github.io/lorebase/"
|
|
63
|
+
Repository = "https://github.com/aantenore/lorebase"
|
|
64
|
+
Changelog = "https://github.com/aantenore/lorebase/blob/main/CHANGELOG.md"
|
|
65
|
+
Issues = "https://github.com/aantenore/lorebase/issues"
|
|
66
|
+
|
|
46
67
|
[build-system]
|
|
47
|
-
requires = ["hatchling"]
|
|
68
|
+
requires = ["hatchling>=1.27"]
|
|
48
69
|
build-backend = "hatchling.build"
|
|
49
70
|
|
|
50
71
|
[tool.hatch.build.targets.wheel]
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"""Liveness of a job loop through a file it rewrites (`scribe.worker.liveness_file`).
|
|
2
|
+
|
|
3
|
+
Scribe serves no HTTP, so a container healthcheck or a Kubernetes probe reads the file the
|
|
4
|
+
worker rewrites every `scribe.worker.liveness_interval_s`:
|
|
5
|
+
|
|
6
|
+
python -m lorebase_scribe.liveness /tmp/scribe-liveness.json [--max-age SECONDS]
|
|
7
|
+
[--min-slots N] [--max-store-age SECONDS]
|
|
8
|
+
|
|
9
|
+
The check passes (exit 0, one line on stdout) while the file was written within `--max-age`
|
|
10
|
+
(default: `STALE_INTERVALS` times the interval recorded in it) by a loop with at least
|
|
11
|
+
`--min-slots` live slots (default 1); with `--max-store-age` the loop must also have reached
|
|
12
|
+
the store, by a claim or a heartbeat, within that long (a readiness probe). Otherwise it exits
|
|
13
|
+
1 and says why: no file (the worker has not started, or the setting is unset), a stale file
|
|
14
|
+
(the process hangs or is gone), no live slot, or a store not reached. The module imports the
|
|
15
|
+
standard library only, so a check costs one interpreter start.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import argparse
|
|
21
|
+
import json
|
|
22
|
+
import os
|
|
23
|
+
import time
|
|
24
|
+
from collections.abc import Sequence
|
|
25
|
+
from dataclasses import dataclass
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
from typing import Any
|
|
28
|
+
|
|
29
|
+
STALE_INTERVALS = 3
|
|
30
|
+
"""Default `--max-age`, as a multiple of the interval the file records."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class Liveness:
|
|
35
|
+
"""What the loop reports: written by `write_liveness`, read back by `check_liveness`."""
|
|
36
|
+
|
|
37
|
+
worker: str
|
|
38
|
+
interval_s: float
|
|
39
|
+
live_slots: int
|
|
40
|
+
configured_slots: int
|
|
41
|
+
running: tuple[int, ...]
|
|
42
|
+
store_reached_at: float | None
|
|
43
|
+
"""Wall-clock time (`time.time()`) of the last claim or heartbeat round trip."""
|
|
44
|
+
written_at: float
|
|
45
|
+
|
|
46
|
+
def as_dict(self) -> dict[str, Any]:
|
|
47
|
+
return {
|
|
48
|
+
"worker": self.worker,
|
|
49
|
+
"interval_s": self.interval_s,
|
|
50
|
+
"slots": {"live": self.live_slots, "configured": self.configured_slots},
|
|
51
|
+
"running": list(self.running),
|
|
52
|
+
"store_reached_at": self.store_reached_at,
|
|
53
|
+
"written_at": self.written_at,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_dict(cls, data: dict[str, Any]) -> Liveness:
|
|
58
|
+
slots = data["slots"]
|
|
59
|
+
reached = data.get("store_reached_at")
|
|
60
|
+
return cls(
|
|
61
|
+
worker=str(data["worker"]),
|
|
62
|
+
interval_s=float(data["interval_s"]),
|
|
63
|
+
live_slots=int(slots["live"]),
|
|
64
|
+
configured_slots=int(slots["configured"]),
|
|
65
|
+
running=tuple(int(job) for job in data.get("running", [])),
|
|
66
|
+
store_reached_at=None if reached is None else float(reached),
|
|
67
|
+
written_at=float(data["written_at"]),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def write_liveness(path: Path, state: Liveness) -> None:
|
|
72
|
+
"""Write `state` to `path` in one step (a reader never sees a partial file)."""
|
|
73
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
74
|
+
tmp = path.with_name(f"{path.name}.{os.getpid()}.tmp")
|
|
75
|
+
tmp.write_text(json.dumps(state.as_dict(), sort_keys=True))
|
|
76
|
+
os.replace(tmp, path)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def remove_liveness(path: Path) -> None:
|
|
80
|
+
"""Remove the file (a loop that stopped leaves none behind for a probe to trust)."""
|
|
81
|
+
path.unlink(missing_ok=True)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def read_liveness(path: Path) -> Liveness:
|
|
85
|
+
"""The state in `path`; `OSError` when it cannot be read, `ValueError` when it is not one."""
|
|
86
|
+
try:
|
|
87
|
+
return Liveness.from_dict(json.loads(path.read_text()))
|
|
88
|
+
except (KeyError, TypeError, json.JSONDecodeError) as exc:
|
|
89
|
+
raise ValueError(f"not a liveness file: {exc}") from exc
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def check_liveness(
|
|
93
|
+
path: Path,
|
|
94
|
+
*,
|
|
95
|
+
now: float | None = None,
|
|
96
|
+
max_age_s: float | None = None,
|
|
97
|
+
min_slots: int = 1,
|
|
98
|
+
max_store_age_s: float | None = None,
|
|
99
|
+
) -> tuple[bool, str]:
|
|
100
|
+
"""Whether the file says the loop is live, and one line saying why."""
|
|
101
|
+
try:
|
|
102
|
+
state = read_liveness(path)
|
|
103
|
+
except OSError as exc:
|
|
104
|
+
return (
|
|
105
|
+
False,
|
|
106
|
+
f"no liveness file at {path} ({exc.strerror or exc}): the worker has not started",
|
|
107
|
+
)
|
|
108
|
+
except ValueError as exc:
|
|
109
|
+
return False, f"{path}: {exc}"
|
|
110
|
+
at = time.time() if now is None else now
|
|
111
|
+
age = at - state.written_at
|
|
112
|
+
limit = state.interval_s * STALE_INTERVALS if max_age_s is None else max_age_s
|
|
113
|
+
summary = (
|
|
114
|
+
f"{state.live_slots} of {state.configured_slots} slots live, "
|
|
115
|
+
f"{len(state.running)} jobs running, written {age:.1f} s ago"
|
|
116
|
+
)
|
|
117
|
+
if age > limit:
|
|
118
|
+
return False, f"liveness file is {age:.1f} s old (limit {limit:g} s): {summary}"
|
|
119
|
+
if state.live_slots < min_slots:
|
|
120
|
+
return False, f"fewer than {min_slots} live slots: {summary}"
|
|
121
|
+
if max_store_age_s is not None:
|
|
122
|
+
if state.store_reached_at is None:
|
|
123
|
+
return False, f"the store was not reached yet: {summary}"
|
|
124
|
+
store_age = at - state.store_reached_at
|
|
125
|
+
if store_age > max_store_age_s:
|
|
126
|
+
return (
|
|
127
|
+
False,
|
|
128
|
+
f"the store was last reached {store_age:.1f} s ago (limit "
|
|
129
|
+
f"{max_store_age_s:g} s): {summary}",
|
|
130
|
+
)
|
|
131
|
+
return True, f"live: {summary}"
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
135
|
+
parser = argparse.ArgumentParser(
|
|
136
|
+
prog="python -m lorebase_scribe.liveness", description=__doc__.split("\n")[0]
|
|
137
|
+
)
|
|
138
|
+
parser.add_argument("path", type=Path, help="The file named by scribe.worker.liveness_file.")
|
|
139
|
+
parser.add_argument(
|
|
140
|
+
"--max-age",
|
|
141
|
+
type=float,
|
|
142
|
+
default=None,
|
|
143
|
+
metavar="SECONDS",
|
|
144
|
+
help=f"Oldest file accepted (default: {STALE_INTERVALS} times the interval it records).",
|
|
145
|
+
)
|
|
146
|
+
parser.add_argument(
|
|
147
|
+
"--min-slots", type=int, default=1, metavar="N", help="Live slots required (default 1)."
|
|
148
|
+
)
|
|
149
|
+
parser.add_argument(
|
|
150
|
+
"--max-store-age",
|
|
151
|
+
type=float,
|
|
152
|
+
default=None,
|
|
153
|
+
metavar="SECONDS",
|
|
154
|
+
help="Also require the store reached within this long (a readiness probe).",
|
|
155
|
+
)
|
|
156
|
+
args = parser.parse_args(argv)
|
|
157
|
+
live, reason = check_liveness(
|
|
158
|
+
args.path,
|
|
159
|
+
max_age_s=args.max_age,
|
|
160
|
+
min_slots=args.min_slots,
|
|
161
|
+
max_store_age_s=args.max_store_age,
|
|
162
|
+
)
|
|
163
|
+
print(reason)
|
|
164
|
+
return 0 if live else 1
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
raise SystemExit(main())
|
|
@@ -57,6 +57,22 @@ class WorkerSettings(SectionModel):
|
|
|
57
57
|
"(collections and index builds run long). Postgres Sources use "
|
|
58
58
|
"scribe.sources.postgres.statement_timeout_ms.",
|
|
59
59
|
)
|
|
60
|
+
outcome_retry_delay_s: float = Field(
|
|
61
|
+
default=1.0,
|
|
62
|
+
ge=0,
|
|
63
|
+
description="Pause before the one more try at writing a job's outcome when the first "
|
|
64
|
+
"write failed (a dropped connection, a statement timeout). When that fails too the "
|
|
65
|
+
"job counts as unrecorded and runs again once its lock goes stale.",
|
|
66
|
+
)
|
|
67
|
+
liveness_file: str | None = Field(
|
|
68
|
+
default=None,
|
|
69
|
+
description="Path of a file the job loop rewrites every liveness_interval_s with its "
|
|
70
|
+
"live slots, running jobs and the time it last reached the store, for a container "
|
|
71
|
+
"healthcheck or a probe (`python -m lorebase_scribe.liveness FILE`); null writes none.",
|
|
72
|
+
)
|
|
73
|
+
liveness_interval_s: float = Field(
|
|
74
|
+
default=10.0, gt=0, description="How often the liveness file is rewritten."
|
|
75
|
+
)
|
|
60
76
|
principal: str = Field(
|
|
61
77
|
default="svc_scribe",
|
|
62
78
|
min_length=1,
|
|
@@ -157,3 +157,36 @@ meter.create_observable_gauge(
|
|
|
157
157
|
description="Open reconciliation candidates by Domain and type, counted by each "
|
|
158
158
|
"reconcile_sweep job.",
|
|
159
159
|
)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class WorkerSlots:
|
|
163
|
+
"""The slots of this process's job loop as the worker last reported them: `live` run the
|
|
164
|
+
claim loop, `lost` ended with an error and wait to be started again. Nothing is reported
|
|
165
|
+
before the worker runs or after it stopped."""
|
|
166
|
+
|
|
167
|
+
def __init__(self) -> None:
|
|
168
|
+
self._lock = Lock()
|
|
169
|
+
self._counts: dict[str, int] | None = None
|
|
170
|
+
|
|
171
|
+
def update(self, *, live: int, configured: int) -> None:
|
|
172
|
+
with self._lock:
|
|
173
|
+
self._counts = {"live": live, "lost": max(configured - live, 0)}
|
|
174
|
+
|
|
175
|
+
def clear(self) -> None:
|
|
176
|
+
with self._lock:
|
|
177
|
+
self._counts = None
|
|
178
|
+
|
|
179
|
+
def observe(self, _options: CallbackOptions | None = None) -> Iterable[Observation]:
|
|
180
|
+
with self._lock:
|
|
181
|
+
counts = dict(self._counts or {})
|
|
182
|
+
return [Observation(count, {"state": state}) for state, count in sorted(counts.items())]
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
WORKER_SLOTS = WorkerSlots()
|
|
186
|
+
meter.create_observable_gauge(
|
|
187
|
+
"lorebase.scribe.worker.slots",
|
|
188
|
+
callbacks=[WORKER_SLOTS.observe],
|
|
189
|
+
unit="{slot}",
|
|
190
|
+
description="Slots of this process's job loop by state: live (claiming and running jobs) "
|
|
191
|
+
"or lost (ended with an error; started again after scribe.worker.poll_interval_s).",
|
|
192
|
+
)
|