Skip to main content

Deterministic, rule-based static analysis tool for Python.

Project description

Bina Static Analysis (بینا)

License CI Release Marketplace

Deterministic, explainable static analysis for Python — catch real logic bugs without flaky CI failures.
Bina provides deterministic, high-precision results by analyzing AST patterns without AI, heuristics, or probabilistic models. Designed for teams that require auditable and predictable CI gates.

💡 Bina is designed to be used alongside existing tools (linters, security scanners, tests), not replace them.


🌍 Real World Examples

Bina is designed to be high-precision and stable across major open-source projects.

FastAPI

Scanning the core FastAPI package reveals complex logic and potential improvements:

Local Scan Results

Bina running against FastAPI Locally

GitHub Action PR Report

Bina GitHub Action report for FastAPI

Requests

Running Bina against the popular Requests library confirms code quality and logical consistency:

Local Scan Results

Bina running against Requests Locally

GitHub Action PR Report

Bina GitHub Action report for Requests

🚀 Quick Start (GitHub Actions)

Add Bina to your repository in under 1 minute:

name: Bina Static Analysis
on: [pull_request, push]

jobs:
  bina-analysis:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      security-events: write
    steps:
      - uses: actions/checkout@v3
      - name: Run Bina Static Analysis
        uses: bonyad-labs/bina-review@v1
        with:
          path: .
          fail_on_high: true

🔍 What Bina Catches

  • Silent logical errors (always-true / always-false conditions)
  • Misleading boolean expressions
  • Dead or unreachable code paths
  • Incorrect exception handling patterns
  • Risky control-flow constructs

🤔 Why not just use linters or AI tools?

  • Linters focus on style, not logic
  • Security scanners focus on known vulnerabilities
  • AI tools are non-deterministic and hard to audit

Bina focuses on logical correctness and developer trust, making it ideal as a stable CI gate.

Who is this for?

Bina is ideal for:

  • Teams introducing static analysis gradually to large codebases.
  • Projects requiring strictly deterministic and reproducible results.
  • Organizations needing custom, logical rules for internal architectural standards.

Bina is NOT:

  • A replacement for broad security scanners or fuzzers.
  • An AI-based code reviewer.

🛡️ Core Principles

  • Deterministic & Auditable: Every finding maps to a specific AST pattern. Results are reproducible locally and in CI — no AI, no heuristics, no noise.
  • Zero Technical Debt Friction: Use Baseline Mode to ignore existing issues and focus only on new code changes. Adopt Bina gradually without rewriting your entire codebase.
  • Extensible API: Define organization-specific security or architectural rules in pure Python using our class-based API. If you can write Python, you can write Bina rules.
  • Enterprise Speed: Optimized AST-based analysis and multiprocessing ensure your CI/CD pipelines remain fast, regardless of project size.
  • GitHub Native: Built-in support for SARIF v2.1.0, enabling deep integration with the GitHub Security tab and inline PR annotations.

GitHub Action Inputs

All inputs are optional unless stated otherwise.

Input Description Default
path Path(s) to scan (space-separated for multiple paths). .
fail_on_high If true, the action fails if any HIGH severity issues are found. true
config_path Path to the bina.yaml configuration file. bina.yaml
baseline_path Path to the baseline report file. bina-report-baseline.json
token GitHub Token for posting PR comments. ${{ github.token }}

🛠 Local Usage

Run Bina on your local machine using the CLI:

# Install the tool
pip install bina-review

# Scan one or more directories/files
bina check src/ scripts/ utils.py

# Scan with a specific profile
bina check . --profile strict

📚 Documentation

👉 See the /docs directory for more details.

Stability & Versioning

Bina follows semantic versioning.

  • Minor versions may add new rules.
  • Patch versions never change existing rule behavior.

[!IMPORTANT] Production Ready: Bina is designed to be a stable CI gate. Rules are optimized for high precision to ensure that developers are never blocked by flaky or probabilistic findings.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Copyright © 2025-2026 Bonyad-Labs

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

bina_review-0.3.4.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bina_review-0.3.4-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file bina_review-0.3.4.tar.gz.

File metadata

  • Download URL: bina_review-0.3.4.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bina_review-0.3.4.tar.gz
Algorithm Hash digest
SHA256 a2ef2f086913703660806771db9181c377de1ee4aec9c9357c49c05834a4e838
MD5 29cfa9ec3fff6f54eacfe05e7d1c60bd
BLAKE2b-256 1d06ed70a9653e875470072f665e856c940a7fb244084fb3d57fc731c3969ac0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bina_review-0.3.4.tar.gz:

Publisher: publish.yml on Bonyad-Labs/bina-review

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bina_review-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: bina_review-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bina_review-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5613868ba6dccfa4824ff0b3cecde14162df08a4a3ff96e4cc7f87318a066a7d
MD5 47b6cbb9cb0cfa372ad8bf2f1f5540d3
BLAKE2b-256 4fe711d3bcfdf523472465ca4e30af52584697d7863593cdfc8b986fc099cf3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bina_review-0.3.4-py3-none-any.whl:

Publisher: publish.yml on Bonyad-Labs/bina-review

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page