krepis 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 (46) hide show
  1. krepis-0.1.0/LICENSE +21 -0
  2. krepis-0.1.0/NOTICE +12 -0
  3. krepis-0.1.0/PKG-INFO +84 -0
  4. krepis-0.1.0/README.md +54 -0
  5. krepis-0.1.0/pyproject.toml +55 -0
  6. krepis-0.1.0/setup.cfg +4 -0
  7. krepis-0.1.0/src/krepis/__init__.py +17 -0
  8. krepis-0.1.0/src/krepis/alerts.py +597 -0
  9. krepis-0.1.0/src/krepis/anthropic_payload.py +309 -0
  10. krepis-0.1.0/src/krepis/cost.py +783 -0
  11. krepis-0.1.0/src/krepis/dates.py +273 -0
  12. krepis-0.1.0/src/krepis/ec2_spot.py +525 -0
  13. krepis-0.1.0/src/krepis/email_sender.py +206 -0
  14. krepis-0.1.0/src/krepis/http_retry.py +199 -0
  15. krepis-0.1.0/src/krepis/locks.py +322 -0
  16. krepis-0.1.0/src/krepis/logging.py +474 -0
  17. krepis-0.1.0/src/krepis/metrics.py +202 -0
  18. krepis-0.1.0/src/krepis/model_metadata.py +58 -0
  19. krepis-0.1.0/src/krepis/model_pricing.yaml +73 -0
  20. krepis-0.1.0/src/krepis/py.typed +0 -0
  21. krepis-0.1.0/src/krepis/secrets.py +186 -0
  22. krepis-0.1.0/src/krepis/ssm_dispatcher.py +617 -0
  23. krepis-0.1.0/src/krepis/ssm_log_capture.py +274 -0
  24. krepis-0.1.0/src/krepis/telegram.py +165 -0
  25. krepis-0.1.0/src/krepis/trading_calendar.py +236 -0
  26. krepis-0.1.0/src/krepis.egg-info/PKG-INFO +84 -0
  27. krepis-0.1.0/src/krepis.egg-info/SOURCES.txt +44 -0
  28. krepis-0.1.0/src/krepis.egg-info/dependency_links.txt +1 -0
  29. krepis-0.1.0/src/krepis.egg-info/requires.txt +12 -0
  30. krepis-0.1.0/src/krepis.egg-info/top_level.txt +1 -0
  31. krepis-0.1.0/tests/test_alerts.py +761 -0
  32. krepis-0.1.0/tests/test_anthropic_payload.py +390 -0
  33. krepis-0.1.0/tests/test_cost.py +900 -0
  34. krepis-0.1.0/tests/test_dates.py +276 -0
  35. krepis-0.1.0/tests/test_ec2_spot.py +542 -0
  36. krepis-0.1.0/tests/test_email_sender.py +184 -0
  37. krepis-0.1.0/tests/test_flow_doctor_default_on.py +224 -0
  38. krepis-0.1.0/tests/test_http_retry.py +199 -0
  39. krepis-0.1.0/tests/test_locks.py +356 -0
  40. krepis-0.1.0/tests/test_logging.py +535 -0
  41. krepis-0.1.0/tests/test_metrics.py +122 -0
  42. krepis-0.1.0/tests/test_secrets.py +236 -0
  43. krepis-0.1.0/tests/test_ssm_dispatcher.py +1021 -0
  44. krepis-0.1.0/tests/test_ssm_log_capture.py +297 -0
  45. krepis-0.1.0/tests/test_telegram.py +213 -0
  46. krepis-0.1.0/tests/test_trading_calendar.py +143 -0
krepis-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brian McMahon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
krepis-0.1.0/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ krepis
2
+ Copyright (c) 2026 Brian McMahon
3
+
4
+ This product is part of the Nous Ergon project and is licensed under the MIT
5
+ License (see LICENSE).
6
+
7
+ Portions of this library were extracted from the Nous Ergon shared utility
8
+ layer (`nousergon-lib`) as the edge-free, permissively-licensed foundation
9
+ on which the rest of the stack depends. krepis carries no proprietary edge:
10
+ anything encoding what the system believes (features, factors, models,
11
+ strategy) lives in the AGPL-licensed `nousergon-lib`, which depends down onto
12
+ krepis — never the reverse.
krepis-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: krepis
3
+ Version: 0.1.0
4
+ Summary: krepis (Greek κρηπίς — the foundation a structure stands on): the MIT foundation library for the Nous Ergon stack — logging, SSM secrets, Telegram/SNS alerts, bounded-backoff HTTP retry, S3 writer locks, the Anthropic payload chokepoint, LLM cost telemetry, trading-calendar/date helpers, and EC2-spot/SSM resilience. Edge-free primitives that every higher layer depends down onto.
5
+ Author: Brian McMahon
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/nousergon/krepis
8
+ Project-URL: Repository, https://github.com/nousergon/krepis
9
+ Project-URL: Issues, https://github.com/nousergon/krepis/issues
10
+ Keywords: aws,ssm,telemetry,pipeline,alerts,trading-calendar
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ Requires-Dist: boto3>=1.34
21
+ Requires-Dist: pydantic>=2.0
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: requests>=2.31
24
+ Requires-Dist: eval_type_backport>=0.2.0; python_version < "3.10"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+ Requires-Dist: moto>=5.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # krepis
32
+
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
34
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)]()
35
+ [![Typed](https://img.shields.io/badge/typed-PEP_561-blue.svg)]()
36
+
37
+ **krepis** (Greek κρηπίς — the stone foundation-course a temple is built on)
38
+ is the MIT foundation library for the [Nous Ergon](https://github.com/nousergon)
39
+ stack: the generic, edge-free primitives that every layer above depends
40
+ *down* onto.
41
+
42
+ It carries **zero proprietary edge**. Anything that encodes *what the system
43
+ believes* — features, factors, models, strategy — lives in the AGPL-licensed
44
+ `nousergon-lib`, which depends down onto krepis. Because krepis is MIT,
45
+ permissively-licensed projects (`mnemon`, `flow-doctor`, `morning-signal`)
46
+ can import it without copyleft obligation.
47
+
48
+ ```
49
+ krepis (MIT) ← edge-free primitives; everything depends down onto this
50
+
51
+ nousergon-lib (AGPL) ← the Nous Ergon edge layer, built on krepis
52
+ ```
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install krepis
58
+ ```
59
+
60
+ ## What's inside
61
+
62
+ | Module | Purpose |
63
+ |---|---|
64
+ | `logging` | Structured logging + the flow-doctor secret-seeding chokepoint |
65
+ | `secrets` | SSM-backed secret resolution |
66
+ | `alerts` | Telegram / SNS alert routing with S3-marker dedup (incl. CLI) |
67
+ | `telegram` | Telegram transport |
68
+ | `email_sender` | SES / SMTP email transport |
69
+ | `http_retry` | Bounded-backoff HTTP retry with jitter |
70
+ | `locks` | S3 conditional-PUT writer locks |
71
+ | `cost` | LLM cost telemetry (token counts × price card → USD) |
72
+ | `model_metadata` | `ModelMetadata` value object (per-invocation model + token cost) |
73
+ | `anthropic_payload` | Anthropic request-payload construction + validation chokepoint |
74
+ | `metrics` | Typed metric records |
75
+ | `trading_calendar` | NYSE trading-day calendar (pure stdlib) |
76
+ | `dates` | Calendar/trading-day dual-track date helpers |
77
+ | `ec2_spot` | EC2 spot-instance resilience helpers |
78
+ | `ssm_dispatcher` | SSM command dispatch |
79
+ | `ssm_log_capture` | SSM run-command log capture |
80
+
81
+ ## License
82
+
83
+ MIT — see [LICENSE](LICENSE) and [NOTICE](NOTICE). Contributions accepted
84
+ under the [DCO](CONTRIBUTING.md) (`git commit -s`).
krepis-0.1.0/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # krepis
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)]()
5
+ [![Typed](https://img.shields.io/badge/typed-PEP_561-blue.svg)]()
6
+
7
+ **krepis** (Greek κρηπίς — the stone foundation-course a temple is built on)
8
+ is the MIT foundation library for the [Nous Ergon](https://github.com/nousergon)
9
+ stack: the generic, edge-free primitives that every layer above depends
10
+ *down* onto.
11
+
12
+ It carries **zero proprietary edge**. Anything that encodes *what the system
13
+ believes* — features, factors, models, strategy — lives in the AGPL-licensed
14
+ `nousergon-lib`, which depends down onto krepis. Because krepis is MIT,
15
+ permissively-licensed projects (`mnemon`, `flow-doctor`, `morning-signal`)
16
+ can import it without copyleft obligation.
17
+
18
+ ```
19
+ krepis (MIT) ← edge-free primitives; everything depends down onto this
20
+
21
+ nousergon-lib (AGPL) ← the Nous Ergon edge layer, built on krepis
22
+ ```
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ pip install krepis
28
+ ```
29
+
30
+ ## What's inside
31
+
32
+ | Module | Purpose |
33
+ |---|---|
34
+ | `logging` | Structured logging + the flow-doctor secret-seeding chokepoint |
35
+ | `secrets` | SSM-backed secret resolution |
36
+ | `alerts` | Telegram / SNS alert routing with S3-marker dedup (incl. CLI) |
37
+ | `telegram` | Telegram transport |
38
+ | `email_sender` | SES / SMTP email transport |
39
+ | `http_retry` | Bounded-backoff HTTP retry with jitter |
40
+ | `locks` | S3 conditional-PUT writer locks |
41
+ | `cost` | LLM cost telemetry (token counts × price card → USD) |
42
+ | `model_metadata` | `ModelMetadata` value object (per-invocation model + token cost) |
43
+ | `anthropic_payload` | Anthropic request-payload construction + validation chokepoint |
44
+ | `metrics` | Typed metric records |
45
+ | `trading_calendar` | NYSE trading-day calendar (pure stdlib) |
46
+ | `dates` | Calendar/trading-day dual-track date helpers |
47
+ | `ec2_spot` | EC2 spot-instance resilience helpers |
48
+ | `ssm_dispatcher` | SSM command dispatch |
49
+ | `ssm_log_capture` | SSM run-command log capture |
50
+
51
+ ## License
52
+
53
+ MIT — see [LICENSE](LICENSE) and [NOTICE](NOTICE). Contributions accepted
54
+ under the [DCO](CONTRIBUTING.md) (`git commit -s`).
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "krepis"
7
+ version = "0.1.0"
8
+ description = "krepis (Greek κρηπίς — the foundation a structure stands on): the MIT foundation library for the Nous Ergon stack — logging, SSM secrets, Telegram/SNS alerts, bounded-backoff HTTP retry, S3 writer locks, the Anthropic payload chokepoint, LLM cost telemetry, trading-calendar/date helpers, and EC2-spot/SSM resilience. Edge-free primitives that every higher layer depends down onto."
9
+ readme = "README.md"
10
+ # EC2 still runs Python 3.9 on the always-on micro instance, so PEP 604
11
+ # union syntax (``str | None``) is deferred via ``from __future__ import
12
+ # annotations`` and eval_type_backport on 3.9.
13
+ requires-python = ">=3.9"
14
+ authors = [{ name = "Brian McMahon" }]
15
+ license = { text = "MIT" }
16
+ keywords = ["aws", "ssm", "telemetry", "pipeline", "alerts", "trading-calendar"]
17
+ classifiers = [
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Operating System :: OS Independent",
22
+ "Typing :: Typed",
23
+ ]
24
+ dependencies = [
25
+ "boto3>=1.34",
26
+ "pydantic>=2.0",
27
+ "pyyaml>=6.0",
28
+ "requests>=2.31",
29
+ # Pydantic V2 evaluates field annotations at class-construction time;
30
+ # on Python 3.9 it cannot eval PEP 604 union syntax even under
31
+ # ``from __future__ import annotations``. eval_type_backport is the
32
+ # backport Pydantic's own error message points to. 3.10+ is native.
33
+ "eval_type_backport>=0.2.0; python_version < '3.10'",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/nousergon/krepis"
38
+ Repository = "https://github.com/nousergon/krepis"
39
+ Issues = "https://github.com/nousergon/krepis/issues"
40
+
41
+ [project.optional-dependencies]
42
+ dev = [
43
+ "pytest>=7.0",
44
+ "pytest-cov>=4.0",
45
+ "moto>=5.0",
46
+ ]
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"]
50
+
51
+ [tool.setuptools.package-data]
52
+ "krepis" = ["model_pricing.yaml", "py.typed"]
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests"]
krepis-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,17 @@
1
+ """krepis — the MIT foundation library for the Nous Ergon stack.
2
+
3
+ krepis (Greek κρηπίς, the stone foundation-course a structure stands on)
4
+ holds the generic, edge-free primitives that every layer above it depends
5
+ *down* onto: structured logging, SSM-backed secrets, Telegram/SNS alert
6
+ routing, bounded-backoff HTTP retry, S3 conditional-PUT writer locks, the
7
+ Anthropic payload chokepoint, LLM cost telemetry, trading-calendar/date
8
+ helpers, EC2-spot resilience, and SSM dispatch/log-capture.
9
+
10
+ It carries zero proprietary edge: anything that encodes *what the system
11
+ believes* (features, factors, models, strategy) lives in the AGPL
12
+ ``nousergon-lib`` layer, which depends down onto krepis. Because krepis is
13
+ MIT, permissively-licensed consumers (``mnemon``, ``flow-doctor``,
14
+ ``morning-signal``) can import it without copyleft obligation.
15
+ """
16
+
17
+ __version__ = "0.1.0"