Metadata-Version: 2.4
Name: depscan
Version: 0.1.4
Summary: A fast Python dependency analyzer that automatically discovers and extracts third-party imports
Project-URL: Homepage, https://github.com/linkedlist771/depscan
Project-URL: Repository, https://github.com/linkedlist771/depscan.git
Author-email: linkedlist771 <213193509seu@gmail.com>
License: MIT
License-File: LICENSE
Keywords: analyzer,dependency,imports,requirements
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
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 :: Python Modules
Requires-Python: >=3.7
Requires-Dist: typing
Description-Content-Type: text/markdown

# depscan 🔍

A Python dependency analyzer inspired by Black's implementation that automatically discovers and extracts third-party imports from your Python projects. It scans your codebase to identify external dependencies while filtering out project-internal imports.

## Features ✨

- Follows Black's approach to traverse Python files
- Smart package name resolution (e.g., `PIL` → `pillow`, `cv2` → `opencv-python`)
- Filters out both standard library and project-internal imports
- Handles common import name mismatches
- Generates `requirements.txt` file
- Parallel processing for faster scanning

⚠️ Note: The tool may occasionally fail to identify some dependencies due to complex import patterns or dynamic imports.

## Installation 📦

```bash
pip install depscan
```

## Usage 🚀

You can use depscan either as a module or directly as a command (like Black):

```bash
# As a command (recommended)
depscan src/
depscan .                    # Current directory
depscan src/ tests/         # Multiple paths

# As a module
python -m depscan src/
python -m depscan .
```

Options:

```bash
depscan src/ --no-save     # Don't generate requirements file
depscan src/ --workers 4   # Specify number of parallel workers
```

## How it Works 🛠️

1. Traverses Python files using Black's file discovery approach
2. Uses AST parsing to safely extract imports
3. Filters out standard library and project-internal imports
4. Maps common import aliases to their correct PyPI package names
5. Generates a clean requirements file

## Output 📝

The tool will:

1. Show all scanned files
2. List discovered third-party dependencies
3. Generate a `requirements.txt` file (or `requirements-depscan.txt` if the former exists)

## Known Limitations 🚧

- May not detect dependencies from dynamic imports
- Some complex import patterns might be missed
- Package name mapping might not cover all cases

## Contributing 🤝

Found a bug or want to improve the package name mapping? Contributions are welcome! Please feel free to submit a Pull Request.

## License 📄

[MIT](LICENSE)
