How bhuvansh855/pyrift works
PyRift is a Python static analyzer for compatibility and behavior differences across CPython versions and between CPython and PyPy. Its main workflow accepts a project or source string through the CLI or Python API, scans Python ASTs with compatibility rules, filters findings using project targets and compatibility guards, enriches findings with reviewed evidence metadata, and formats results for review. The graph also shows the shared AST-analysis layer and separate CPython/PyPy rule catalogs. Some subsystem links are based on the README or source-index references; unsampled implementation details are not inferred.
Main entry points: scanner.py AST scanner · cpy033_is_relative_to.py Path compatibility rule · base_rule.py Rule interface · finding.py Finding model
Components 18
Entry points
- CLI commands
pyrift/cli.py - Python API
pyrift/__init__.py
Scan engine
- AST scanner
pyrift/scanner.py - Target config
pyrift/targets.py - Compatibility guards
pyrift/analysis/guards.py - Import analysis
pyrift/analysis/imports.py - Symbol analysis
pyrift/analysis/symbols.py
Compatibility rules
- CPython rules
pyrift/rules/cpython - PyPy rules
pyrift/rules/pypy - Fork behavior rule
pyrift/rules/cpython/cpy023_multiprocessing_fork.py - Path compatibility rule
pyrift/rules/cpython/cpy033_is_relative_to.py - String behavior rule
pyrift/rules/pypy/ppy014_string_concat.py - Rule interface
pyrift/base_rule.py
Findings and output
- Finding model
pyrift/finding.py - Evidence metadata
pyrift/rule_metadata.py - Report formats
pyrift/reporter.py - GitHub annotations
pyrift/formatters/github.py
Other components
- Engineer / CI
Connections 23
- Engineer / CI → CLI commands: invokes
README.md - Engineer / CI → Python API: calls
README.md - CLI commands → AST scanner: starts scans
pyrift/cli.py - Python API → AST scanner: exposes scans
pyrift/__init__.py - CLI commands → Target config: configures targets
pyrift/cli.py - AST scanner → Target config: uses targets
pyrift/scanner.py - AST scanner → Compatibility guards: filters findings
pyrift/scanner.py - AST scanner → CPython rules: runs rules
pyrift/scanner.py - AST scanner → PyPy rules: runs rules
pyrift/scanner.py - AST scanner → Fork behavior rule: registers rule
pyrift/scanner.py - AST scanner → Path compatibility rule: registers rule
pyrift/scanner.py - AST scanner → String behavior rule: registers rule
pyrift/scanner.py - Fork behavior rule → Rule interface: implements
pyrift/rules/cpython/cpy023_multiprocessing_fork.py - Path compatibility rule → Rule interface: implements
pyrift/rules/cpython/cpy033_is_relative_to.py - String behavior rule → Rule interface: implements
pyrift/rules/pypy/ppy014_string_concat.py - Rule interface → Finding model: returns findings
pyrift/base_rule.py - Path compatibility rule → Import analysis: uses import analysis
pyrift/rules/cpython/cpy033_is_relative_to.py - Path compatibility rule → Symbol analysis: uses symbol analysis
- Finding model → Evidence metadata: enriches from
pyrift/finding.py - AST scanner → Report formats: returns scan result
pyrift/reporter.py - Report formats → Finding model: formats findings
pyrift/reporter.py - GitHub annotations → Finding model: formats findings
pyrift/formatters/github.py - GitHub annotations → AST scanner: accepts scan result
pyrift/formatters/github.py