margin 0.9.23__tar.gz → 0.9.25__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.

Potentially problematic release.


This version of margin might be problematic. Click here for more details.

Files changed (91) hide show
  1. {margin-0.9.23/margin.egg-info → margin-0.9.25}/PKG-INFO +8 -1
  2. {margin-0.9.23 → margin-0.9.25}/README.md +5 -0
  3. {margin-0.9.23 → margin-0.9.25}/margin/anomaly.py +9 -4
  4. {margin-0.9.23 → margin-0.9.25}/margin/fingerprint.py +5 -2
  5. {margin-0.9.23 → margin-0.9.25/margin.egg-info}/PKG-INFO +8 -1
  6. {margin-0.9.23 → margin-0.9.25}/pyproject.toml +3 -1
  7. {margin-0.9.23 → margin-0.9.25}/LICENSE +0 -0
  8. {margin-0.9.23 → margin-0.9.25}/NOTICE +0 -0
  9. {margin-0.9.23 → margin-0.9.25}/margin/__init__.py +0 -0
  10. {margin-0.9.23 → margin-0.9.25}/margin/__main__.py +0 -0
  11. {margin-0.9.23 → margin-0.9.25}/margin/algebra.py +0 -0
  12. {margin-0.9.23 → margin-0.9.25}/margin/bridge.py +0 -0
  13. {margin-0.9.23 → margin-0.9.25}/margin/calibrate.py +0 -0
  14. {margin-0.9.23 → margin-0.9.25}/margin/causal.py +0 -0
  15. {margin-0.9.23 → margin-0.9.25}/margin/composite.py +0 -0
  16. {margin-0.9.23 → margin-0.9.25}/margin/confidence.py +0 -0
  17. {margin-0.9.23 → margin-0.9.25}/margin/config.py +0 -0
  18. {margin-0.9.23 → margin-0.9.25}/margin/contract.py +0 -0
  19. {margin-0.9.23 → margin-0.9.25}/margin/controller.py +0 -0
  20. {margin-0.9.23 → margin-0.9.25}/margin/correlate.py +0 -0
  21. {margin-0.9.23 → margin-0.9.25}/margin/diff.py +0 -0
  22. {margin-0.9.23 → margin-0.9.25}/margin/drift.py +0 -0
  23. {margin-0.9.23 → margin-0.9.25}/margin/events.py +0 -0
  24. {margin-0.9.23 → margin-0.9.25}/margin/forecast.py +0 -0
  25. {margin-0.9.23 → margin-0.9.25}/margin/health.py +0 -0
  26. {margin-0.9.23 → margin-0.9.25}/margin/intent.py +0 -0
  27. {margin-0.9.23 → margin-0.9.25}/margin/ledger.py +0 -0
  28. {margin-0.9.23 → margin-0.9.25}/margin/loop.py +0 -0
  29. {margin-0.9.23 → margin-0.9.25}/margin/observation.py +0 -0
  30. {margin-0.9.23 → margin-0.9.25}/margin/persist.py +0 -0
  31. {margin-0.9.23 → margin-0.9.25}/margin/policy/__init__.py +0 -0
  32. {margin-0.9.23 → margin-0.9.25}/margin/policy/compose.py +0 -0
  33. {margin-0.9.23 → margin-0.9.25}/margin/policy/core.py +0 -0
  34. {margin-0.9.23 → margin-0.9.25}/margin/policy/temporal.py +0 -0
  35. {margin-0.9.23 → margin-0.9.25}/margin/policy/trace.py +0 -0
  36. {margin-0.9.23 → margin-0.9.25}/margin/policy/tuning.py +0 -0
  37. {margin-0.9.23 → margin-0.9.25}/margin/policy/validate.py +0 -0
  38. {margin-0.9.23 → margin-0.9.25}/margin/predicates.py +0 -0
  39. {margin-0.9.23 → margin-0.9.25}/margin/provenance.py +0 -0
  40. {margin-0.9.23 → margin-0.9.25}/margin/streaming.py +0 -0
  41. {margin-0.9.23 → margin-0.9.25}/margin/transitions.py +0 -0
  42. {margin-0.9.23 → margin-0.9.25}/margin/uncertain.py +0 -0
  43. {margin-0.9.23 → margin-0.9.25}/margin/validity.py +0 -0
  44. {margin-0.9.23 → margin-0.9.25}/margin.egg-info/SOURCES.txt +0 -0
  45. {margin-0.9.23 → margin-0.9.25}/margin.egg-info/dependency_links.txt +0 -0
  46. {margin-0.9.23 → margin-0.9.25}/margin.egg-info/top_level.txt +0 -0
  47. {margin-0.9.23 → margin-0.9.25}/setup.cfg +0 -0
  48. {margin-0.9.23 → margin-0.9.25}/tests/test_absence.py +0 -0
  49. {margin-0.9.23 → margin-0.9.25}/tests/test_algebra.py +0 -0
  50. {margin-0.9.23 → margin-0.9.25}/tests/test_anomaly.py +0 -0
  51. {margin-0.9.23 → margin-0.9.25}/tests/test_bridge.py +0 -0
  52. {margin-0.9.23 → margin-0.9.25}/tests/test_calibrate.py +0 -0
  53. {margin-0.9.23 → margin-0.9.25}/tests/test_causal.py +0 -0
  54. {margin-0.9.23 → margin-0.9.25}/tests/test_composite.py +0 -0
  55. {margin-0.9.23 → margin-0.9.25}/tests/test_confidence.py +0 -0
  56. {margin-0.9.23 → margin-0.9.25}/tests/test_config.py +0 -0
  57. {margin-0.9.23 → margin-0.9.25}/tests/test_contract.py +0 -0
  58. {margin-0.9.23 → margin-0.9.25}/tests/test_controller.py +0 -0
  59. {margin-0.9.23 → margin-0.9.25}/tests/test_correlate.py +0 -0
  60. {margin-0.9.23 → margin-0.9.25}/tests/test_diff.py +0 -0
  61. {margin-0.9.23 → margin-0.9.25}/tests/test_drift.py +0 -0
  62. {margin-0.9.23 → margin-0.9.25}/tests/test_events.py +0 -0
  63. {margin-0.9.23 → margin-0.9.25}/tests/test_fingerprint_ext.py +0 -0
  64. {margin-0.9.23 → margin-0.9.25}/tests/test_forecast.py +0 -0
  65. {margin-0.9.23 → margin-0.9.25}/tests/test_health.py +0 -0
  66. {margin-0.9.23 → margin-0.9.25}/tests/test_healthcare.py +0 -0
  67. {margin-0.9.23 → margin-0.9.25}/tests/test_intent.py +0 -0
  68. {margin-0.9.23 → margin-0.9.25}/tests/test_ledger.py +0 -0
  69. {margin-0.9.23 → margin-0.9.25}/tests/test_loop.py +0 -0
  70. {margin-0.9.23 → margin-0.9.25}/tests/test_neuro.py +0 -0
  71. {margin-0.9.23 → margin-0.9.25}/tests/test_observation.py +0 -0
  72. {margin-0.9.23 → margin-0.9.25}/tests/test_persist.py +0 -0
  73. {margin-0.9.23 → margin-0.9.25}/tests/test_pipeline_features.py +0 -0
  74. {margin-0.9.23 → margin-0.9.25}/tests/test_policy.py +0 -0
  75. {margin-0.9.23 → margin-0.9.25}/tests/test_policy_compose.py +0 -0
  76. {margin-0.9.23 → margin-0.9.25}/tests/test_policy_temporal.py +0 -0
  77. {margin-0.9.23 → margin-0.9.25}/tests/test_policy_trace.py +0 -0
  78. {margin-0.9.23 → margin-0.9.25}/tests/test_policy_tuning.py +0 -0
  79. {margin-0.9.23 → margin-0.9.25}/tests/test_policy_validate.py +0 -0
  80. {margin-0.9.23 → margin-0.9.25}/tests/test_predicates.py +0 -0
  81. {margin-0.9.23 → margin-0.9.25}/tests/test_printer3d.py +0 -0
  82. {margin-0.9.23 → margin-0.9.25}/tests/test_provenance.py +0 -0
  83. {margin-0.9.23 → margin-0.9.25}/tests/test_reverse_bridge.py +0 -0
  84. {margin-0.9.23 → margin-0.9.25}/tests/test_ros2.py +0 -0
  85. {margin-0.9.23 → margin-0.9.25}/tests/test_staleness.py +0 -0
  86. {margin-0.9.23 → margin-0.9.25}/tests/test_streaming.py +0 -0
  87. {margin-0.9.23 → margin-0.9.25}/tests/test_transformer.py +0 -0
  88. {margin-0.9.23 → margin-0.9.25}/tests/test_transitions.py +0 -0
  89. {margin-0.9.23 → margin-0.9.25}/tests/test_uncertain.py +0 -0
  90. {margin-0.9.23 → margin-0.9.25}/tests/test_validity.py +0 -0
  91. {margin-0.9.23 → margin-0.9.25}/tests/test_windowing.py +0 -0
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: margin
3
- Version: 0.9.23
3
+ Version: 0.9.25
4
4
  Summary: Typed health classification, uncertainty algebra, and correction auditing for any system that measures things and needs to explain what happened.
5
5
  Author: Cope Labs LLC
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/sethc5/margin
8
8
  Project-URL: Repository, https://github.com/sethc5/margin
9
9
  Project-URL: Issues, https://github.com/sethc5/margin/issues
10
+ Project-URL: Changelog, https://github.com/sethc5/margin/blob/main/CHANGELOG.md
11
+ Project-URL: Documentation, https://github.com/sethc5/margin#readme
10
12
  Keywords: health,monitoring,uncertainty,observability,typed,classification,threshold,polarity,correction,audit,ledger,policy
11
13
  Classifier: Development Status :: 4 - Beta
12
14
  Classifier: Intended Audience :: Developers
@@ -27,6 +29,11 @@ Dynamic: license-file
27
29
 
28
30
  # margin
29
31
 
32
+ [![PyPI version](https://img.shields.io/pypi/v/margin.svg)](https://pypi.org/project/margin/)
33
+ [![Downloads](https://static.pepy.tech/badge/margin)](https://pepy.tech/project/margin)
34
+ [![Downloads/month](https://static.pepy.tech/badge/margin/month)](https://pepy.tech/project/margin)
35
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
36
+
30
37
  **Typed health classification for systems that measure things.**
31
38
 
32
39
  Every system with health bars, thresholds, alerts, or status dashboards solves the same problem: take a number, decide if it's healthy, correct it if it isn't, explain what happened. Margin is that pattern, typed once, with the polarity bug fixed.
@@ -1,5 +1,10 @@
1
1
  # margin
2
2
 
3
+ [![PyPI version](https://img.shields.io/pypi/v/margin.svg)](https://pypi.org/project/margin/)
4
+ [![Downloads](https://static.pepy.tech/badge/margin)](https://pepy.tech/project/margin)
5
+ [![Downloads/month](https://static.pepy.tech/badge/margin/month)](https://pepy.tech/project/margin)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
7
+
3
8
  **Typed health classification for systems that measure things.**
4
9
 
5
10
  Every system with health bars, thresholds, alerts, or status dashboards solves the same problem: take a number, decide if it's healthy, correct it if it isn't, explain what happened. Margin is that pattern, typed once, with the polarity bug fixed.
@@ -396,16 +396,21 @@ def check_distribution(
396
396
  rec_mean = _mean(recent)
397
397
  rec_std = _std(recent, rec_mean)
398
398
 
399
- # Mean shift (relative to reference)
399
+ # Mean shift (relative to reference). Tolerances guard against
400
+ # floating-point noise from all-constant inputs (std can be ~1e-17 on
401
+ # some Python versions instead of exactly 0.0).
400
402
  if abs(ref_mean) > 1e-10:
401
403
  mean_shift = abs(rec_mean - ref_mean) / abs(ref_mean)
402
- elif ref_std > 0:
404
+ elif ref_std > 1e-12:
403
405
  mean_shift = abs(rec_mean - ref_mean) / ref_std
404
406
  else:
405
407
  mean_shift = 0.0 if rec_mean == ref_mean else float('inf')
406
408
 
407
- # Std ratio
408
- std_ratio = rec_std / ref_std if ref_std > 0 else (1.0 if rec_std == 0 else float('inf'))
409
+ # Std ratio — treat near-zero std as effectively zero
410
+ if ref_std > 1e-12:
411
+ std_ratio = rec_std / ref_std
412
+ else:
413
+ std_ratio = 1.0 if rec_std < 1e-12 else float('inf')
409
414
 
410
415
  # Shape metrics
411
416
  ref_kurt = _kurtosis_excess(reference, ref_mean, ref_std)
@@ -176,7 +176,10 @@ class Fingerprint(dict):
176
176
  stats = self.get(component, {})
177
177
  mean = stats.get("mean", 0.0)
178
178
  std = stats.get("std", 0.0)
179
- if std != 0.0:
179
+ # Tolerance guard: std accumulated from all-constant values can be 1e-17
180
+ # on some Python versions (floating-point noise), which would otherwise
181
+ # amplify the ratio by 15+ orders of magnitude.
182
+ if std > 1e-12:
180
183
  return (value - mean) / std
181
184
  if mean == 0.0:
182
185
  return value
@@ -199,7 +202,7 @@ class Fingerprint(dict):
199
202
  q25 = self.percentile(component, 25)
200
203
  q75 = self.percentile(component, 75)
201
204
  iqr = q75 - q25
202
- if iqr == 0.0:
205
+ if abs(iqr) < 1e-12:
203
206
  return self.sigma(component, value)
204
207
  return (value - median) / iqr
205
208
 
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: margin
3
- Version: 0.9.23
3
+ Version: 0.9.25
4
4
  Summary: Typed health classification, uncertainty algebra, and correction auditing for any system that measures things and needs to explain what happened.
5
5
  Author: Cope Labs LLC
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/sethc5/margin
8
8
  Project-URL: Repository, https://github.com/sethc5/margin
9
9
  Project-URL: Issues, https://github.com/sethc5/margin/issues
10
+ Project-URL: Changelog, https://github.com/sethc5/margin/blob/main/CHANGELOG.md
11
+ Project-URL: Documentation, https://github.com/sethc5/margin#readme
10
12
  Keywords: health,monitoring,uncertainty,observability,typed,classification,threshold,polarity,correction,audit,ledger,policy
11
13
  Classifier: Development Status :: 4 - Beta
12
14
  Classifier: Intended Audience :: Developers
@@ -27,6 +29,11 @@ Dynamic: license-file
27
29
 
28
30
  # margin
29
31
 
32
+ [![PyPI version](https://img.shields.io/pypi/v/margin.svg)](https://pypi.org/project/margin/)
33
+ [![Downloads](https://static.pepy.tech/badge/margin)](https://pepy.tech/project/margin)
34
+ [![Downloads/month](https://static.pepy.tech/badge/margin/month)](https://pepy.tech/project/margin)
35
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
36
+
30
37
  **Typed health classification for systems that measure things.**
31
38
 
32
39
  Every system with health bars, thresholds, alerts, or status dashboards solves the same problem: take a number, decide if it's healthy, correct it if it isn't, explain what happened. Margin is that pattern, typed once, with the polarity bug fixed.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "margin"
7
- version = "0.9.23"
7
+ version = "0.9.25"
8
8
  description = "Typed health classification, uncertainty algebra, and correction auditing for any system that measures things and needs to explain what happened."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -33,6 +33,8 @@ classifiers = [
33
33
  Homepage = "https://github.com/sethc5/margin"
34
34
  Repository = "https://github.com/sethc5/margin"
35
35
  Issues = "https://github.com/sethc5/margin/issues"
36
+ Changelog = "https://github.com/sethc5/margin/blob/main/CHANGELOG.md"
37
+ Documentation = "https://github.com/sethc5/margin#readme"
36
38
 
37
39
  [tool.setuptools.packages.find]
38
40
  include = ["margin*"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes