Metadata-Version: 2.4
Name: depcleaner
Version: 1.0.0
Summary: Detect and remove unused Python dependencies
Author-email: DepCleaner Team <team@depcleaner.dev>
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
Dynamic: license-file

# DepCleaner

A powerful Python dependency cleanup tool that detects and removes unused imports and packages.

## Features

- Detects unused imports in Python source files
- Identifies unused packages in requirements.txt and pyproject.toml
- Static analysis using AST parsing
- Safe mode (preview) and auto-fix mode
- Recursive directory scanning
- CLI and Python API
- Automatic backups before modifications
- Type hints and comprehensive logging

## Installation

pip install depcleaner

## CLI Usage

### Scan for unused dependencies

depcleaner scan

### Scan specific directory

depcleaner scan --path ./src

### Fix unused dependencies

depcleaner fix

### Fix without backup

depcleaner fix --no-backup

### Preview changes (dry run)

depcleaner fix --dry-run

### Verbose output

depcleaner -v scan

## Python API

from depcleaner import DepCleaner

# Initialize
cleaner = DepCleaner(project_path=".")

# Scan for issues
report = cleaner.scan()
print(report)

# Get unused imports per file
unused_imports = report.get_unused_imports()

# Get unused packages
unused_packages = report.get_unused_packages()

# Auto-fix with backup
stats = cleaner.fix(backup=True)
print(f"Modified {stats['files_modified']} files")
print(f"Removed {stats['imports_removed']} imports")

## Development

### Running tests

pytest tests/

### Running with coverage

pytest --cov=depcleaner tests/

## License

MIT License - see LICENSE file for details.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
