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.txtfile - Parallel processing for faster scanning
⚠️ Note: The tool may occasionally fail to identify some dependencies due to complex import patterns or dynamic imports.
Installation 📦
pip install depscan
Usage 🚀
You can use depscan either as a module or directly as a command (like Black):
# 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:
depscan src/ --no-save # Don't generate requirements file
depscan src/ --workers 4 # Specify number of parallel workers
How it Works 🛠️
- Traverses Python files using Black's file discovery approach
- Uses AST parsing to safely extract imports
- Filters out standard library and project-internal imports
- Maps common import aliases to their correct PyPI package names
- Generates a clean requirements file
Output 📝
The tool will:
- Show all scanned files
- List discovered third-party dependencies
- Generate a
requirements.txtfile (orrequirements-depscan.txtif 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 📄
Metadata
Release files for depscan 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| depscan-0.1.5.tar.gz | 10.7 kB | Without provenance | Details for depscan-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| depscan-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for depscan-0.1.5-py3-none-any.whl |
Total release size: 20.9 kB
Release files / depscan-0.1.5.tar.gz
| Download URL | depscan-0.1.5.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f6aa66cbc72b2a7dd821b7dca4de2cec1147939f9a735a874c2c9bf52df76bf
|
|
BLAKE2b-256 checksum How to use checksums |
62f9e76e74a12249c2d4e2977658de6021b79a56ec9f357566ecec3cddd37c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.5
|
Release files / depscan-0.1.5-py3-none-any.whl
| Download URL | depscan-0.1.5-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b229d100c6c2d5893918627a4180beb3be785837b2b04b8729f24f63bc1ebc6
|
|
BLAKE2b-256 checksum How to use checksums |
e2f227ee71beb283551a1a6e86bc9bcc2fdc8cf1ae4d736ee5dbbd47fc4a9220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.5
|
Security for depscan 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.