pycheck-neuron 1.0.7__tar.gz → 1.0.8__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.
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/PKG-INFO +1 -1
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/__init__.py +1 -1
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/audit.py +8 -6
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/rules.py +15 -1
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck_neuron.egg-info/PKG-INFO +1 -1
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pyproject.toml +1 -1
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/tests/test_rules.py +1125 -1118
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/LICENSE +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/README.md +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/__main__.py +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/analyzer.py +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/cli.py +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/flow.py +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck/server.py +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck_neuron.egg-info/SOURCES.txt +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck_neuron.egg-info/dependency_links.txt +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck_neuron.egg-info/entry_points.txt +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck_neuron.egg-info/requires.txt +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/pycheck_neuron.egg-info/top_level.txt +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/setup.cfg +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/tests/test_audit.py +0 -0
- {pycheck_neuron-1.0.7 → pycheck_neuron-1.0.8}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pycheck-neuron
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.8
|
|
4
4
|
Summary: 34-rule static AST analyzer catching temporal lookahead bias, causal confusion, and uncertainty bugs in Python ML code. Zero dependencies.
|
|
5
5
|
Author: NEURON Team
|
|
6
6
|
Author-email: Fayo Ibrahim <fayo@neuron-lab.org>
|
|
@@ -3,7 +3,7 @@ PyCheck — NEURON ML Safety Analyzer
|
|
|
3
3
|
Catches temporal leaks, causal confusion, and uncertainty bugs in Python ML scripts.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
__version__ = "1.0.
|
|
6
|
+
__version__ = "1.0.8"
|
|
7
7
|
|
|
8
8
|
from pycheck.analyzer import analyze_file, analyze_code, format_output
|
|
9
9
|
from pycheck.rules import ALL_RULES, RULES_BY_CODE
|
|
@@ -273,7 +273,9 @@ def generate_proof_of_causality_certificate(
|
|
|
273
273
|
raw_serialized = json.dumps(cert_payload, sort_keys=True).encode("utf-8")
|
|
274
274
|
cert_id = f"CERT-POC-{hashlib.sha256(raw_serialized).hexdigest()[:16].upper()}"
|
|
275
275
|
cert_payload["certificate_id"] = cert_id
|
|
276
|
-
|
|
276
|
+
seal_hash = hashlib.sha256(raw_serialized).hexdigest()
|
|
277
|
+
cert_payload["sha256_digital_seal"] = seal_hash
|
|
278
|
+
cert_payload["sha256_audit_digest"] = seal_hash
|
|
277
279
|
|
|
278
280
|
return cert_payload
|
|
279
281
|
|
|
@@ -308,10 +310,10 @@ def format_certificate_text(cert: Dict[str, Any]) -> str:
|
|
|
308
310
|
|
|
309
311
|
lines = [
|
|
310
312
|
"+======================================================================+",
|
|
311
|
-
"| PROOF-OF-CAUSALITY(TM) AUDIT
|
|
312
|
-
"| PyCheck -
|
|
313
|
+
"| PROOF-OF-CAUSALITY(TM) AUDIT REPORT |",
|
|
314
|
+
"| PyCheck - Leakage & Causality Scanner |",
|
|
313
315
|
"+======================================================================+",
|
|
314
|
-
f"
|
|
316
|
+
f" Report ID: {cert['certificate_id']}",
|
|
315
317
|
f" Audit Status: {status_symbol}",
|
|
316
318
|
f" Timestamp (UTC): {cert['timestamp_utc']}",
|
|
317
319
|
f" Git Commit SHA: {cert['git_commit']}",
|
|
@@ -325,9 +327,9 @@ def format_certificate_text(cert: Dict[str, Any]) -> str:
|
|
|
325
327
|
f" * Causal Mode Confounding (C001-C007): {cat_status if cert['invariants_verified']['causal_intervention_isolated'] else 'FAILED'}",
|
|
326
328
|
f" * Uncertainty Bounds Guard (U001-U006): {cat_status if cert['invariants_verified']['uncertainty_guards_present'] else 'FAILED'}",
|
|
327
329
|
"+----------------------------------------------------------------------+",
|
|
328
|
-
f" SHA-256
|
|
330
|
+
f" SHA-256 Audit Digest: {cert['sha256_digital_seal']}",
|
|
329
331
|
" Issued by: Neuron Labs - https://neuron-lab.org/pycheck",
|
|
330
|
-
"
|
|
332
|
+
" Compile-Time Guard: NEURON Language (https://neuron-lab.org)",
|
|
331
333
|
"+======================================================================+"
|
|
332
334
|
]
|
|
333
335
|
if cert.get("unscanned_local_imports"):
|
|
@@ -1537,13 +1537,27 @@ class C007_CorrWithoutForDecisions(Rule):
|
|
|
1537
1537
|
class U001_PredictNoUncertainty(Rule):
|
|
1538
1538
|
code = "U001"
|
|
1539
1539
|
name = "predict_no_uncertainty"
|
|
1540
|
-
severity = "
|
|
1540
|
+
severity = "info"
|
|
1541
1541
|
category = "UncertaintyIgnored"
|
|
1542
1542
|
|
|
1543
|
+
def _has_uncertainty_handling(self, ctx) -> bool:
|
|
1544
|
+
"""Check if uncertainty handling exists in the file (predict_proba, intervals, conformal, bootstrap)."""
|
|
1545
|
+
if ctx is None or not getattr(ctx, 'source_lines', None):
|
|
1546
|
+
return False
|
|
1547
|
+
src_text = "\n".join(ctx.source_lines).lower()
|
|
1548
|
+
uncertainty_markers = (
|
|
1549
|
+
'predict_proba', 'predict_std', 'predict_interval', 'conformal',
|
|
1550
|
+
'confidence_interval', 'prediction_interval', 'quantile', 'std',
|
|
1551
|
+
'scipy.stats', 'bootstrap', 'mapie', 'uncertainty'
|
|
1552
|
+
)
|
|
1553
|
+
return any(m in src_text for m in uncertainty_markers)
|
|
1554
|
+
|
|
1543
1555
|
def check_node(self, node, ctx):
|
|
1544
1556
|
if not isinstance(node, ast.Call):
|
|
1545
1557
|
return []
|
|
1546
1558
|
if isinstance(node.func, ast.Attribute) and node.func.attr == 'predict':
|
|
1559
|
+
if self._has_uncertainty_handling(ctx):
|
|
1560
|
+
return []
|
|
1547
1561
|
return [Diagnostic(
|
|
1548
1562
|
node.lineno, node.col_offset, self.severity, self.code,
|
|
1549
1563
|
"model.predict() returns point estimates without confidence scores",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pycheck-neuron
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.8
|
|
4
4
|
Summary: 34-rule static AST analyzer catching temporal lookahead bias, causal confusion, and uncertainty bugs in Python ML code. Zero dependencies.
|
|
5
5
|
Author: NEURON Team
|
|
6
6
|
Author-email: Fayo Ibrahim <fayo@neuron-lab.org>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pycheck-neuron"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.8"
|
|
8
8
|
description = "34-rule static AST analyzer catching temporal lookahead bias, causal confusion, and uncertainty bugs in Python ML code. Zero dependencies."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|