pycheck-neuron 1.1.0__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.
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/PKG-INFO +62 -2
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/README.md +381 -321
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/__init__.py +2 -1
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/cli.py +29 -6
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/flow.py +30 -6
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/rules.py +30 -22
- pycheck_neuron-1.1.1/pycheck/sarif.py +123 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/PKG-INFO +62 -2
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/SOURCES.txt +1 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pyproject.toml +3 -3
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/tests/test_cli.py +78 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/tests/test_rules.py +73 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/LICENSE +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/__main__.py +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/analyzer.py +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/audit.py +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck/server.py +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/dependency_links.txt +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/entry_points.txt +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/requires.txt +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/pycheck_neuron.egg-info/top_level.txt +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/setup.cfg +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/tests/test_audit.py +0 -0
- {pycheck_neuron-1.1.0 → pycheck_neuron-1.1.1}/tests/test_regression.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pycheck-neuron
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
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>
|
|
@@ -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
|
|
@@ -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
|
|
|
@@ -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:
|