A Rust-powered checker for Python functions that violate functional-programming-oriented rules
Project description
fp-checker
fp-checker is a Rust-powered checker for Python codebases that reports functions which violate functional-programming-oriented rules. It provides both a CLI and a Python API, and can output results in text, JSON, or SARIF. In addition to built-in rules, you can add custom rules through configuration only.
English Summary
- What it does: checks Python functions for side effects, hidden mutation, non-determinism, deprecated APIs, and other patterns that make code less functional
- Interfaces: CLI and Python API
- Output formats:
text,json,sarif - Extensibility: built-in rules plus config-driven custom rules
- Package:
pip install fp-checker
Where To Start
- Feature overview: docs/features.md
- Rule reference: docs/rules.md
- CLI / Python API usage: docs/usage.md
- Configuration: docs/configuration.md
- Development setup: docs/development.md
- CI / security: docs/quality-and-security.md
日本語
Python コードを解析し、関数型プログラミングのルールに反した関数を検査する Rust 製ツールです。CLI と Python API の両方を提供し、結果は text / JSON / SARIF の各形式で出力できます。組み込みルールに加えて、設定ファイルだけで custom rule を追加できます。
どこを見れば何が分かるか
- 機能概要: docs/features.md
- ルール仕様: docs/rules.md
- CLI / Python API の使い方: docs/usage.md
- 設定ファイル仕様: docs/configuration.md
- 開発方法と Dev Container: docs/development.md
- CI / セキュリティ方針: docs/quality-and-security.md
現在の実装範囲
- Rust workspace:
fp_checker_core,fp_checker_cli,fp_checker_py - Python 構文解析:
rustpython-parserベースの adapter - ignore デコレータ:
@fp_ignoreを既定値としてサポート - MVP ルール:
- 可変グローバル状態
- 代入の多用
- 直接 I/O
- 非決定的呼び出し
- 外部状態への副作用
- ミュータブルなデフォルト引数
- 直接的な effectful call
global/nonlocal
- 追加ルール:
- hidden mutation
- loop 内副作用
- 例外制御フロー
- class method 内副作用
- 参照透過性を壊す暗黙依存
- 非推奨 API 使用
- 出力形式: text / JSON / SARIF
- AI 向けの structured
fix_hintを JSON に含める - CLI / Python API /
pyproject.toml設定対応 - 設定スキーマ: unknown key を reject する strict TOML
- config 駆動の custom rule:
call/name/attribute_write - CI 上の Python smoke test: 3.9 / 3.10 / 3.11 / 3.12
- JSON schema 検証:
tests/fixtures/report.schema.json - リリース自動化: tag push で GitHub Release と PyPI publish
- benchmark:
cargo bench -p fp_checker_core - pre-commit:
.pre-commit-config.yaml
クイックスタート
CLI
cargo run -p fp_checker_cli -- check tests/fixtures/sample_project
cargo run -p fp_checker_cli -- check tests/fixtures/sample_project --format json
cargo run -p fp_checker_cli -- check tests/fixtures/sample_project --format sarif
Python API
maturin develop --manifest-path crates/fp_checker_py/Cargo.toml
python3 -c "import fp_checker; print(fp_checker.available_rules())"
import fp_checker
print(fp_checker.check_code("def f(items=[]):\n return items", format="json"))
開発コマンド
cargo check
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test
リポジトリ構成
.
├── crates/
│ ├── fp_checker_cli/
│ ├── fp_checker_core/
│ └── fp_checker_py/
├── docs/
├── python/
│ └── examples/
├── tests/
│ └── fixtures/
├── .devcontainer/
├── .github/
│ ├── dependabot.yml
│ └── workflows/
├── Cargo.toml
├── pyproject.toml
├── CONTRIBUTING.md
├── SECURITY.md
└── CHANGELOG.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fp_checker-0.1.1.tar.gz.
File metadata
- Download URL: fp_checker-0.1.1.tar.gz
- Upload date:
- Size: 46.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ee07cdd3740c8e012a70fc327094771ee92a8d6eec19847031914e91bed4d2b
|
|
| MD5 |
7d26ae337ee682f5760b387d55f45dfb
|
|
| BLAKE2b-256 |
6d956a68a6571e469e7c1966927f3b402aeec82efbeab2ea589d5c08dca466ec
|
Provenance
The following attestation bundles were made for fp_checker-0.1.1.tar.gz:
Publisher:
release.yml on sotanengel/python-fp-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fp_checker-0.1.1.tar.gz -
Subject digest:
4ee07cdd3740c8e012a70fc327094771ee92a8d6eec19847031914e91bed4d2b - Sigstore transparency entry: 1154080310
- Sigstore integration time:
-
Permalink:
sotanengel/python-fp-checker@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sotanengel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fp_checker-0.1.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: fp_checker-0.1.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdb191ecbbc28e144e0fd039d2ac7261d5aaef86c691af3a09c65c61446c4bb2
|
|
| MD5 |
b7f48e72b235fc550476123dcd3d722a
|
|
| BLAKE2b-256 |
b881eb8dcf4cf5e844b6e68fe29a0dbaf6c741439dfcd8273cf18fbf7c273f83
|
Provenance
The following attestation bundles were made for fp_checker-0.1.1-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on sotanengel/python-fp-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fp_checker-0.1.1-cp39-abi3-win_amd64.whl -
Subject digest:
fdb191ecbbc28e144e0fd039d2ac7261d5aaef86c691af3a09c65c61446c4bb2 - Sigstore transparency entry: 1154080396
- Sigstore integration time:
-
Permalink:
sotanengel/python-fp-checker@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sotanengel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fp_checker-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fp_checker-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6be8f57a6e779b6c7096e96110dddb01394a07b11530cf55dad0382189c64989
|
|
| MD5 |
9c7378f203842867a777b94d12630f9b
|
|
| BLAKE2b-256 |
bd07b3cecb375010064e0dc9c83f6af1858367cf171cf20715aba04957cf4990
|
Provenance
The following attestation bundles were made for fp_checker-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on sotanengel/python-fp-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fp_checker-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
6be8f57a6e779b6c7096e96110dddb01394a07b11530cf55dad0382189c64989 - Sigstore transparency entry: 1154080575
- Sigstore integration time:
-
Permalink:
sotanengel/python-fp-checker@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sotanengel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fp_checker-0.1.1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fp_checker-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
146366495faeb6b24924d34ee56aac7a7ad5dc1a7d204c3b44472bee47f34c58
|
|
| MD5 |
60654defded15a83c102a203699d0395
|
|
| BLAKE2b-256 |
111e491f0105865c990b1dc62d25910a636ccebaa478b428ea3e5b1abc90f86c
|
Provenance
The following attestation bundles were made for fp_checker-0.1.1-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on sotanengel/python-fp-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fp_checker-0.1.1-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
146366495faeb6b24924d34ee56aac7a7ad5dc1a7d204c3b44472bee47f34c58 - Sigstore transparency entry: 1154080503
- Sigstore integration time:
-
Permalink:
sotanengel/python-fp-checker@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sotanengel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f05f40a32219f7fff7e657bd2ea63edda4f14353 -
Trigger Event:
push
-
Statement type: