scryml 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 (104) hide show
  1. scryml-0.1.0/.env.example +38 -0
  2. scryml-0.1.0/.github/workflows/ci.yml +24 -0
  3. scryml-0.1.0/.github/workflows/publish.yml +24 -0
  4. scryml-0.1.0/.gitignore +50 -0
  5. scryml-0.1.0/CLAUDE.md +56 -0
  6. scryml-0.1.0/Dockerfile +20 -0
  7. scryml-0.1.0/LICENSE +201 -0
  8. scryml-0.1.0/NOTICE +10 -0
  9. scryml-0.1.0/PKG-INFO +132 -0
  10. scryml-0.1.0/README.md +77 -0
  11. scryml-0.1.0/assets/banner.svg +108 -0
  12. scryml-0.1.0/config/config.yaml +76 -0
  13. scryml-0.1.0/config/features.yaml +415 -0
  14. scryml-0.1.0/docs/architecture.md +26 -0
  15. scryml-0.1.0/docs/data-contract.md +38 -0
  16. scryml-0.1.0/docs/ingestion.md +24 -0
  17. scryml-0.1.0/docs/training.md +35 -0
  18. scryml-0.1.0/examples/generate_sample_data.py +110 -0
  19. scryml-0.1.0/examples/quickstart.md +34 -0
  20. scryml-0.1.0/examples/sample_data/metrics.parquet +0 -0
  21. scryml-0.1.0/logicmodules/README.md +66 -0
  22. scryml-0.1.0/logicmodules/REMEDIATION_DESIGN.md +356 -0
  23. scryml-0.1.0/logicmodules/dashboards/Scry_ModelHealth_Dashboard.json +352 -0
  24. scryml-0.1.0/logicmodules/dashboards/Scry_Predictive_Dashboard.json +418 -0
  25. scryml-0.1.0/logicmodules/datasources/Scry_Accuracy.xml +953 -0
  26. scryml-0.1.0/logicmodules/datasources/Scry_Anomaly.xml +352 -0
  27. scryml-0.1.0/logicmodules/datasources/Scry_Drift.xml +500 -0
  28. scryml-0.1.0/logicmodules/datasources/Scry_Predictive.xml +395 -0
  29. scryml-0.1.0/logicmodules/external_alert_handler.ps1 +137 -0
  30. scryml-0.1.0/logicmodules/propertysources/Scry_Predictive_Props.xml +105 -0
  31. scryml-0.1.0/pyproject.toml +90 -0
  32. scryml-0.1.0/scripts/extract_features.py +109 -0
  33. scryml-0.1.0/scripts/train_model.py +451 -0
  34. scryml-0.1.0/scripts/validate_data.py +199 -0
  35. scryml-0.1.0/src/scry/__init__.py +6 -0
  36. scryml-0.1.0/src/scry/api/__init__.py +25 -0
  37. scryml-0.1.0/src/scry/api/forecaster.py +110 -0
  38. scryml-0.1.0/src/scry/api/main.py +423 -0
  39. scryml-0.1.0/src/scry/api/predictor.py +251 -0
  40. scryml-0.1.0/src/scry/api/schemas.py +293 -0
  41. scryml-0.1.0/src/scry/config/__init__.py +30 -0
  42. scryml-0.1.0/src/scry/config/auto_discovery.py +192 -0
  43. scryml-0.1.0/src/scry/config/loader.py +195 -0
  44. scryml-0.1.0/src/scry/data/__init__.py +65 -0
  45. scryml-0.1.0/src/scry/data/feature_engineering.py +419 -0
  46. scryml-0.1.0/src/scry/data/fetcher.py +187 -0
  47. scryml-0.1.0/src/scry/data/pipeline.py +207 -0
  48. scryml-0.1.0/src/scry/data/sources/__init__.py +13 -0
  49. scryml-0.1.0/src/scry/data/sources/base.py +98 -0
  50. scryml-0.1.0/src/scry/data/sources/http_ingest.py +461 -0
  51. scryml-0.1.0/src/scry/data/sources/object_store.py +234 -0
  52. scryml-0.1.0/src/scry/model/__init__.py +82 -0
  53. scryml-0.1.0/src/scry/model/clustering.py +120 -0
  54. scryml-0.1.0/src/scry/model/decoders.py +131 -0
  55. scryml-0.1.0/src/scry/model/drift.py +192 -0
  56. scryml-0.1.0/src/scry/model/encoders.py +161 -0
  57. scryml-0.1.0/src/scry/model/evaluate.py +323 -0
  58. scryml-0.1.0/src/scry/model/export.py +301 -0
  59. scryml-0.1.0/src/scry/model/forecasting/__init__.py +4 -0
  60. scryml-0.1.0/src/scry/model/forecasting/accuracy.py +170 -0
  61. scryml-0.1.0/src/scry/model/forecasting/anomaly_detector.py +115 -0
  62. scryml-0.1.0/src/scry/model/forecasting/chronos_wrapper.py +125 -0
  63. scryml-0.1.0/src/scry/model/forecasting/enriched_pipeline.py +151 -0
  64. scryml-0.1.0/src/scry/model/forecasting/residual_features.py +42 -0
  65. scryml-0.1.0/src/scry/model/losses.py +173 -0
  66. scryml-0.1.0/src/scry/model/trainer.py +580 -0
  67. scryml-0.1.0/src/scry/model/xdec.py +196 -0
  68. scryml-0.1.0/src/scry/model/xvae.py +160 -0
  69. scryml-0.1.0/src/scry/utils/__init__.py +4 -0
  70. scryml-0.1.0/src/scry/utils/config.py +94 -0
  71. scryml-0.1.0/src/scry/utils/tracing.py +178 -0
  72. scryml-0.1.0/tests/__init__.py +4 -0
  73. scryml-0.1.0/tests/conftest.py +11 -0
  74. scryml-0.1.0/tests/test_accuracy_datasource.py +116 -0
  75. scryml-0.1.0/tests/test_accuracy_endpoint.py +137 -0
  76. scryml-0.1.0/tests/test_accuracy_tracker.py +230 -0
  77. scryml-0.1.0/tests/test_anomaly_endpoint.py +247 -0
  78. scryml-0.1.0/tests/test_api.py +335 -0
  79. scryml-0.1.0/tests/test_checkpointing.py +346 -0
  80. scryml-0.1.0/tests/test_chronos_wrapper.py +87 -0
  81. scryml-0.1.0/tests/test_clustering.py +139 -0
  82. scryml-0.1.0/tests/test_config.py +161 -0
  83. scryml-0.1.0/tests/test_decoders.py +158 -0
  84. scryml-0.1.0/tests/test_drift_datasource.py +199 -0
  85. scryml-0.1.0/tests/test_drift_detection.py +102 -0
  86. scryml-0.1.0/tests/test_encoders.py +217 -0
  87. scryml-0.1.0/tests/test_enriched_pipeline.py +174 -0
  88. scryml-0.1.0/tests/test_evaluate.py +280 -0
  89. scryml-0.1.0/tests/test_export.py +276 -0
  90. scryml-0.1.0/tests/test_feature_engineering.py +498 -0
  91. scryml-0.1.0/tests/test_fetcher.py +233 -0
  92. scryml-0.1.0/tests/test_forecast_anomaly.py +109 -0
  93. scryml-0.1.0/tests/test_forecast_endpoint.py +321 -0
  94. scryml-0.1.0/tests/test_health_detailed.py +151 -0
  95. scryml-0.1.0/tests/test_integration_enriched_training.py +316 -0
  96. scryml-0.1.0/tests/test_losses.py +272 -0
  97. scryml-0.1.0/tests/test_pipeline.py +299 -0
  98. scryml-0.1.0/tests/test_predictor.py +291 -0
  99. scryml-0.1.0/tests/test_residual_features.py +97 -0
  100. scryml-0.1.0/tests/test_schemas.py +400 -0
  101. scryml-0.1.0/tests/test_trainer.py +461 -0
  102. scryml-0.1.0/tests/test_xdec.py +165 -0
  103. scryml-0.1.0/tests/test_xvae.py +140 -0
  104. scryml-0.1.0/uv.lock +3935 -0
@@ -0,0 +1,38 @@
1
+ # Description: Example environment configuration for Scry. Copy to .env and fill in.
2
+ # Description: The real .env is gitignored; never commit credentials.
3
+
4
+ # --- Data source (default: object storage) ---
5
+ # Object-store URI for metrics. The scheme selects the backend: file / s3 / gs / az.
6
+ # SCRY_DATA_URI=data/metrics/**/*.parquet
7
+ # SCRY_DATA_URI=s3://your-bucket/metrics/**/*.parquet
8
+ # SCRY_DATA_URI=az://your-container/metrics/**/*.parquet
9
+ SCRY_DATA_URI=
10
+
11
+ # Feature profile (see config/features.yaml). Defaults to the file's default_profile.
12
+ # SCRY_PROFILE=kubernetes
13
+
14
+ # --- Model serving ---
15
+ MODEL_PATH=models/xdec_model.pt
16
+ # MODEL_VERSION=
17
+
18
+ # --- Forecasting (needs the 'forecast' extra) ---
19
+ # FORECAST_MODEL_ID=amazon/chronos-bolt-tiny
20
+ # FORECAST_DEVICE=cpu
21
+
22
+ # --- LogicMonitor / HttpIngest adapter (needs the 'logicmonitor' extra) ---
23
+ # HTTPINGEST_URL=https://your-ingest-host.example.com
24
+
25
+ # --- S3 / MinIO / Ceph (needs the 's3' extra) ---
26
+ # AWS_ACCESS_KEY_ID=
27
+ # AWS_SECRET_ACCESS_KEY=
28
+ # AWS_DEFAULT_REGION=us-east-1
29
+ # AWS_ENDPOINT_URL= # set for MinIO/Ceph S3-compatible endpoints
30
+
31
+ # --- Azure Data Lake (needs the 'azure' extra) ---
32
+ # AZURE_STORAGE_ACCOUNT=
33
+ # AZURE_STORAGE_CONNECTION_STRING=
34
+
35
+ # --- Tracing (optional, needs the 'otel' extra) ---
36
+ # OTEL_TRACING_ENABLED=true
37
+ # OTEL_SERVICE_NAME=scry
38
+ # OTEL_EXPORTER_OTLP_ENDPOINT=
@@ -0,0 +1,24 @@
1
+ # Description: Continuous integration: lint and test across supported Python versions.
2
+ # Description: Runs ruff and pytest on push and pull request.
3
+
4
+ name: ci
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.10", "3.11", "3.12"]
18
+ steps:
19
+ - uses: actions/checkout@v7
20
+ - uses: astral-sh/setup-uv@v7
21
+ - run: uv python install ${{ matrix.python-version }}
22
+ - run: uv sync --all-extras
23
+ - run: uv run ruff check
24
+ - run: uv run pytest -q
@@ -0,0 +1,24 @@
1
+ # Description: Publishes the scryml distribution to PyPI when a GitHub Release is published.
2
+ # Description: Uses PyPI Trusted Publishing (OIDC); no API token is stored in the repo.
3
+
4
+ name: publish
5
+
6
+ on:
7
+ release:
8
+ types: [published]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ pypi:
16
+ runs-on: ubuntu-latest
17
+ environment: pypi
18
+ permissions:
19
+ id-token: write # required for PyPI Trusted Publishing (OIDC)
20
+ steps:
21
+ - uses: actions/checkout@v7
22
+ - uses: astral-sh/setup-uv@v7
23
+ - run: uv build
24
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,50 @@
1
+ # Description: Git ignore rules for the Scry project.
2
+ # Description: Excludes build artifacts, environments, secrets, data, and model weights.
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *.egg-info/
8
+ .eggs/
9
+ build/
10
+ dist/
11
+ .venv/
12
+ venv/
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Environments and secrets
20
+ .env
21
+ .env.*
22
+ !.env.example
23
+ *cred*.json
24
+ wif-cred.json
25
+
26
+ # Model weights and artifacts (never ship; derived from telemetry)
27
+ models/
28
+ *.pt
29
+ *.pth
30
+ *.ckpt
31
+ *.onnx
32
+ *.safetensors
33
+
34
+ # Generated training data (bring-your-own; never commit real telemetry)
35
+ /data/
36
+ *.npz
37
+ mlflow.db
38
+ mlruns/
39
+
40
+ # DVC
41
+ .dvc/tmp/
42
+ .dvc/cache/
43
+
44
+ # Local tooling, stray directories, editor/OS cruft
45
+ .claude/
46
+ None/
47
+ .DS_Store
48
+ *.swp
49
+ .idea/
50
+ .vscode/
scryml-0.1.0/CLAUDE.md ADDED
@@ -0,0 +1,56 @@
1
+ # Scry
2
+
3
+ Project configuration for Claude Code and contributors. This is a public repository.
4
+
5
+ ## What Scry is
6
+
7
+ Scry predicts infrastructure failure states from a stream of metrics. It sorts each resource into one of five operational states (NORMAL, PRE_SCALE, PRE_FAILURE, ACTIVE_DEGRADATION, ANOMALY) and forecasts where metrics are headed. It is data-source agnostic; LogicMonitor is one adapter, not the anchor. No trained weights ship; you train on your own data.
8
+
9
+ ## Architecture
10
+
11
+ - `src/scry/model/` - the X-DEC model (dual-encoder temporal VAE plus deep embedded clustering), training, drift detection, and the optional Chronos forecasting layer. Pure PyTorch, no cloud.
12
+ - `src/scry/data/` - feature engineering, the windowing pipeline, and the data-source seam.
13
+ - `data/sources/base.py` - the `DataSource` ABC and the canonical metric schema. This is the contract everything normalizes to.
14
+ - `data/sources/object_store.py` - reads Parquet/CSV from local files or object storage (S3/MinIO/ADLS/GCS) through DuckDB. The default path.
15
+ - `data/sources/http_ingest.py` - the LogicMonitor/HttpIngest adapter (needs the `logicmonitor` extra).
16
+ - `src/scry/api/` - the FastAPI service (`/predict`, `/forecast`, `/drift`, `/anomaly`).
17
+ - `config/features.yaml` - domain feature profiles. `config/config.yaml` - model and training config.
18
+
19
+ ## Canonical data schema
20
+
21
+ Every data source normalizes to one long-format table:
22
+
23
+ | column | type | required |
24
+ |---|---|---|
25
+ | resource_id | str | yes |
26
+ | metric_name | str | yes |
27
+ | timestamp | UTC timestamp | yes |
28
+ | value | float | yes |
29
+ | host_name | str | no |
30
+ | datasource_instance | str | no |
31
+ | datasource_name | str | no |
32
+
33
+ Bring your own metrics in this shape and train from scratch.
34
+
35
+ ## Toolchain
36
+
37
+ - `uv` for environments and dependencies: `uv sync --all-extras`.
38
+ - `ruff` for lint and format; `pytest` for tests (`asyncio_mode=auto`).
39
+ - Python 3.10+.
40
+
41
+ ## Conventions
42
+
43
+ - Every code file starts with two `# Description:` comment lines.
44
+ - Match the surrounding style; consistency within a file beats external standards.
45
+ - Tests are part of the deliverable; write them in the same pass as the code.
46
+ - Forecasting (Chronos) lives behind the `forecast` extra so the core stays offline-capable. Optional dependencies degrade gracefully; a missing extra returns a clear error, it does not crash unrelated paths.
47
+ - Never commit secrets, `.env`, model weights (`*.pt`), or real telemetry. See `.gitignore`.
48
+ - Comments describe the code as it is; no "recently changed" or temporal notes.
49
+
50
+ ## Commands
51
+
52
+ - Install: `uv sync --all-extras`
53
+ - Lint: `ruff check`
54
+ - Test: `pytest`
55
+ - Train: `python scripts/train_model.py --data <path-or-uri>`
56
+ - Serve: `uvicorn scry.api.main:app --host 127.0.0.1 --port 8000`
@@ -0,0 +1,20 @@
1
+ # Description: Container image for serving the Scry prediction API.
2
+ # Description: Installs the core package and runs the FastAPI app via uvicorn.
3
+
4
+ FROM python:3.11-slim
5
+
6
+ ENV PYTHONUNBUFFERED=1 \
7
+ PIP_NO_CACHE_DIR=1 \
8
+ MODEL_PATH=/models/xdec_model.pt
9
+
10
+ WORKDIR /app
11
+
12
+ # Install the package (core deps only; add extras as needed).
13
+ COPY pyproject.toml README.md LICENSE ./
14
+ COPY src ./src
15
+ COPY config ./config
16
+ RUN pip install --upgrade pip && pip install .
17
+
18
+ # Provide model weights at runtime, e.g. -v $(pwd)/models:/models
19
+ EXPOSE 8000
20
+ CMD ["uvicorn", "scry.api.main:app", "--host", "0.0.0.0", "--port", "8000"]
scryml-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 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 [yyyy] [name of copyright owner]
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.
scryml-0.1.0/NOTICE ADDED
@@ -0,0 +1,10 @@
1
+ Scry
2
+ Copyright 2026 ryanmat
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this software 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
+ This product includes software developed for the Scry project.
scryml-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: scryml
3
+ Version: 0.1.0
4
+ Summary: Predict infrastructure failure states from a stream of metrics
5
+ Project-URL: Homepage, https://github.com/ryanmat/scry
6
+ Project-URL: Repository, https://github.com/ryanmat/scry
7
+ Author: ryanmat
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: System :: Monitoring
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: duckdb>=1.1.0
19
+ Requires-Dist: fastapi>=0.109.0
20
+ Requires-Dist: numpy>=1.26.0
21
+ Requires-Dist: pandas>=2.1.0
22
+ Requires-Dist: pydantic-settings>=2.1.0
23
+ Requires-Dist: pydantic>=2.5.0
24
+ Requires-Dist: pyyaml>=6.0.0
25
+ Requires-Dist: scikit-learn>=1.4.0
26
+ Requires-Dist: torch>=2.1.0
27
+ Requires-Dist: tqdm>=4.66.0
28
+ Requires-Dist: uvicorn>=0.27.0
29
+ Provides-Extra: azure
30
+ Requires-Dist: azure-identity>=1.15.0; extra == 'azure'
31
+ Provides-Extra: dev
32
+ Requires-Dist: matplotlib>=3.8.0; extra == 'dev'
33
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
34
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
35
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
36
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
37
+ Requires-Dist: respx>=0.21.0; extra == 'dev'
38
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'
39
+ Provides-Extra: forecast
40
+ Requires-Dist: chronos-forecasting>=2.0; extra == 'forecast'
41
+ Requires-Dist: transformers>=4.35.0; extra == 'forecast'
42
+ Provides-Extra: logicmonitor
43
+ Requires-Dist: httpx>=0.26.0; extra == 'logicmonitor'
44
+ Provides-Extra: mcp
45
+ Provides-Extra: otel
46
+ Requires-Dist: opentelemetry-api>=1.20.0; extra == 'otel'
47
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20.0; extra == 'otel'
48
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.41b0; extra == 'otel'
49
+ Requires-Dist: opentelemetry-instrumentation-httpx>=0.41b0; extra == 'otel'
50
+ Requires-Dist: opentelemetry-instrumentation-logging>=0.41b0; extra == 'otel'
51
+ Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otel'
52
+ Provides-Extra: s3
53
+ Requires-Dist: boto3>=1.34.0; extra == 's3'
54
+ Description-Content-Type: text/markdown
55
+
56
+ <div align="center">
57
+
58
+ <img src="assets/banner.svg" alt="scry" width="400">
59
+
60
+ [![CI](https://github.com/ryanmat/scry/actions/workflows/ci.yml/badge.svg)](https://github.com/ryanmat/scry/actions/workflows/ci.yml)
61
+ [![PyPI](https://img.shields.io/pypi/v/scryml.svg)](https://pypi.org/project/scryml/)
62
+ [![Python](https://img.shields.io/pypi/pyversions/scryml.svg)](https://pypi.org/project/scryml/)
63
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
64
+
65
+ </div>
66
+
67
+ **Scry predicts infrastructure failure states from a stream of metrics.** It sorts each resource into one of five operational states, recommends an action for each, and forecasts where the metrics are headed. It is data-source agnostic and runs offline. You bring your own metrics, train your own model, and serve predictions over a small HTTP API. No trained weights ship.
68
+
69
+ LogicMonitor is one supported adapter, not the anchor. The default path reads Parquet or CSV from local files or object storage. Everything normalizes to one canonical long-format table, so any metric source works once it is in that shape.
70
+
71
+ <table>
72
+ <tr><td><b>The X-DEC model</b></td><td>A dual-encoder temporal VAE plus deep embedded clustering, pure PyTorch, no cloud dependencies. Trains on your own windowed metrics from scratch.</td></tr>
73
+ <tr><td><b>Five operational states</b></td><td>Every resource is sorted into NORMAL, PRE_SCALE, PRE_FAILURE, ACTIVE_DEGRADATION, or ANOMALY, each mapped to a recommended action and priority.</td></tr>
74
+ <tr><td><b>Forecasting</b></td><td>An optional Chronos layer (<code>scryml[forecast]</code>) projects where each metric is headed across multiple horizons, kept behind an extra so the core stays offline-capable.</td></tr>
75
+ <tr><td><b>Data-source agnostic</b></td><td>Read Parquet or CSV from local disk or object storage (S3, GCS, ADLS, MinIO) through DuckDB. The LogicMonitor adapter lives behind <code>scryml[logicmonitor]</code>.</td></tr>
76
+ <tr><td><b>A small HTTP service</b></td><td>FastAPI endpoints for prediction, forecasting, drift, anomaly, and accuracy: <code>/predict</code>, <code>/predict/lookup</code>, <code>/forecast</code>, <code>/drift</code>, <code>/anomaly</code>, <code>/accuracy</code>.</td></tr>
77
+ <tr><td><b>Bring your own data</b></td><td>One canonical schema: resource, metric, timestamp, value, plus optional host and datasource fields. Drop your metrics into that table and train. No real telemetry or weights are included.</td></tr>
78
+ </table>
79
+
80
+ ---
81
+
82
+ ## Install
83
+
84
+ ```bash
85
+ pip install scryml # core: the model and the API
86
+ pip install "scryml[forecast]" # add Chronos forecasting
87
+ pip install "scryml[logicmonitor]" # add the LogicMonitor adapter
88
+ ```
89
+
90
+ Or from source with every extra:
91
+
92
+ ```bash
93
+ git clone https://github.com/ryanmat/scry && cd scry
94
+ uv sync --all-extras
95
+ ```
96
+
97
+ ## Quickstart
98
+
99
+ End to end on the bundled synthetic sample, no cloud:
100
+
101
+ ```bash
102
+ # extract windowed features (the sample is dated 2026-01-01)
103
+ python scripts/extract_features.py --data examples/sample_data/metrics.parquet \
104
+ --start 2026-01-01 --end 2026-01-02 --profile kubernetes \
105
+ --output data/training_data.npz
106
+
107
+ # train a model, then serve it
108
+ python scripts/train_model.py --data data/training_data.npz --output models/xdec_model.pt
109
+ MODEL_PATH=models/xdec_model.pt uvicorn scry.api.main:app --port 8000
110
+ ```
111
+
112
+ ```bash
113
+ curl localhost:8000/health
114
+ curl localhost:8000/clusters
115
+ ```
116
+
117
+ Full walkthrough, including a `/predict` call: [examples/quickstart.md](examples/quickstart.md).
118
+
119
+ ## Documentation
120
+
121
+ - [Architecture](docs/architecture.md): the model, the data seam, and how the pieces fit together.
122
+ - [Data contract](docs/data-contract.md): the canonical metric schema and the ingestion API.
123
+ - [Ingestion](docs/ingestion.md): object storage and the LogicMonitor adapter.
124
+ - [Training](docs/training.md): training locally or on your own orchestrator.
125
+
126
+ Built with `uv`, `ruff`, and `pytest` on Python 3.10 and up.
127
+
128
+ ## License
129
+
130
+ Apache-2.0.
131
+
132
+ WAKE UP TO FIND OUT THAT YOU ARE THE EYES OF THE WORLD
scryml-0.1.0/README.md ADDED
@@ -0,0 +1,77 @@
1
+ <div align="center">
2
+
3
+ <img src="assets/banner.svg" alt="scry" width="400">
4
+
5
+ [![CI](https://github.com/ryanmat/scry/actions/workflows/ci.yml/badge.svg)](https://github.com/ryanmat/scry/actions/workflows/ci.yml)
6
+ [![PyPI](https://img.shields.io/pypi/v/scryml.svg)](https://pypi.org/project/scryml/)
7
+ [![Python](https://img.shields.io/pypi/pyversions/scryml.svg)](https://pypi.org/project/scryml/)
8
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
9
+
10
+ </div>
11
+
12
+ **Scry predicts infrastructure failure states from a stream of metrics.** It sorts each resource into one of five operational states, recommends an action for each, and forecasts where the metrics are headed. It is data-source agnostic and runs offline. You bring your own metrics, train your own model, and serve predictions over a small HTTP API. No trained weights ship.
13
+
14
+ LogicMonitor is one supported adapter, not the anchor. The default path reads Parquet or CSV from local files or object storage. Everything normalizes to one canonical long-format table, so any metric source works once it is in that shape.
15
+
16
+ <table>
17
+ <tr><td><b>The X-DEC model</b></td><td>A dual-encoder temporal VAE plus deep embedded clustering, pure PyTorch, no cloud dependencies. Trains on your own windowed metrics from scratch.</td></tr>
18
+ <tr><td><b>Five operational states</b></td><td>Every resource is sorted into NORMAL, PRE_SCALE, PRE_FAILURE, ACTIVE_DEGRADATION, or ANOMALY, each mapped to a recommended action and priority.</td></tr>
19
+ <tr><td><b>Forecasting</b></td><td>An optional Chronos layer (<code>scryml[forecast]</code>) projects where each metric is headed across multiple horizons, kept behind an extra so the core stays offline-capable.</td></tr>
20
+ <tr><td><b>Data-source agnostic</b></td><td>Read Parquet or CSV from local disk or object storage (S3, GCS, ADLS, MinIO) through DuckDB. The LogicMonitor adapter lives behind <code>scryml[logicmonitor]</code>.</td></tr>
21
+ <tr><td><b>A small HTTP service</b></td><td>FastAPI endpoints for prediction, forecasting, drift, anomaly, and accuracy: <code>/predict</code>, <code>/predict/lookup</code>, <code>/forecast</code>, <code>/drift</code>, <code>/anomaly</code>, <code>/accuracy</code>.</td></tr>
22
+ <tr><td><b>Bring your own data</b></td><td>One canonical schema: resource, metric, timestamp, value, plus optional host and datasource fields. Drop your metrics into that table and train. No real telemetry or weights are included.</td></tr>
23
+ </table>
24
+
25
+ ---
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pip install scryml # core: the model and the API
31
+ pip install "scryml[forecast]" # add Chronos forecasting
32
+ pip install "scryml[logicmonitor]" # add the LogicMonitor adapter
33
+ ```
34
+
35
+ Or from source with every extra:
36
+
37
+ ```bash
38
+ git clone https://github.com/ryanmat/scry && cd scry
39
+ uv sync --all-extras
40
+ ```
41
+
42
+ ## Quickstart
43
+
44
+ End to end on the bundled synthetic sample, no cloud:
45
+
46
+ ```bash
47
+ # extract windowed features (the sample is dated 2026-01-01)
48
+ python scripts/extract_features.py --data examples/sample_data/metrics.parquet \
49
+ --start 2026-01-01 --end 2026-01-02 --profile kubernetes \
50
+ --output data/training_data.npz
51
+
52
+ # train a model, then serve it
53
+ python scripts/train_model.py --data data/training_data.npz --output models/xdec_model.pt
54
+ MODEL_PATH=models/xdec_model.pt uvicorn scry.api.main:app --port 8000
55
+ ```
56
+
57
+ ```bash
58
+ curl localhost:8000/health
59
+ curl localhost:8000/clusters
60
+ ```
61
+
62
+ Full walkthrough, including a `/predict` call: [examples/quickstart.md](examples/quickstart.md).
63
+
64
+ ## Documentation
65
+
66
+ - [Architecture](docs/architecture.md): the model, the data seam, and how the pieces fit together.
67
+ - [Data contract](docs/data-contract.md): the canonical metric schema and the ingestion API.
68
+ - [Ingestion](docs/ingestion.md): object storage and the LogicMonitor adapter.
69
+ - [Training](docs/training.md): training locally or on your own orchestrator.
70
+
71
+ Built with `uv`, `ruff`, and `pytest` on Python 3.10 and up.
72
+
73
+ ## License
74
+
75
+ Apache-2.0.
76
+
77
+ WAKE UP TO FIND OUT THAT YOU ARE THE EYES OF THE WORLD