proxyml-core 0.2.1__tar.gz → 0.2.2__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 (29) hide show
  1. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/PKG-INFO +1 -1
  2. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/pyproject.toml +1 -1
  3. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/__init__.py +3 -0
  4. proxyml_core-0.2.2/src/proxyml_core/fingerprint.py +34 -0
  5. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core.egg-info/PKG-INFO +1 -1
  6. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core.egg-info/SOURCES.txt +2 -0
  7. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_dependency_boundaries.py +1 -1
  8. proxyml_core-0.2.2/tests/test_fingerprint.py +21 -0
  9. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/LICENSE +0 -0
  10. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/README.md +0 -0
  11. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/setup.cfg +0 -0
  12. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/_version.py +0 -0
  13. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/export.py +0 -0
  14. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/modeling/__init__.py +0 -0
  15. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/modeling/estimators.py +0 -0
  16. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/modeling/extract.py +0 -0
  17. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/modeling/preprocess.py +0 -0
  18. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/modeling/scoring.py +0 -0
  19. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core/schema.py +0 -0
  20. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core.egg-info/dependency_links.txt +0 -0
  21. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core.egg-info/requires.txt +0 -0
  22. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/src/proxyml_core.egg-info/top_level.txt +0 -0
  23. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_export.py +0 -0
  24. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_export_version_contract.py +0 -0
  25. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_modeling_estimators.py +0 -0
  26. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_modeling_extract.py +0 -0
  27. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_modeling_preprocess.py +0 -0
  28. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_modeling_scoring.py +0 -0
  29. {proxyml_core-0.2.1 → proxyml_core-0.2.2}/tests/test_schema.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxyml-core
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Shared schema types, export contract, and modeling code for proxyml and its backend.
5
5
  Author-email: ProxyML <contact@proxyml.ai>
6
6
  License: Apache License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "proxyml-core"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Shared schema types, export contract, and modeling code for proxyml and its backend."
5
5
  readme = "README.md"
6
6
  license = {file = "LICENSE"}
@@ -15,6 +15,7 @@ from proxyml_core.export import (
15
15
  predict_from_export,
16
16
  score_export,
17
17
  )
18
+ from proxyml_core.fingerprint import FINGERPRINT_MISMATCH_MESSAGE, check_fingerprints
18
19
  from proxyml_core.schema import (
19
20
  CategoricalFeature,
20
21
  CategoricalOrdinalFeature,
@@ -49,4 +50,6 @@ __all__ = [
49
50
  "EXPORT_SCHEMA_VERSION",
50
51
  "IncompatibleExportVersionError",
51
52
  "check_compatible",
53
+ "check_fingerprints",
54
+ "FINGERPRINT_MISMATCH_MESSAGE",
52
55
  ]
@@ -0,0 +1,34 @@
1
+ """Shared data-population identity check.
2
+
3
+ ``fingerprint_labels()`` (in the ``proxyml`` SDK's local-training module)
4
+ hashes a label array without the data ever leaving the caller's process;
5
+ what travels instead is the resulting fingerprint string. ``check_fingerprints``
6
+ is the other half of that contract: comparing two such fingerprints to
7
+ confirm a challenger and champion were actually scored on the same
8
+ population. It's pure (stdlib only) so the exact same check can run
9
+ client-side, in the SDK, before upload, and server-side, both to reject a
10
+ mismatched upload and to render a comparison's match status — one
11
+ implementation, not three that can quietly drift apart.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ FINGERPRINT_MISMATCH_MESSAGE = (
17
+ "challenger_data_fingerprint and champion_data_fingerprint don't match — "
18
+ "were the challenger and champion scored on the same data? "
19
+ "(e.g. train_challenger() and score_champion() called against different files)"
20
+ )
21
+
22
+
23
+ def check_fingerprints(challenger_fingerprint: str | None, champion_fingerprint: str | None) -> bool | None:
24
+ """Whether two data fingerprints match, or ``None`` if either is missing.
25
+
26
+ Returns ``None`` — not ``False`` — when either fingerprint is absent,
27
+ since "unknown" and "confirmed mismatch" call for different handling:
28
+ a hard-validation caller should treat ``None`` as nothing to check yet,
29
+ while a caller rendering a status badge should show a neutral/unknown
30
+ state rather than a false-alarm red one.
31
+ """
32
+ if challenger_fingerprint is None or champion_fingerprint is None:
33
+ return None
34
+ return challenger_fingerprint == champion_fingerprint
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxyml-core
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Shared schema types, export contract, and modeling code for proxyml and its backend.
5
5
  Author-email: ProxyML <contact@proxyml.ai>
6
6
  License: Apache License
@@ -4,6 +4,7 @@ pyproject.toml
4
4
  src/proxyml_core/__init__.py
5
5
  src/proxyml_core/_version.py
6
6
  src/proxyml_core/export.py
7
+ src/proxyml_core/fingerprint.py
7
8
  src/proxyml_core/schema.py
8
9
  src/proxyml_core.egg-info/PKG-INFO
9
10
  src/proxyml_core.egg-info/SOURCES.txt
@@ -18,6 +19,7 @@ src/proxyml_core/modeling/scoring.py
18
19
  tests/test_dependency_boundaries.py
19
20
  tests/test_export.py
20
21
  tests/test_export_version_contract.py
22
+ tests/test_fingerprint.py
21
23
  tests/test_modeling_estimators.py
22
24
  tests/test_modeling_extract.py
23
25
  tests/test_modeling_preprocess.py
@@ -12,7 +12,7 @@ from pathlib import Path
12
12
 
13
13
  import proxyml_core
14
14
 
15
- _PURE_MODULES = ["schema.py", "export.py", "_version.py"]
15
+ _PURE_MODULES = ["schema.py", "export.py", "_version.py", "fingerprint.py"]
16
16
  _ALLOWED_PURE_TOP_LEVEL = {"numpy"} | set(sys.stdlib_module_names)
17
17
  _ALLOWED_MODELING_TOP_LEVEL = _ALLOWED_PURE_TOP_LEVEL | {"sklearn", "scipy"}
18
18
 
@@ -0,0 +1,21 @@
1
+ from proxyml_core.fingerprint import check_fingerprints
2
+
3
+
4
+ def test_check_fingerprints_match():
5
+ assert check_fingerprints("abc", "abc") is True
6
+
7
+
8
+ def test_check_fingerprints_mismatch():
9
+ assert check_fingerprints("abc", "def") is False
10
+
11
+
12
+ def test_check_fingerprints_missing_challenger():
13
+ assert check_fingerprints(None, "def") is None
14
+
15
+
16
+ def test_check_fingerprints_missing_champion():
17
+ assert check_fingerprints("abc", None) is None
18
+
19
+
20
+ def test_check_fingerprints_both_missing():
21
+ assert check_fingerprints(None, None) is None
File without changes
File without changes
File without changes