pycheck-neuron 1.1.1__tar.gz → 1.2.0__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 (26) hide show
  1. {pycheck_neuron-1.1.1/pycheck_neuron.egg-info → pycheck_neuron-1.2.0}/PKG-INFO +31 -68
  2. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/README.md +344 -381
  3. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/__init__.py +1 -2
  4. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/analyzer.py +12 -4
  5. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/cli.py +75 -33
  6. pycheck_neuron-1.2.0/pycheck/config.py +132 -0
  7. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/flow.py +41 -31
  8. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/rules.py +108 -44
  9. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0/pycheck_neuron.egg-info}/PKG-INFO +31 -68
  10. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck_neuron.egg-info/SOURCES.txt +2 -1
  11. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck_neuron.egg-info/requires.txt +3 -0
  12. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pyproject.toml +10 -9
  13. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/tests/test_cli.py +0 -78
  14. pycheck_neuron-1.2.0/tests/test_config.py +98 -0
  15. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/tests/test_rules.py +77 -44
  16. pycheck_neuron-1.1.1/pycheck/sarif.py +0 -123
  17. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/LICENSE +0 -0
  18. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/__main__.py +0 -0
  19. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/audit.py +0 -0
  20. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck/server.py +0 -0
  21. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck_neuron.egg-info/dependency_links.txt +0 -0
  22. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck_neuron.egg-info/entry_points.txt +0 -0
  23. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/pycheck_neuron.egg-info/top_level.txt +0 -0
  24. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/setup.cfg +0 -0
  25. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/tests/test_audit.py +0 -0
  26. {pycheck_neuron-1.1.1 → pycheck_neuron-1.2.0}/tests/test_regression.py +0 -0
@@ -1,22 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycheck-neuron
3
- Version: 1.1.1
3
+ Version: 1.2.0
4
4
  Summary: 37-rule static AST analyzer catching temporal lookahead bias, causal confusion, and uncertainty bugs in Python ML code. Zero dependencies.
5
- Author: NEURON Team
6
- Author-email: Fayo Ibrahim <fayo@neuron-lab.org>
7
- License-Expression: MIT
5
+ Author-email: Fayo Ibrahim <contact@neuron-lab.org>
6
+ License: MIT
8
7
  Project-URL: Homepage, https://github.com/neuronlabs-ai/pycheck
9
8
  Project-URL: Documentation, https://github.com/neuronlabs-ai/pycheck#readme
10
9
  Project-URL: Repository, https://github.com/neuronlabs-ai/pycheck
11
10
  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,polars,sarif,github-actions,sklearn,scikit-learn,uncertainty,neuron,ml-safety,data-science,feature-engineering
11
+ 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
13
12
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.7
15
- Classifier: Programming Language :: Python :: 3.8
16
13
  Classifier: Programming Language :: Python :: 3.9
17
14
  Classifier: Programming Language :: Python :: 3.10
18
15
  Classifier: Programming Language :: Python :: 3.11
19
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
20
18
  Classifier: Operating System :: OS Independent
21
19
  Classifier: Topic :: Software Development :: Quality Assurance
22
20
  Classifier: Topic :: Software Development :: Testing
@@ -27,9 +25,11 @@ Classifier: Intended Audience :: Financial and Insurance Industry
27
25
  Classifier: Intended Audience :: Developers
28
26
  Classifier: Development Status :: 5 - Production/Stable
29
27
  Classifier: Environment :: Console
30
- Requires-Python: >=3.7
28
+ Requires-Python: >=3.9
31
29
  Description-Content-Type: text/markdown
32
30
  License-File: LICENSE
31
+ Provides-Extra: test
32
+ Requires-Dist: pytest>=7.0; extra == "test"
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: pytest>=7.0; extra == "dev"
35
35
  Requires-Dist: build; extra == "dev"
@@ -123,9 +123,6 @@ 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 |
129
126
 
130
127
  ### Causal Confusion Rules (7 rules — `C001`–`C007`)
131
128
 
@@ -241,6 +238,29 @@ Returns structured output for automated pipelines:
241
238
  ]
242
239
  ```
243
240
 
241
+ ### Project Configuration (`pyproject.toml` or `.pycheck.toml`)
242
+
243
+ PyCheck automatically detects and respects project-level configuration in `pyproject.toml` or `.pycheck.toml`:
244
+
245
+ ```toml
246
+ [tool.pycheck]
247
+ ignore = ["C001", "U002"]
248
+ exclude = ["tests", "legacy"]
249
+ info = false
250
+ quiet = false
251
+ ```
252
+
253
+ Or override dynamically via CLI flags:
254
+ ```bash
255
+ pycheck . --ignore C001,U002 --select T001,T010 -c pyproject.toml
256
+ ```
257
+
258
+ ### Modern Quant Stack Support (Polars, PyTorch, JAX)
259
+
260
+ PyCheck natively guards both Pandas and modern high-performance quantitative computing pipelines:
261
+ - **Polars Expression Engine**: Detects lookaheads in `pl.col("close").shift(n=-1)`, `pct_change(n=-1)`, `diff(n=-1)`, `backward_fill()`, `fill_null(strategy="backward")`, `rolling_mean(center=True)`, and `join_asof(strategy="forward" | "nearest")`.
262
+ - **Deep Learning Time Series**: Detects future tensor index rotation via `torch.roll(tensor, shifts=-N)` and `jnp.roll(arr, -N)`.
263
+
244
264
  ### Exit Codes
245
265
 
246
266
  - `0` — Verified clean / no errors found
@@ -289,63 +309,6 @@ GitLab will automatically annotate the Merge Request diff with red warnings on e
289
309
 
290
310
  ---
291
311
 
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
-
349
312
  ## Real-World Examples
350
313
 
351
314
  The `examples/` directory contains recreations of actual ML disasters: