pycheck-neuron 1.0.8__tar.gz → 1.1.1__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 (24) hide show
  1. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/PKG-INFO +66 -6
  2. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/README.md +381 -321
  3. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/__init__.py +2 -1
  4. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/audit.py +4 -2
  5. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/cli.py +29 -6
  6. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/flow.py +62 -19
  7. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/rules.py +442 -82
  8. pycheck_neuron-1.1.1/pycheck/sarif.py +123 -0
  9. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/PKG-INFO +66 -6
  10. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/SOURCES.txt +2 -0
  11. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pyproject.toml +4 -4
  12. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/tests/test_cli.py +79 -1
  13. pycheck_neuron-1.1.1/tests/test_regression.py +418 -0
  14. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/tests/test_rules.py +89 -5
  15. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/LICENSE +0 -0
  16. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/__main__.py +0 -0
  17. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/analyzer.py +0 -0
  18. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck/server.py +0 -0
  19. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/dependency_links.txt +0 -0
  20. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/entry_points.txt +0 -0
  21. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/requires.txt +0 -0
  22. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/top_level.txt +0 -0
  23. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/setup.cfg +0 -0
  24. {pycheck_neuron-1.0.8 → pycheck_neuron-1.1.1}/tests/test_audit.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycheck-neuron
3
- Version: 1.0.8
4
- Summary: 34-rule static AST analyzer catching temporal lookahead bias, causal confusion, and uncertainty bugs in Python ML code. Zero dependencies.
3
+ Version: 1.1.1
4
+ Summary: 37-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>
7
7
  License-Expression: MIT
@@ -9,7 +9,7 @@ Project-URL: Homepage, https://github.com/neuronlabs-ai/pycheck
9
9
  Project-URL: Documentation, https://github.com/neuronlabs-ai/pycheck#readme
10
10
  Project-URL: Repository, https://github.com/neuronlabs-ai/pycheck
11
11
  Project-URL: Bug Tracker, https://github.com/neuronlabs-ai/pycheck/issues
12
- Keywords: machine-learning,data-leakage,temporal-bias,lookahead-bias,backtesting,quantitative-finance,algorithmic-trading,linter,static-analysis,causal-inference,time-series,pandas,sklearn,scikit-learn,uncertainty,neuron,ml-safety,data-science,feature-engineering
12
+ Keywords: machine-learning,data-leakage,temporal-bias,lookahead-bias,backtesting,quantitative-finance,algorithmic-trading,linter,static-analysis,causal-inference,time-series,pandas,polars,sarif,github-actions,sklearn,scikit-learn,uncertainty,neuron,ml-safety,data-science,feature-engineering
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3.7
15
15
  Classifier: Programming Language :: Python :: 3.8
@@ -38,7 +38,7 @@ Dynamic: license-file
38
38
 
39
39
  # PyCheck — ML Safety Analyzer
40
40
 
41
- **34 rules. Zero dependencies. Catches the bugs that cost millions.**
41
+ **37 rules. Zero dependencies. Catches the bugs that cost millions.**
42
42
 
43
43
  PyCheck is a static AST analyzer that detects **temporal lookahead bias**, **causal confusion**, and **unguarded uncertainty** in Python ML and trading scripts — before you run a single line of code.
44
44
 
@@ -68,7 +68,7 @@ PyCheck catches all three before execution:
68
68
  =================================================================
69
69
  PyCheck — NEURON ML Safety Analyzer
70
70
  Scanning: strategy.py
71
- Rules: 34 active + Data Flow & Provenance Engine
71
+ Rules: 37 active + Data Flow & Provenance Engine
72
72
  =================================================================
73
73
 
74
74
  ERROR[T001]: .shift(-1) accesses data 1 rows INTO THE FUTURE
@@ -123,6 +123,9 @@ PyCheck catches all three before execution:
123
123
  | `T017` | Target laundering & un-split target encoding (`regime_success_rate`) | **Error** |
124
124
  | `T018` | In-sample target encoding via `.transform()` or un-split group means | **Error** |
125
125
  | `T019` | `np.roll(arr, -k)` — negative shift rotates future data into present position | **Error** |
126
+ | `T020` | `KFold(shuffle=True)` or `StratifiedKFold` on chronologically sorted series | **Error** |
127
+ | `T021` | `CalibratedClassifierCV` initialized without a temporal cross-validation splitter | Warning |
128
+ | `T022` | `cross_val_predict()` using shuffled cross-validation on temporal data | Warning |
126
129
 
127
130
  ### Causal Confusion Rules (7 rules — `C001`–`C007`)
128
131
 
@@ -190,7 +193,7 @@ pycheck script.py # Errors + warnings (default)
190
193
  pycheck script.py --info # Include info-level diagnostics
191
194
  pycheck script.py --quiet # Errors only
192
195
  pycheck script.py --json # JSON output — pipe into CI/CD
193
- pycheck --list # List all 34 rules
196
+ pycheck --list # List all 37 rules
194
197
  pycheck --help
195
198
  ```
196
199
 
@@ -286,6 +289,63 @@ GitLab will automatically annotate the Merge Request diff with red warnings on e
286
289
 
287
290
  ---
288
291
 
292
+ ## GitHub Code Scanning & SARIF Integration
293
+
294
+ PyCheck natively exports standard **SARIF v2.1.0** (Static Analysis Results Interchange Format) and GitHub Actions workflow commands, enabling turnkey integration into GitHub Code Scanning and PR annotations.
295
+
296
+ ```bash
297
+ # Export standard SARIF v2.1.0 for GitHub Code Scanning
298
+ pycheck . --sarif -o pycheck.sarif
299
+
300
+ # Emit GitHub Actions workflow annotations directly in CI logs
301
+ pycheck . --github-actions
302
+ ```
303
+
304
+ ### Turnkey `.github/workflows/pycheck.yml`
305
+
306
+ ```yaml
307
+ name: PyCheck ML Safety Guard
308
+
309
+ on: [push, pull_request]
310
+
311
+ jobs:
312
+ pycheck:
313
+ name: PyCheck Temporal Leak Scan
314
+ runs-on: ubuntu-latest
315
+ steps:
316
+ - uses: actions/checkout@v4
317
+
318
+ - name: Set up Python
319
+ uses: actions/setup-python@v5
320
+ with:
321
+ python-version: "3.11"
322
+
323
+ - name: Install PyCheck
324
+ run: pip install pycheck-neuron
325
+
326
+ - name: Run PyCheck
327
+ run: pycheck . --sarif -o pycheck.sarif
328
+
329
+ - name: Upload SARIF to GitHub Code Scanning
330
+ uses: github/codeql-action/upload-sarif@v3
331
+ if: always()
332
+ with:
333
+ sarif_file: pycheck.sarif
334
+ ```
335
+
336
+ ---
337
+
338
+ ## Polars First-Class Support
339
+
340
+ PyCheck v1.1.1 includes native AST detection and taint tracking for **Polars** pipelines:
341
+
342
+ - **Lookahead Fill**: Catches `pl.col().backward_fill()`, `.backward_fill()`, and `.fill_null(strategy="backward")` (`T007`).
343
+ - **Centered Windows**: Catches `rolling_mean(center=True)`, `rolling_std(center=True)`, `rolling_median(center=True)`, etc. (`T009`).
344
+ - **Event Merges**: Catches `.join_asof(strategy="forward")` and `.join_asof(strategy="nearest")` (`T016`).
345
+ - **Dataflow Taint Tracking**: Traces future-tainted Polars expressions into downstream feature matrices and `.fit()` sinks (`F001`).
346
+
347
+ ---
348
+
289
349
  ## Real-World Examples
290
350
 
291
351
  The `examples/` directory contains recreations of actual ML disasters: