Metadata-Version: 2.4
Name: code-change-impact-analyzer
Version: 0.1.0
Summary: Analyze and predict impacted Python modules from code changes using static dependency analysis.
Project-URL: PyPI, https://pypi.org/project/code-change-impact-analyzer/
Author-email: Vidhi Bhutia <vidhibhutia2407@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: cli,dependency-graph,impact-analysis,python,static-analysis
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.9
Provides-Extra: dev
Requires-Dist: mypy>=1.11.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest>=8.3.0; extra == 'dev'
Requires-Dist: ruff>=0.12.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install code-change-impact-analyzer
```

For local development:

```bash
pip install -e .[dev]
```

## CLI Usage

```bash
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

```text
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.
