Auto Dependency Installer
Auto Dependency Installer is a Python package that automatically scans your project's source code for imported modules, detects which ones are missing in your environment, and installs them for you. It can create and use virtual environments to keep your dependencies isolated.
Installation
Install directly from PyPI:
pip install auto-dep-installer
Features
- Virtual Environment Support: Automatically create and activate virtual environments
- Automated Scanning: Recursively scans Python files for import statements
- Dependency Detection: Identifies which imported modules are missing
- Automatic Installation: Installs missing packages via pip
- Command-Line Interface: Simple and intuitive CLI
- Customizable Mappings: Support for custom module-to-package mappings
- Dependency Resolution: Attempts to resolve dependency conflicts when packages fail to install
- Cross-Platform Support: Works on Windows, macOS, and Linux
Quick Start
Basic Usage
To scan the current directory and install all dependencies in a new virtual environment:
auto-dep
This will:
- Create a virtual environment named
.venvin the current directory (if it doesn't exist) - Activate the virtual environment
- Scan for Python files and detect imports
- Install missing dependencies
Advanced Usage
Specify a custom virtual environment name:
auto-dep --venv my_project_env
Scan a specific directory:
auto-dep --directory ./path/to/project
Skip virtual environment creation:
auto-dep --no-venv
Use custom module-to-package mappings:
auto-dep --custom-mappings mappings.json
Enable verbose logging:
auto-dep --verbose
Attempt to resolve dependency issues:
auto-dep --resolve
Force reinstall packages even if they're already installed:
auto-dep --force-reinstall
Command-Line Options
usage: auto-dep [-h] [--directory DIRECTORY] [--venv VENV] [--no-venv]
[--custom-mappings CUSTOM_MAPPINGS] [--verbose] [--resolve]
[--force-reinstall] [--no-instructions]
Auto Dependency Installer
optional arguments:
-h, --help show this help message and exit
--directory DIRECTORY, -d DIRECTORY
Directory to scan for Python files (default: current directory)
--venv VENV, -v VENV Virtual environment name/path (default: .venv)
--no-venv Skip virtual environment creation/activation
--custom-mappings CUSTOM_MAPPINGS, -m CUSTOM_MAPPINGS
Path to JSON file with custom module-to-package mappings
--verbose Enable verbose output
--resolve Attempt to resolve dependency issues
--force-reinstall Force reinstall of packages even if they are already installed
--no-instructions Don't print activation instructions after installation
Custom Mappings
You can provide a JSON file with custom module-to-package mappings:
{
"custom_module": "custom-package-name",
"private_pkg": "company-private-package"
}
The tool already includes common mappings like:
bs4→beautifulsoup4PIL→pillowcv2→opencv-pythonsklearn→scikit-learn
Use Cases
- Quick Prototyping: Start coding without worrying about dependencies
- Project Setup: Quickly set up development environments
- Onboarding: Help new team members get your project running
- Legacy Projects: Easily identify and install dependencies for older projects
Known Limitations
- Only top-level imports are detected; dynamic or conditional imports might be missed
- The tool assumes module names match package names (except for known mappings)
- Standard library modules are excluded but some edge cases might exist
Contributing
Contributions are welcome! Feel free to:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
Auto Dependency Installer is dual-licensed under the MIT License and the Apache License 2.0. You may choose either license.
Metadata
Release files for auto-dep-installer 0.2
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 | |
|---|---|---|---|---|
| auto_dep_installer-0.2.tar.gz | 11.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auto_dep_installer-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.4 kB
Release files / auto_dep_installer-0.2.tar.gz
| Download URL | auto_dep_installer-0.2.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20ef159d436b09ff7c9bbbcacee006a182041549922b24f8e48cc97898d9fe8e
|
|
BLAKE2b-256 checksum How to use checksums |
f281e6242179d4fa3a8394dffe598caa6c47cef92af3ce14c284b8f105bc3259
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / auto_dep_installer-0.2-py3-none-any.whl
| Download URL | auto_dep_installer-0.2-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdc443ec1461598a3014fb7a9e34f0b42a53e321a03e2db01579c7a2ee995931
|
|
BLAKE2b-256 checksum How to use checksums |
ea5f3554a36285d41dc841a06d3bdcfcacfeecb3971b888c3fc3c6f5aaff90d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Security for auto-dep-installer 0.2
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.