Skip to main content

Analyze and predict impacted Python modules from code changes using static dependency analysis.

Project description

Code Change Impact Analyzer

A Python package and CLI that predicts which Python modules are impacted when a file changes.

What it does

Given a changed file (for example auth/login.py), the analyzer:

  1. Parses project files.
  2. Detects function definitions.
  3. Builds import and call dependency graphs.
  4. Maps function usage across modules.
  5. Shows impacted modules.

Why engineers use it

  • Understand blast radius before merging changes.
  • Speed up code reviews in large codebases.
  • Decide where to add or run tests.

Installation

pip install code-change-impact-analyzer

For local development:

pip install -e .[dev]

CLI Usage

impact-analyzer --root . --changed auth/login.py

Options:

  • --root: project root directory to analyze (default: current directory)
  • --changed: changed file path relative to root (required)
  • --json: print JSON output

Example Output

Editing: auth/login.py
Impacted modules:
- api/routes.py
- user/service.py
- tests/test_login.py

How it works

The tool performs static analysis over Python source files:

  • Collects module imports (import x, from x import y)
  • Collects function definitions per module
  • Collects function calls per module
  • Builds reverse dependency graph to find modules depending on the changed module
  • Expands impact by function-level usage signals

Limitations

  • Dynamic imports and metaprogramming are not fully resolved.
  • Runtime dispatch and monkey patching are not modeled.
  • Best for conventional Python codebases.

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

code_change_impact_analyzer-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

code_change_impact_analyzer-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file code_change_impact_analyzer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for code_change_impact_analyzer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0671cbbdeb33bdb8487492ed5aa803cef25797d6ebba58c818521ec12f052b4b
MD5 8a66f562fa3dc5277d0a145910046510
BLAKE2b-256 3db07824b70fa12113ec613f841dbba1f42e0ff69686eb410125228a79d1ddcb

See more details on using hashes here.

File details

Details for the file code_change_impact_analyzer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_change_impact_analyzer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e07ea821dffdc709f0f52cf9c38a3d1c9eae93e4d84762593ad567e5eaabbd95
MD5 a074cacac2f37fa9084c2eaf8bfd464a
BLAKE2b-256 42704d2b0d0ec38df66fd5a47dc109ba8613ab6abe91fce63c0185209566d7d0

See more details on using hashes here.

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