iosislib 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. iosislib-0.1.0/LICENSE +52 -0
  2. iosislib-0.1.0/NOTICE +13 -0
  3. iosislib-0.1.0/PKG-INFO +181 -0
  4. iosislib-0.1.0/README.md +126 -0
  5. iosislib-0.1.0/pyproject.toml +122 -0
  6. iosislib-0.1.0/setup.cfg +4 -0
  7. iosislib-0.1.0/src/iosislib/__init__.py +13 -0
  8. iosislib-0.1.0/src/iosislib/backtest/__init__.py +70 -0
  9. iosislib-0.1.0/src/iosislib/backtest/backtest.py +467 -0
  10. iosislib-0.1.0/src/iosislib/backtest/feeds.py +101 -0
  11. iosislib-0.1.0/src/iosislib/backtest/policy.py +589 -0
  12. iosislib-0.1.0/src/iosislib/backtest/risk.py +279 -0
  13. iosislib-0.1.0/src/iosislib/backtest/venue.py +50 -0
  14. iosislib-0.1.0/src/iosislib/catalog.py +197 -0
  15. iosislib-0.1.0/src/iosislib/charting/__init__.py +25 -0
  16. iosislib-0.1.0/src/iosislib/charting/plot.py +409 -0
  17. iosislib-0.1.0/src/iosislib/core/__init__.py +78 -0
  18. iosislib-0.1.0/src/iosislib/core/graph.py +1147 -0
  19. iosislib-0.1.0/src/iosislib/core/model.py +928 -0
  20. iosislib-0.1.0/src/iosislib/core/node.py +377 -0
  21. iosislib-0.1.0/src/iosislib/core/tsfn.py +1196 -0
  22. iosislib-0.1.0/src/iosislib/core/utils.py +691 -0
  23. iosislib-0.1.0/src/iosislib/metrics/__init__.py +22 -0
  24. iosislib-0.1.0/src/iosislib/metrics/extract.py +125 -0
  25. iosislib-0.1.0/src/iosislib/metrics/extractor.py +61 -0
  26. iosislib-0.1.0/src/iosislib/metrics/extractors.py +100 -0
  27. iosislib-0.1.0/src/iosislib/metrics/strategy.py +296 -0
  28. iosislib-0.1.0/src/iosislib/models/__init__.py +13 -0
  29. iosislib-0.1.0/src/iosislib/models/_regression.py +95 -0
  30. iosislib-0.1.0/src/iosislib/models/lightgbm.py +381 -0
  31. iosislib-0.1.0/src/iosislib/models/mlp.py +418 -0
  32. iosislib-0.1.0/src/iosislib/py.typed +0 -0
  33. iosislib-0.1.0/src/iosislib/strategy/__init__.py +61 -0
  34. iosislib-0.1.0/src/iosislib/strategy/ir.py +530 -0
  35. iosislib-0.1.0/src/iosislib/strategy/lowering.py +231 -0
  36. iosislib-0.1.0/src/iosislib/strategy/parser.py +126 -0
  37. iosislib-0.1.0/src/iosislib/strategy/strategy.schema.json +108 -0
  38. iosislib-0.1.0/src/iosislib/tsfn/__init__.py +27 -0
  39. iosislib-0.1.0/src/iosislib/tsfn/adapters/__init__.py +59 -0
  40. iosislib-0.1.0/src/iosislib/tsfn/adapters/dataset.py +255 -0
  41. iosislib-0.1.0/src/iosislib/tsfn/adapters/inline_sources.py +98 -0
  42. iosislib-0.1.0/src/iosislib/tsfn/adapters/local_sources.py +431 -0
  43. iosislib-0.1.0/src/iosislib/tsfn/adapters/parquet_stream.py +449 -0
  44. iosislib-0.1.0/src/iosislib/tsfn/adapters/polymarket.py +449 -0
  45. iosislib-0.1.0/src/iosislib/tsfn/adapters/yfinance.py +261 -0
  46. iosislib-0.1.0/src/iosislib/tsfn/transforms/__init__.py +85 -0
  47. iosislib-0.1.0/src/iosislib/tsfn/transforms/_validation.py +14 -0
  48. iosislib-0.1.0/src/iosislib/tsfn/transforms/delta.py +109 -0
  49. iosislib-0.1.0/src/iosislib/tsfn/transforms/ewm.py +133 -0
  50. iosislib-0.1.0/src/iosislib/tsfn/transforms/feature_packer.py +217 -0
  51. iosislib-0.1.0/src/iosislib/tsfn/transforms/feature_unpacker.py +136 -0
  52. iosislib-0.1.0/src/iosislib/tsfn/transforms/lag.py +108 -0
  53. iosislib-0.1.0/src/iosislib/tsfn/transforms/lead.py +110 -0
  54. iosislib-0.1.0/src/iosislib/tsfn/transforms/log.py +100 -0
  55. iosislib-0.1.0/src/iosislib/tsfn/transforms/log_ratio.py +81 -0
  56. iosislib-0.1.0/src/iosislib/tsfn/transforms/log_return.py +61 -0
  57. iosislib-0.1.0/src/iosislib/tsfn/transforms/logit.py +52 -0
  58. iosislib-0.1.0/src/iosislib/tsfn/transforms/negate.py +48 -0
  59. iosislib-0.1.0/src/iosislib/tsfn/transforms/pct_change.py +64 -0
  60. iosislib-0.1.0/src/iosislib/tsfn/transforms/ratio.py +70 -0
  61. iosislib-0.1.0/src/iosislib/tsfn/transforms/rolling.py +283 -0
  62. iosislib-0.1.0/src/iosislib/tsfn/transforms/spread.py +60 -0
  63. iosislib-0.1.0/src/iosislib.egg-info/PKG-INFO +181 -0
  64. iosislib-0.1.0/src/iosislib.egg-info/SOURCES.txt +104 -0
  65. iosislib-0.1.0/src/iosislib.egg-info/dependency_links.txt +1 -0
  66. iosislib-0.1.0/src/iosislib.egg-info/requires.txt +38 -0
  67. iosislib-0.1.0/src/iosislib.egg-info/top_level.txt +1 -0
  68. iosislib-0.1.0/tests/test_backtest.py +451 -0
  69. iosislib-0.1.0/tests/test_backtest_model_policy.py +378 -0
  70. iosislib-0.1.0/tests/test_backtest_risk.py +442 -0
  71. iosislib-0.1.0/tests/test_boundary_contracts.py +255 -0
  72. iosislib-0.1.0/tests/test_cache.py +489 -0
  73. iosislib-0.1.0/tests/test_charting.py +203 -0
  74. iosislib-0.1.0/tests/test_charting_export.py +54 -0
  75. iosislib-0.1.0/tests/test_charting_png.py +64 -0
  76. iosislib-0.1.0/tests/test_core_edge_cases.py +817 -0
  77. iosislib-0.1.0/tests/test_core_modules.py +21 -0
  78. iosislib-0.1.0/tests/test_dataset_source.py +261 -0
  79. iosislib-0.1.0/tests/test_ewm_transforms.py +138 -0
  80. iosislib-0.1.0/tests/test_examples.py +102 -0
  81. iosislib-0.1.0/tests/test_feature_packer.py +369 -0
  82. iosislib-0.1.0/tests/test_feature_unpacker.py +196 -0
  83. iosislib-0.1.0/tests/test_graph_validation_report.py +314 -0
  84. iosislib-0.1.0/tests/test_identity_contracts.py +238 -0
  85. iosislib-0.1.0/tests/test_inline_sources.py +206 -0
  86. iosislib-0.1.0/tests/test_itemwise_batches.py +693 -0
  87. iosislib-0.1.0/tests/test_local_sources.py +623 -0
  88. iosislib-0.1.0/tests/test_metric_strategy.py +497 -0
  89. iosislib-0.1.0/tests/test_metrics.py +298 -0
  90. iosislib-0.1.0/tests/test_model_and_serialization.py +373 -0
  91. iosislib-0.1.0/tests/test_models.py +554 -0
  92. iosislib-0.1.0/tests/test_node_effective_identity.py +248 -0
  93. iosislib-0.1.0/tests/test_package_namespace.py +58 -0
  94. iosislib-0.1.0/tests/test_parquet_stream_source.py +781 -0
  95. iosislib-0.1.0/tests/test_polymarket_adapter.py +547 -0
  96. iosislib-0.1.0/tests/test_returns_transforms.py +174 -0
  97. iosislib-0.1.0/tests/test_rolling_transforms.py +213 -0
  98. iosislib-0.1.0/tests/test_s3_credentials.py +300 -0
  99. iosislib-0.1.0/tests/test_strategy_lowering.py +181 -0
  100. iosislib-0.1.0/tests/test_strategy_yaml.py +236 -0
  101. iosislib-0.1.0/tests/test_supervised_model_tsfn.py +960 -0
  102. iosislib-0.1.0/tests/test_time_axis_execution.py +584 -0
  103. iosislib-0.1.0/tests/test_transforms.py +286 -0
  104. iosislib-0.1.0/tests/test_tsfn_catalog_dump.py +53 -0
  105. iosislib-0.1.0/tests/test_typed_construction.py +132 -0
  106. iosislib-0.1.0/tests/test_yfinance_adapter.py +226 -0
iosislib-0.1.0/LICENSE ADDED
@@ -0,0 +1,52 @@
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, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
37
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
38
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
39
+
40
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
41
+
42
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
43
+
44
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
45
+
46
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
47
+
48
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
49
+
50
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
51
+
52
+ END OF TERMS AND CONDITIONS
iosislib-0.1.0/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2026 iosis
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.4
2
+ Name: iosislib
3
+ Version: 0.1.0
4
+ Summary: Typed, deterministic, time-aware computation graphs for Polars time series
5
+ Project-URL: Homepage, https://github.com/iosis-quant/iosislib
6
+ Project-URL: Issues, https://github.com/iosis-quant/iosislib/issues
7
+ Project-URL: Repository, https://github.com/iosis-quant/iosislib.git
8
+ Keywords: feature-engineering,machine-learning,polars,time-series
9
+ Classifier: Development Status :: 2 - Pre-Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Requires-Python: <3.14,>=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ License-File: NOTICE
22
+ Requires-Dist: numpy>=1.26
23
+ Requires-Dist: polars>=1.30
24
+ Requires-Dist: PyYAML>=6.0
25
+ Requires-Dist: pyarrow>=14
26
+ Requires-Dist: torch>=2.1
27
+ Provides-Extra: charting
28
+ Requires-Dist: matplotlib>=3.8; extra == "charting"
29
+ Provides-Extra: acceleration
30
+ Requires-Dist: numba>=0.61; extra == "acceleration"
31
+ Provides-Extra: lightgbm
32
+ Requires-Dist: lightgbm>=4.0; extra == "lightgbm"
33
+ Provides-Extra: yfinance
34
+ Requires-Dist: pandas>=2.0; extra == "yfinance"
35
+ Requires-Dist: yfinance>=0.2.40; extra == "yfinance"
36
+ Provides-Extra: test
37
+ Requires-Dist: lightgbm>=4.0; extra == "test"
38
+ Requires-Dist: matplotlib>=3.8; extra == "test"
39
+ Requires-Dist: pandas>=2.0; extra == "test"
40
+ Requires-Dist: pytest>=8; extra == "test"
41
+ Provides-Extra: dev
42
+ Requires-Dist: build>=1.2; extra == "dev"
43
+ Requires-Dist: check-wheel-contents>=0.6; extra == "dev"
44
+ Requires-Dist: lightgbm>=4.0; extra == "dev"
45
+ Requires-Dist: matplotlib>=3.8; extra == "dev"
46
+ Requires-Dist: mypy>=1.11; extra == "dev"
47
+ Requires-Dist: numba>=0.61; extra == "dev"
48
+ Requires-Dist: pandas>=2.0; extra == "dev"
49
+ Requires-Dist: pytest>=8; extra == "dev"
50
+ Requires-Dist: ruff>=0.6; extra == "dev"
51
+ Requires-Dist: twine>=5; extra == "dev"
52
+ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
53
+ Requires-Dist: yfinance>=0.2.40; extra == "dev"
54
+ Dynamic: license-file
55
+
56
+ # iosislib
57
+
58
+ iosislib is a pre-alpha Python library for typed, deterministic, time-aware
59
+ computation graphs over Polars time-series data. It owns graph validation,
60
+ causal parent alignment, null policies, materialization boundaries, and model
61
+ lifecycle contracts while Polars remains the columnar execution engine.
62
+
63
+ The distribution is not published yet. Install it from a checkout with Python
64
+ 3.11, 3.12, or 3.13:
65
+
66
+ ```console
67
+ python -m pip install .
68
+ ```
69
+
70
+ The installed package namespace is `iosislib`. Owning modules such as
71
+ `iosislib.core.graph` remain canonical, with a small top-level convenience
72
+ surface for `Graph`, `Node`, and frame signatures.
73
+
74
+ ## Offline quickstart
75
+
76
+ The tracked [offline graph example](examples/offline_graph.py) snapshots a
77
+ temporary local CSV by content hash, then executes `CSVSource -> Logit -> Delta`
78
+ without network access. Run it from the repository root after installation:
79
+
80
+ ```console
81
+ python examples/offline_graph.py
82
+ ```
83
+
84
+ Nodes are immutable declarations. A child owns the alignment tolerance and
85
+ null policy for each input it consumes; graph execution aligns parents with a
86
+ backward as-of join on the union of their timestamps.
87
+
88
+ Concrete frozen configs are accepted through the typed `config=` path, while
89
+ `parameters=` mappings remain available for dynamic programs. Both normalize to
90
+ the same Node identity. Use `node.output("column")` for an explicit typed binding;
91
+ `node.column` remains equivalent shorthand.
92
+
93
+ Graphs are immutable after successful validation. Execution strategies are
94
+ runtime choices, supplied with `graph.execute(executor=...)`; they are not part of
95
+ the graph declaration or ID. CSV and Parquet sources read, hash, and parse the
96
+ same in-memory byte snapshot. This gives an exact content guarantee at the cost
97
+ of holding the full source bytes and parsed frame at that boundary.
98
+
99
+ ## Parquet data sources
100
+
101
+ `ParquetSource` accepts a local file, a local directory, an S3 object, or an S3
102
+ bucket/prefix. Directories and prefixes are searched recursively for `.parquet`
103
+ files. This source is deliberately non-streaming: it downloads every selected
104
+ object, verifies one deterministic dataset digest, parses the snapshot, and then
105
+ returns a projected `LazyFrame` with the declared time-series schema.
106
+
107
+ ```python
108
+ import polars as pl
109
+
110
+ from iosislib.core.node import Node
111
+ from iosislib.core.tsfn import FrameSignature
112
+ from iosislib.tsfn.adapters import ParquetSource, sha256_parquet_source
113
+
114
+ location = "s3://my-bucket/prices/" # A local pathlib.Path works too.
115
+ signature = FrameSignature(columns=(("price", pl.Float64),))
116
+ source = Node(
117
+ ParquetSource,
118
+ parameters={
119
+ "path": location,
120
+ "output_signature": signature,
121
+ "content_sha256": sha256_parquet_source(location),
122
+ },
123
+ )
124
+ ```
125
+
126
+ S3 access uses PyArrow's standard AWS credential chain; credentials are not graph
127
+ parameters and therefore are not serialized into node identity. Computing the
128
+ digest reads the dataset once, and graph execution reads it again and rejects the
129
+ result if the bytes or selected object manifest changed between those operations.
130
+ The digest identifies the physical snapshot, not only its logical rows, so changing
131
+ a multi-file dataset's partitioning intentionally changes its content address. A
132
+ single-file directory or prefix retains the bare file's SHA-256 for compatibility.
133
+
134
+ ## Development
135
+
136
+ Install the complete local toolchain:
137
+
138
+ ```console
139
+ python -m pip install -e ".[dev]"
140
+ ```
141
+
142
+ Run the same quality gates enforced by CI:
143
+
144
+ ```console
145
+ python -m compileall -q src/iosislib examples
146
+ python -m ruff check src examples
147
+ python -m mypy
148
+ python examples/offline_graph.py
149
+ python -m pytest
150
+ python -m build
151
+ python -m twine check --strict dist/*
152
+ check-wheel-contents dist
153
+ ```
154
+
155
+ Ruff checks production source and tracked examples without forcing churn in
156
+ deliberately adversarial tests. Strict mypy checks the TSFN and Node contracts,
157
+ the concrete transforms, and a public consumer fixture. This is an enforced
158
+ public slice, not a claim that every production module is already strict-clean.
159
+
160
+ Tracked tests use local fixtures or mock remote API boundaries; they do not
161
+ require live market or finance services. CI runs the full suite on Windows and
162
+ Ubuntu for every declared Python version, then validates both source and wheel
163
+ distributions in a clean environment outside the checkout.
164
+
165
+ ## Portable strategy declarations
166
+
167
+ `iosislib.strategy` provides the backend-independent `iosis.strategy` YAML
168
+ representation for storing strategies and passing them between APIs and
169
+ frontends. Document and operation versions are explicit SemVer fields. It uses
170
+ stable symbolic operation names and readable `node.output`
171
+ references rather than Python class paths or backend graph IDs. The parser,
172
+ deterministic serializer, fingerprint, and packaged JSON Schema are documented in
173
+ [the strategy format specification](docs/strategy-format.md). A backend
174
+ operation registry/compiler is intentionally a later layer.
175
+
176
+ See [TODO.md](TODO.md) for the ordered roadmap and [AGENTS.md](AGENTS.md) for
177
+ the architectural and contribution constraints.
178
+
179
+ Third-party TSFN and model authors should start with the
180
+ [extension guide](docs/extending-iosislib.md), which explains the graph,
181
+ signature, null, identity, materialization, and walk-forward model contracts.
@@ -0,0 +1,126 @@
1
+ # iosislib
2
+
3
+ iosislib is a pre-alpha Python library for typed, deterministic, time-aware
4
+ computation graphs over Polars time-series data. It owns graph validation,
5
+ causal parent alignment, null policies, materialization boundaries, and model
6
+ lifecycle contracts while Polars remains the columnar execution engine.
7
+
8
+ The distribution is not published yet. Install it from a checkout with Python
9
+ 3.11, 3.12, or 3.13:
10
+
11
+ ```console
12
+ python -m pip install .
13
+ ```
14
+
15
+ The installed package namespace is `iosislib`. Owning modules such as
16
+ `iosislib.core.graph` remain canonical, with a small top-level convenience
17
+ surface for `Graph`, `Node`, and frame signatures.
18
+
19
+ ## Offline quickstart
20
+
21
+ The tracked [offline graph example](examples/offline_graph.py) snapshots a
22
+ temporary local CSV by content hash, then executes `CSVSource -> Logit -> Delta`
23
+ without network access. Run it from the repository root after installation:
24
+
25
+ ```console
26
+ python examples/offline_graph.py
27
+ ```
28
+
29
+ Nodes are immutable declarations. A child owns the alignment tolerance and
30
+ null policy for each input it consumes; graph execution aligns parents with a
31
+ backward as-of join on the union of their timestamps.
32
+
33
+ Concrete frozen configs are accepted through the typed `config=` path, while
34
+ `parameters=` mappings remain available for dynamic programs. Both normalize to
35
+ the same Node identity. Use `node.output("column")` for an explicit typed binding;
36
+ `node.column` remains equivalent shorthand.
37
+
38
+ Graphs are immutable after successful validation. Execution strategies are
39
+ runtime choices, supplied with `graph.execute(executor=...)`; they are not part of
40
+ the graph declaration or ID. CSV and Parquet sources read, hash, and parse the
41
+ same in-memory byte snapshot. This gives an exact content guarantee at the cost
42
+ of holding the full source bytes and parsed frame at that boundary.
43
+
44
+ ## Parquet data sources
45
+
46
+ `ParquetSource` accepts a local file, a local directory, an S3 object, or an S3
47
+ bucket/prefix. Directories and prefixes are searched recursively for `.parquet`
48
+ files. This source is deliberately non-streaming: it downloads every selected
49
+ object, verifies one deterministic dataset digest, parses the snapshot, and then
50
+ returns a projected `LazyFrame` with the declared time-series schema.
51
+
52
+ ```python
53
+ import polars as pl
54
+
55
+ from iosislib.core.node import Node
56
+ from iosislib.core.tsfn import FrameSignature
57
+ from iosislib.tsfn.adapters import ParquetSource, sha256_parquet_source
58
+
59
+ location = "s3://my-bucket/prices/" # A local pathlib.Path works too.
60
+ signature = FrameSignature(columns=(("price", pl.Float64),))
61
+ source = Node(
62
+ ParquetSource,
63
+ parameters={
64
+ "path": location,
65
+ "output_signature": signature,
66
+ "content_sha256": sha256_parquet_source(location),
67
+ },
68
+ )
69
+ ```
70
+
71
+ S3 access uses PyArrow's standard AWS credential chain; credentials are not graph
72
+ parameters and therefore are not serialized into node identity. Computing the
73
+ digest reads the dataset once, and graph execution reads it again and rejects the
74
+ result if the bytes or selected object manifest changed between those operations.
75
+ The digest identifies the physical snapshot, not only its logical rows, so changing
76
+ a multi-file dataset's partitioning intentionally changes its content address. A
77
+ single-file directory or prefix retains the bare file's SHA-256 for compatibility.
78
+
79
+ ## Development
80
+
81
+ Install the complete local toolchain:
82
+
83
+ ```console
84
+ python -m pip install -e ".[dev]"
85
+ ```
86
+
87
+ Run the same quality gates enforced by CI:
88
+
89
+ ```console
90
+ python -m compileall -q src/iosislib examples
91
+ python -m ruff check src examples
92
+ python -m mypy
93
+ python examples/offline_graph.py
94
+ python -m pytest
95
+ python -m build
96
+ python -m twine check --strict dist/*
97
+ check-wheel-contents dist
98
+ ```
99
+
100
+ Ruff checks production source and tracked examples without forcing churn in
101
+ deliberately adversarial tests. Strict mypy checks the TSFN and Node contracts,
102
+ the concrete transforms, and a public consumer fixture. This is an enforced
103
+ public slice, not a claim that every production module is already strict-clean.
104
+
105
+ Tracked tests use local fixtures or mock remote API boundaries; they do not
106
+ require live market or finance services. CI runs the full suite on Windows and
107
+ Ubuntu for every declared Python version, then validates both source and wheel
108
+ distributions in a clean environment outside the checkout.
109
+
110
+ ## Portable strategy declarations
111
+
112
+ `iosislib.strategy` provides the backend-independent `iosis.strategy` YAML
113
+ representation for storing strategies and passing them between APIs and
114
+ frontends. Document and operation versions are explicit SemVer fields. It uses
115
+ stable symbolic operation names and readable `node.output`
116
+ references rather than Python class paths or backend graph IDs. The parser,
117
+ deterministic serializer, fingerprint, and packaged JSON Schema are documented in
118
+ [the strategy format specification](docs/strategy-format.md). A backend
119
+ operation registry/compiler is intentionally a later layer.
120
+
121
+ See [TODO.md](TODO.md) for the ordered roadmap and [AGENTS.md](AGENTS.md) for
122
+ the architectural and contribution constraints.
123
+
124
+ Third-party TSFN and model authors should start with the
125
+ [extension guide](docs/extending-iosislib.md), which explains the graph,
126
+ signature, null, identity, materialization, and walk-forward model contracts.
@@ -0,0 +1,122 @@
1
+ [build-system]
2
+ requires = ["setuptools>=65", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iosislib"
7
+ version = "0.1.0"
8
+ description = "Typed, deterministic, time-aware computation graphs for Polars time series"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11,<3.14"
11
+ dependencies = [
12
+ "numpy>=1.26",
13
+ "polars>=1.30",
14
+ "PyYAML>=6.0",
15
+ "pyarrow>=14",
16
+ "torch>=2.1",
17
+ ]
18
+ keywords = [
19
+ "feature-engineering",
20
+ "machine-learning",
21
+ "polars",
22
+ "time-series",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 2 - Pre-Alpha",
26
+ "Intended Audience :: Developers",
27
+ "Intended Audience :: Science/Research",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Topic :: Scientific/Engineering",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/iosis-quant/iosislib"
38
+ Issues = "https://github.com/iosis-quant/iosislib/issues"
39
+ Repository = "https://github.com/iosis-quant/iosislib.git"
40
+
41
+ [project.optional-dependencies]
42
+ charting = [
43
+ "matplotlib>=3.8",
44
+ ]
45
+ acceleration = [
46
+ "numba>=0.61",
47
+ ]
48
+ lightgbm = [
49
+ "lightgbm>=4.0",
50
+ ]
51
+ yfinance = [
52
+ "pandas>=2.0",
53
+ "yfinance>=0.2.40",
54
+ ]
55
+ test = [
56
+ "lightgbm>=4.0",
57
+ "matplotlib>=3.8",
58
+ "pandas>=2.0",
59
+ "pytest>=8",
60
+ ]
61
+ dev = [
62
+ "build>=1.2",
63
+ "check-wheel-contents>=0.6",
64
+ "lightgbm>=4.0",
65
+ "matplotlib>=3.8",
66
+ "mypy>=1.11",
67
+ "numba>=0.61",
68
+ "pandas>=2.0",
69
+ "pytest>=8",
70
+ "ruff>=0.6",
71
+ "twine>=5",
72
+ "types-PyYAML>=6.0",
73
+ "yfinance>=0.2.40",
74
+ ]
75
+
76
+ [tool.setuptools]
77
+ package-dir = {"" = "src"}
78
+ include-package-data = false
79
+
80
+ [tool.setuptools.packages.find]
81
+ where = ["src"]
82
+ include = ["iosislib*"]
83
+ namespaces = false
84
+
85
+ [tool.setuptools.package-data]
86
+ iosislib = ["py.typed", "strategy/*.json"]
87
+
88
+ [tool.check-wheel-contents]
89
+ toplevel = ["iosislib"]
90
+
91
+ [tool.ruff]
92
+ target-version = "py311"
93
+ extend-exclude = ["temp"]
94
+
95
+ [tool.ruff.lint]
96
+ select = ["E4", "E7", "E9", "F"]
97
+
98
+ [tool.mypy]
99
+ # CI runs mypy on 3.13; Ruff and the test matrix enforce Python 3.11 compatibility.
100
+ python_version = "3.13"
101
+ explicit_package_bases = true
102
+ follow_imports = "normal"
103
+ mypy_path = ["src"]
104
+ strict = true
105
+ pretty = true
106
+ show_error_codes = true
107
+ warn_unused_configs = true
108
+ files = [
109
+ "src/iosislib/core/tsfn.py",
110
+ "src/iosislib/core/node.py",
111
+ "src/iosislib/strategy",
112
+ "src/iosislib/tsfn/transforms",
113
+ "tests/typing/typed_construction.py",
114
+ ]
115
+
116
+ [[tool.mypy.overrides]]
117
+ module = ["pyarrow", "pyarrow.*"]
118
+ ignore_missing_imports = true
119
+
120
+ [tool.pytest.ini_options]
121
+ addopts = "-ra"
122
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,13 @@
1
+ """Typed, deterministic computation graphs for Polars time series."""
2
+
3
+ from iosislib.core.graph import Graph
4
+ from iosislib.core.node import Node
5
+ from iosislib.core.tsfn import ColumnSignature, FrameSignature, TimeAxis
6
+
7
+ __all__ = [
8
+ "ColumnSignature",
9
+ "FrameSignature",
10
+ "Graph",
11
+ "Node",
12
+ "TimeAxis",
13
+ ]
@@ -0,0 +1,70 @@
1
+ """Graph-native immediate-execution backtesting primitives."""
2
+
3
+ from iosislib.backtest.backtest import (
4
+ BacktestConfig,
5
+ BacktestTSFN,
6
+ list_policies,
7
+ list_risk_policies,
8
+ register_policy,
9
+ register_risk_policy,
10
+ )
11
+ from iosislib.backtest.feeds import Feed, L1Feed
12
+ from iosislib.backtest.policy import (
13
+ Array,
14
+ FeatureBuffer,
15
+ MarketState,
16
+ ModelPolicy,
17
+ ModelPolicyState,
18
+ Order,
19
+ OrderModelPolicy,
20
+ Policy,
21
+ PolicyState,
22
+ SignalPolicy,
23
+ StatefulPolicy,
24
+ ThresholdPolicy,
25
+ )
26
+ from iosislib.backtest.risk import (
27
+ FractionalKellyPolicy,
28
+ FractionalLimitPolicy,
29
+ NO_OP_RISK,
30
+ NoOpRiskPolicy,
31
+ RiskDecision,
32
+ RiskPolicy,
33
+ RiskReason,
34
+ StatefulRiskPolicy,
35
+ classify_reason,
36
+ )
37
+ from iosislib.backtest.venue import Venue
38
+
39
+ __all__ = [
40
+ "Array",
41
+ "BacktestConfig",
42
+ "BacktestTSFN",
43
+ "FeatureBuffer",
44
+ "Feed",
45
+ "FractionalKellyPolicy",
46
+ "FractionalLimitPolicy",
47
+ "L1Feed",
48
+ "MarketState",
49
+ "ModelPolicy",
50
+ "ModelPolicyState",
51
+ "NO_OP_RISK",
52
+ "NoOpRiskPolicy",
53
+ "Order",
54
+ "OrderModelPolicy",
55
+ "Policy",
56
+ "PolicyState",
57
+ "RiskDecision",
58
+ "RiskPolicy",
59
+ "RiskReason",
60
+ "SignalPolicy",
61
+ "StatefulPolicy",
62
+ "StatefulRiskPolicy",
63
+ "ThresholdPolicy",
64
+ "Venue",
65
+ "classify_reason",
66
+ "list_policies",
67
+ "list_risk_policies",
68
+ "register_policy",
69
+ "register_risk_policy",
70
+ ]