xrtm-data 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.
- xrtm_data-0.1.0/LICENSE +201 -0
- xrtm_data-0.1.0/PKG-INFO +68 -0
- xrtm_data-0.1.0/README.md +49 -0
- xrtm_data-0.1.0/pyproject.toml +51 -0
- xrtm_data-0.1.0/setup.cfg +4 -0
- xrtm_data-0.1.0/src/xrtm/data/__init__.py +30 -0
- xrtm_data-0.1.0/src/xrtm/data/providers/data/__init__.py +4 -0
- xrtm_data-0.1.0/src/xrtm/data/providers/data/base.py +24 -0
- xrtm_data-0.1.0/src/xrtm/data/providers/data/local.py +52 -0
- xrtm_data-0.1.0/src/xrtm/data/providers/data/online/__init__.py +3 -0
- xrtm_data-0.1.0/src/xrtm/data/providers/data/online/polymarket.py +68 -0
- xrtm_data-0.1.0/src/xrtm/data/schemas/__init__.py +3 -0
- xrtm_data-0.1.0/src/xrtm/data/schemas/forecast.py +137 -0
- xrtm_data-0.1.0/src/xrtm_data.egg-info/PKG-INFO +68 -0
- xrtm_data-0.1.0/src/xrtm_data.egg-info/SOURCES.txt +17 -0
- xrtm_data-0.1.0/src/xrtm_data.egg-info/dependency_links.txt +1 -0
- xrtm_data-0.1.0/src/xrtm_data.egg-info/requires.txt +9 -0
- xrtm_data-0.1.0/src/xrtm_data.egg-info/top_level.txt +1 -0
- xrtm_data-0.1.0/tests/test_schemas.py +81 -0
xrtm_data-0.1.0/LICENSE
ADDED
|
@@ -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 tour (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 XRTM Team
|
|
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/
|
|
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.
|
xrtm_data-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xrtm-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Snapshot Vault for XRTM.
|
|
5
|
+
Author-email: XRTM Team <moy@xrtm.org>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pydantic>=2.0.0
|
|
11
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
16
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
17
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# xrtm-data
|
|
21
|
+
|
|
22
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
23
|
+
[](https://www.python.org/downloads/)
|
|
24
|
+
|
|
25
|
+
**The Snapshot Vault for XRTM.**
|
|
26
|
+
|
|
27
|
+
`xrtm-data` provides the rigid schemas and temporal sandboxing infrastructure required for zero-leakage forecasting. It defines the "Ground Truth" data structures that the rest of the ecosystem (Forecast, Eval, Train) relies on.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv pip install xrtm-data
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Core Primitives
|
|
36
|
+
|
|
37
|
+
### 1. The Forecast Object Standard
|
|
38
|
+
Adhering to strict **Governance v1**, the `ForecastOutput` schema mandates that every prediction be accompanied by a structured causal graph (`logical_trace`) and a calibrated confidence interval.
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from xrtm.data import ForecastOutput, CausalNode
|
|
42
|
+
|
|
43
|
+
prediction = ForecastOutput(
|
|
44
|
+
question_id="q_123",
|
|
45
|
+
probability=0.75,
|
|
46
|
+
reasoning="Base rate analysis suggests...",
|
|
47
|
+
logical_trace=[
|
|
48
|
+
CausalNode(event="Inflation rises", probability=0.8),
|
|
49
|
+
CausalNode(event="Fed cuts rates", probability=0.4)
|
|
50
|
+
]
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Zero Leakage
|
|
55
|
+
The `MetadataBase` enforces a strict `snapshot_time`. This timestamp represents the "End of History" for the model. Any data point generated after this time is considered "Future Leakage" and is programmatically inaccessible during backtesting.
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
Prerequisites:
|
|
60
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Install dependencies
|
|
64
|
+
uv sync
|
|
65
|
+
|
|
66
|
+
# Run tests
|
|
67
|
+
uv run pytest
|
|
68
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# xrtm-data
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
|
|
6
|
+
**The Snapshot Vault for XRTM.**
|
|
7
|
+
|
|
8
|
+
`xrtm-data` provides the rigid schemas and temporal sandboxing infrastructure required for zero-leakage forecasting. It defines the "Ground Truth" data structures that the rest of the ecosystem (Forecast, Eval, Train) relies on.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv pip install xrtm-data
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Core Primitives
|
|
17
|
+
|
|
18
|
+
### 1. The Forecast Object Standard
|
|
19
|
+
Adhering to strict **Governance v1**, the `ForecastOutput` schema mandates that every prediction be accompanied by a structured causal graph (`logical_trace`) and a calibrated confidence interval.
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from xrtm.data import ForecastOutput, CausalNode
|
|
23
|
+
|
|
24
|
+
prediction = ForecastOutput(
|
|
25
|
+
question_id="q_123",
|
|
26
|
+
probability=0.75,
|
|
27
|
+
reasoning="Base rate analysis suggests...",
|
|
28
|
+
logical_trace=[
|
|
29
|
+
CausalNode(event="Inflation rises", probability=0.8),
|
|
30
|
+
CausalNode(event="Fed cuts rates", probability=0.4)
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Zero Leakage
|
|
36
|
+
The `MetadataBase` enforces a strict `snapshot_time`. This timestamp represents the "End of History" for the model. Any data point generated after this time is considered "Future Leakage" and is programmatically inaccessible during backtesting.
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
Prerequisites:
|
|
41
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Install dependencies
|
|
45
|
+
uv sync
|
|
46
|
+
|
|
47
|
+
# Run tests
|
|
48
|
+
uv run pytest
|
|
49
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xrtm-data"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "The Snapshot Vault for XRTM."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "XRTM Team", email = "moy@xrtm.org"}
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"pydantic>=2.0.0",
|
|
17
|
+
"aiohttp>=3.9.0",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
dev = [
|
|
22
|
+
"pytest>=7.0.0",
|
|
23
|
+
"pytest-asyncio>=0.21.0",
|
|
24
|
+
"pytest-cov>=4.1.0",
|
|
25
|
+
"ruff>=0.1.0",
|
|
26
|
+
"mypy>=1.0.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools]
|
|
30
|
+
package-dir = {"" = "src"}
|
|
31
|
+
packages = {find = {where = ["src"], include = ["xrtm*"], namespaces = true}}
|
|
32
|
+
|
|
33
|
+
[tool.pytest.ini_options]
|
|
34
|
+
pythonpath = ["."]
|
|
35
|
+
testpaths = ["tests"]
|
|
36
|
+
asyncio_mode = "strict"
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
line-length = 120
|
|
40
|
+
target-version = "py311"
|
|
41
|
+
exclude = [".git", ".venv", "build", "dist"]
|
|
42
|
+
|
|
43
|
+
[tool.ruff.lint]
|
|
44
|
+
select = ["E", "F", "I", "W"]
|
|
45
|
+
ignore = ["E501"]
|
|
46
|
+
|
|
47
|
+
[tool.mypy]
|
|
48
|
+
python_version = "3.11"
|
|
49
|
+
ignore_missing_imports = true
|
|
50
|
+
strict = false
|
|
51
|
+
explicit_package_bases = true
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2026 XRTM Team. All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
from xrtm.data.schemas.forecast import (
|
|
17
|
+
CausalEdge,
|
|
18
|
+
CausalNode,
|
|
19
|
+
ForecastOutput,
|
|
20
|
+
ForecastQuestion,
|
|
21
|
+
MetadataBase,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"MetadataBase",
|
|
26
|
+
"ForecastQuestion",
|
|
27
|
+
"ForecastOutput",
|
|
28
|
+
"CausalNode",
|
|
29
|
+
"CausalEdge",
|
|
30
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2026 XRTM Team. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import abc
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
|
|
7
|
+
from xrtm.data.schemas.forecast import ForecastQuestion
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DataSource(abc.ABC):
|
|
11
|
+
r"""
|
|
12
|
+
Abstract interface for gathering or streaming forecasting workloads.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@abc.abstractmethod
|
|
16
|
+
async def fetch_questions(self, query: Optional[str] = None, limit: int = 5) -> List[ForecastQuestion]:
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abc.abstractmethod
|
|
20
|
+
async def get_question_by_id(self, question_id: str) -> Optional[ForecastQuestion]:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
__all__ = ["DataSource"]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2026 XRTM Team. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import logging
|
|
6
|
+
from typing import List, Optional
|
|
7
|
+
|
|
8
|
+
from xrtm.data.providers.data.base import DataSource
|
|
9
|
+
from xrtm.data.schemas.forecast import ForecastQuestion
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
__all__ = ["LocalDataSource"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class LocalDataSource(DataSource):
|
|
17
|
+
r"""
|
|
18
|
+
DataSource implementation that reads from a local JSON file.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, file_path: str):
|
|
22
|
+
self.file_path = file_path
|
|
23
|
+
|
|
24
|
+
async def fetch_questions(self, query: Optional[str] = None, limit: int = 5) -> List[ForecastQuestion]:
|
|
25
|
+
try:
|
|
26
|
+
with open(self.file_path, "r") as f:
|
|
27
|
+
data = json.load(f)
|
|
28
|
+
|
|
29
|
+
questions = []
|
|
30
|
+
for item in data:
|
|
31
|
+
if not query or query.lower() in item.get("title", "").lower():
|
|
32
|
+
questions.append(ForecastQuestion(**item))
|
|
33
|
+
|
|
34
|
+
if len(questions) >= limit:
|
|
35
|
+
break
|
|
36
|
+
return questions
|
|
37
|
+
except Exception as e:
|
|
38
|
+
logger.error(f"Failed to read local questions from {self.file_path}: {e}")
|
|
39
|
+
return []
|
|
40
|
+
|
|
41
|
+
async def get_question_by_id(self, question_id: str) -> Optional[ForecastQuestion]:
|
|
42
|
+
try:
|
|
43
|
+
with open(self.file_path, "r") as f:
|
|
44
|
+
data = json.load(f)
|
|
45
|
+
|
|
46
|
+
for item in data:
|
|
47
|
+
if item.get("id") == question_id:
|
|
48
|
+
return ForecastQuestion(**item)
|
|
49
|
+
return None
|
|
50
|
+
except Exception as e:
|
|
51
|
+
logger.error(f"Failed to retrieve question {question_id} from {self.file_path}: {e}")
|
|
52
|
+
return None
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2026 XRTM Team. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
import aiohttp
|
|
8
|
+
|
|
9
|
+
from xrtm.data.providers.data.base import DataSource
|
|
10
|
+
from xrtm.data.schemas.forecast import ForecastQuestion, MetadataBase
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
__all__ = ["PolymarketSource"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class PolymarketSource(DataSource):
|
|
18
|
+
r"""
|
|
19
|
+
DataSource implementation that fetches from the Polymarket Gamma API.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
API_BASE = "https://gamma-api.polymarket.com"
|
|
23
|
+
|
|
24
|
+
async def fetch_questions(self, query: Optional[str] = None, limit: int = 5) -> List[ForecastQuestion]:
|
|
25
|
+
url = f"{self.API_BASE}/events?active=true&closed=false&limit={limit}"
|
|
26
|
+
if query:
|
|
27
|
+
url += f"&search={query}"
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
async with aiohttp.ClientSession() as session:
|
|
31
|
+
async with session.get(url) as resp:
|
|
32
|
+
if resp.status != 200:
|
|
33
|
+
logger.error(f"Polymarket API returned status {resp.status}")
|
|
34
|
+
return []
|
|
35
|
+
|
|
36
|
+
data = await resp.json()
|
|
37
|
+
questions = []
|
|
38
|
+
for item in data:
|
|
39
|
+
questions.append(self._normalize(item))
|
|
40
|
+
return questions
|
|
41
|
+
except Exception as e:
|
|
42
|
+
logger.error(f"Failed to fetch questions from Polymarket: {e}")
|
|
43
|
+
return []
|
|
44
|
+
|
|
45
|
+
async def get_question_by_id(self, question_id: str) -> Optional[ForecastQuestion]:
|
|
46
|
+
url = f"{self.API_BASE}/events/{question_id}"
|
|
47
|
+
try:
|
|
48
|
+
async with aiohttp.ClientSession() as session:
|
|
49
|
+
async with session.get(url) as resp:
|
|
50
|
+
if resp.status == 200:
|
|
51
|
+
return self._normalize(await resp.json())
|
|
52
|
+
return None
|
|
53
|
+
except Exception as e:
|
|
54
|
+
logger.error(f"Failed to retrieve Polymarket event {question_id}: {e}")
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
def _normalize(self, item: Dict[str, Any]) -> ForecastQuestion:
|
|
58
|
+
return ForecastQuestion(
|
|
59
|
+
id=str(item.get("id", "")),
|
|
60
|
+
title=item.get("title", "Untitled Event"),
|
|
61
|
+
content=item.get("description", ""),
|
|
62
|
+
metadata=MetadataBase(
|
|
63
|
+
tags=item.get("tags", []),
|
|
64
|
+
subject_type="binary",
|
|
65
|
+
source_version="polymarket-gamma-v1",
|
|
66
|
+
raw_data=item,
|
|
67
|
+
),
|
|
68
|
+
)
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2026 XRTM Team. All rights reserved.
|
|
3
|
+
|
|
4
|
+
from datetime import datetime, timezone
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from pydantic import AliasChoices, BaseModel, ConfigDict, Field
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MetadataBase(BaseModel):
|
|
11
|
+
r"""
|
|
12
|
+
A foundational metadata block used to ensure consistency across schemas.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
model_config = ConfigDict(extra="allow")
|
|
16
|
+
id: str = Field(default_factory=lambda: "meta_" + str(datetime.now(timezone.utc).timestamp()))
|
|
17
|
+
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
18
|
+
snapshot_time: datetime = Field(
|
|
19
|
+
default_factory=lambda: datetime.now(timezone.utc),
|
|
20
|
+
description="Zero Leakage: The specific 'Time T' at which the world state was frozen."
|
|
21
|
+
)
|
|
22
|
+
tags: List[str] = Field(default_factory=list)
|
|
23
|
+
subject_type: Optional[str] = None
|
|
24
|
+
source_version: Optional[str] = None
|
|
25
|
+
raw_data: Optional[Dict[str, Any]] = None
|
|
26
|
+
|
|
27
|
+
def get(self, key: str, default: Any = None) -> Any:
|
|
28
|
+
r"""Backward compatibility for dict-like access."""
|
|
29
|
+
return getattr(self, key, default)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ForecastQuestion(BaseModel):
|
|
33
|
+
r"""
|
|
34
|
+
The standardized input format for a forecasting task.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
id: str = Field(..., description="Unique identifier for the question")
|
|
38
|
+
title: str = Field(..., description="The main question or statement being forecasted")
|
|
39
|
+
description: Optional[str] = Field(
|
|
40
|
+
None,
|
|
41
|
+
alias="content",
|
|
42
|
+
validation_alias=AliasChoices("description", "content"),
|
|
43
|
+
description="Detailed context and background",
|
|
44
|
+
)
|
|
45
|
+
resolution_criteria: Optional[str] = Field(None, description="Explicit rules for ground truth determination")
|
|
46
|
+
metadata: MetadataBase = Field(default_factory=MetadataBase)
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def content(self) -> Optional[str]:
|
|
50
|
+
r"""Backward compatibility alias for description."""
|
|
51
|
+
return self.description
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class CausalNode(BaseModel):
|
|
55
|
+
r"""
|
|
56
|
+
Represents a single step in a logical reasoning chain.
|
|
57
|
+
"""
|
|
58
|
+
event: str = Field(..., description="The assumption or event in the chain")
|
|
59
|
+
probability: Optional[float] = Field(None, ge=0, le=1)
|
|
60
|
+
description: Optional[str] = None
|
|
61
|
+
node_id: str = Field(
|
|
62
|
+
default_factory=lambda: "node_" + str(datetime.now().timestamp()), description="Unique ID for graph operations"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class CausalEdge(BaseModel):
|
|
67
|
+
r"""
|
|
68
|
+
Represents a directed causal dependency between two reasoning nodes.
|
|
69
|
+
"""
|
|
70
|
+
source: str
|
|
71
|
+
target: str
|
|
72
|
+
weight: float = Field(default=1.0, ge=0, le=1)
|
|
73
|
+
description: Optional[str] = None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ConfidenceInterval(BaseModel):
|
|
77
|
+
r"""Standard range for probabilistic calibration."""
|
|
78
|
+
low: float
|
|
79
|
+
high: float
|
|
80
|
+
level: float = 0.9
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class ForecastOutput(BaseModel):
|
|
84
|
+
r"""
|
|
85
|
+
The structured result of an agent's forecasting reasoning, compliant with Governance v1.
|
|
86
|
+
"""
|
|
87
|
+
question_id: str
|
|
88
|
+
probability: float = Field(
|
|
89
|
+
...,
|
|
90
|
+
alias="confidence",
|
|
91
|
+
validation_alias=AliasChoices("probability", "confidence"),
|
|
92
|
+
ge=0,
|
|
93
|
+
le=1,
|
|
94
|
+
description="The assigned probability of the primary outcome",
|
|
95
|
+
)
|
|
96
|
+
uncertainty: Optional[float] = Field(None, ge=0, le=1)
|
|
97
|
+
confidence_interval: Optional[ConfidenceInterval] = None
|
|
98
|
+
reasoning: str = Field(..., description="Narrative reasoning for the forecast")
|
|
99
|
+
logical_trace: List[CausalNode] = Field(
|
|
100
|
+
default_factory=list, description="The Bayesian-style sequence of assumptions (Mental Model)"
|
|
101
|
+
)
|
|
102
|
+
logical_edges: List[CausalEdge] = Field(
|
|
103
|
+
default_factory=list, description="Causal dependencies between nodes in the trace"
|
|
104
|
+
)
|
|
105
|
+
structural_trace: List[str] = Field(default_factory=list, description="Order of graph nodes executed (Audit Trail)")
|
|
106
|
+
calibration_metrics: Dict[str, Any] = Field(default_factory=dict)
|
|
107
|
+
metadata: MetadataBase = Field(default_factory=MetadataBase)
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def confidence(self) -> float:
|
|
111
|
+
r"""Backward compatibility alias for probability."""
|
|
112
|
+
return self.probability
|
|
113
|
+
|
|
114
|
+
@confidence.setter
|
|
115
|
+
def confidence(self, value: float):
|
|
116
|
+
r"""Backward compatibility setter for probability."""
|
|
117
|
+
self.probability = value
|
|
118
|
+
|
|
119
|
+
def to_networkx(self) -> Any:
|
|
120
|
+
try:
|
|
121
|
+
import networkx as nx
|
|
122
|
+
except ImportError:
|
|
123
|
+
raise ImportError("networkx is required for to_networkx(). Install it with 'pip install networkx'.")
|
|
124
|
+
dg = nx.DiGraph()
|
|
125
|
+
for node in self.logical_trace:
|
|
126
|
+
dg.add_node(
|
|
127
|
+
node.node_id,
|
|
128
|
+
event=node.event,
|
|
129
|
+
probability=node.probability,
|
|
130
|
+
description=node.description,
|
|
131
|
+
)
|
|
132
|
+
for edge in self.logical_edges:
|
|
133
|
+
dg.add_edge(edge.source, edge.target, weight=edge.weight, description=edge.description)
|
|
134
|
+
return dg
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
__all__ = ["MetadataBase", "ForecastQuestion", "CausalNode", "CausalEdge", "ForecastOutput"]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xrtm-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Snapshot Vault for XRTM.
|
|
5
|
+
Author-email: XRTM Team <moy@xrtm.org>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pydantic>=2.0.0
|
|
11
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
16
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
17
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# xrtm-data
|
|
21
|
+
|
|
22
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
23
|
+
[](https://www.python.org/downloads/)
|
|
24
|
+
|
|
25
|
+
**The Snapshot Vault for XRTM.**
|
|
26
|
+
|
|
27
|
+
`xrtm-data` provides the rigid schemas and temporal sandboxing infrastructure required for zero-leakage forecasting. It defines the "Ground Truth" data structures that the rest of the ecosystem (Forecast, Eval, Train) relies on.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv pip install xrtm-data
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Core Primitives
|
|
36
|
+
|
|
37
|
+
### 1. The Forecast Object Standard
|
|
38
|
+
Adhering to strict **Governance v1**, the `ForecastOutput` schema mandates that every prediction be accompanied by a structured causal graph (`logical_trace`) and a calibrated confidence interval.
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from xrtm.data import ForecastOutput, CausalNode
|
|
42
|
+
|
|
43
|
+
prediction = ForecastOutput(
|
|
44
|
+
question_id="q_123",
|
|
45
|
+
probability=0.75,
|
|
46
|
+
reasoning="Base rate analysis suggests...",
|
|
47
|
+
logical_trace=[
|
|
48
|
+
CausalNode(event="Inflation rises", probability=0.8),
|
|
49
|
+
CausalNode(event="Fed cuts rates", probability=0.4)
|
|
50
|
+
]
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Zero Leakage
|
|
55
|
+
The `MetadataBase` enforces a strict `snapshot_time`. This timestamp represents the "End of History" for the model. Any data point generated after this time is considered "Future Leakage" and is programmatically inaccessible during backtesting.
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
Prerequisites:
|
|
60
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Install dependencies
|
|
64
|
+
uv sync
|
|
65
|
+
|
|
66
|
+
# Run tests
|
|
67
|
+
uv run pytest
|
|
68
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/xrtm/data/__init__.py
|
|
5
|
+
src/xrtm/data/providers/data/__init__.py
|
|
6
|
+
src/xrtm/data/providers/data/base.py
|
|
7
|
+
src/xrtm/data/providers/data/local.py
|
|
8
|
+
src/xrtm/data/providers/data/online/__init__.py
|
|
9
|
+
src/xrtm/data/providers/data/online/polymarket.py
|
|
10
|
+
src/xrtm/data/schemas/__init__.py
|
|
11
|
+
src/xrtm/data/schemas/forecast.py
|
|
12
|
+
src/xrtm_data.egg-info/PKG-INFO
|
|
13
|
+
src/xrtm_data.egg-info/SOURCES.txt
|
|
14
|
+
src/xrtm_data.egg-info/dependency_links.txt
|
|
15
|
+
src/xrtm_data.egg-info/requires.txt
|
|
16
|
+
src/xrtm_data.egg-info/top_level.txt
|
|
17
|
+
tests/test_schemas.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xrtm
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2026 XRTM Team. All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
import pytest
|
|
18
|
+
|
|
19
|
+
from xrtm.data import CausalEdge, CausalNode, ForecastOutput
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_forecast_output_initialization():
|
|
23
|
+
"""Verify that we can create a valid ForecastOutput object."""
|
|
24
|
+
output = ForecastOutput(
|
|
25
|
+
question_id="test_q_1",
|
|
26
|
+
probability=0.8,
|
|
27
|
+
reasoning="Test reasoning",
|
|
28
|
+
logical_trace=[
|
|
29
|
+
CausalNode(event="Event A", probability=0.9),
|
|
30
|
+
CausalNode(event="Event B", probability=0.8)
|
|
31
|
+
],
|
|
32
|
+
logical_edges=[
|
|
33
|
+
CausalEdge(source="node_1", target="node_2")
|
|
34
|
+
]
|
|
35
|
+
)
|
|
36
|
+
assert output.probability == 0.8
|
|
37
|
+
assert len(output.logical_trace) == 2
|
|
38
|
+
|
|
39
|
+
def test_forecast_output_validation_range():
|
|
40
|
+
"""Verify that probability range is enforced."""
|
|
41
|
+
with pytest.raises(ValueError):
|
|
42
|
+
ForecastOutput(
|
|
43
|
+
question_id="test_q_2",
|
|
44
|
+
probability=1.5, # Invalid > 1.0
|
|
45
|
+
reasoning="Invalid prob"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def test_backward_compatibility_aliases():
|
|
49
|
+
"""Verify legacy aliases work (confidence -> probability)."""
|
|
50
|
+
output = ForecastOutput(
|
|
51
|
+
question_id="test_q_3",
|
|
52
|
+
confidence=0.7,
|
|
53
|
+
reasoning="Alias test"
|
|
54
|
+
)
|
|
55
|
+
assert output.probability == 0.7
|
|
56
|
+
assert output.confidence == 0.7
|
|
57
|
+
|
|
58
|
+
output.confidence = 0.5
|
|
59
|
+
assert output.probability == 0.5
|
|
60
|
+
|
|
61
|
+
def test_to_networkx_conversion():
|
|
62
|
+
"""Verify conversion to NetworkX graph."""
|
|
63
|
+
node1 = CausalNode(event="Start", node_id="n1")
|
|
64
|
+
node2 = CausalNode(event="End", node_id="n2")
|
|
65
|
+
edge = CausalEdge(source="n1", target="n2")
|
|
66
|
+
|
|
67
|
+
output = ForecastOutput(
|
|
68
|
+
question_id="q_graph",
|
|
69
|
+
probability=0.5,
|
|
70
|
+
reasoning="Graph test",
|
|
71
|
+
logical_trace=[node1, node2],
|
|
72
|
+
logical_edges=[edge]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Check that networkx is handled gracefull if installed
|
|
76
|
+
try:
|
|
77
|
+
import networkx # noqa: F401
|
|
78
|
+
dg = output.to_networkx()
|
|
79
|
+
assert dg.has_edge("n1", "n2")
|
|
80
|
+
except ImportError:
|
|
81
|
+
pytest.skip("NetworkX not installed")
|