Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

PyDepDetective

PyPI version License: MIT

Ever hated starting a new python project (or an existing one) and having to install dependencies one by one?

PyDepDetective is a Python tool that automatically detects and installs dependencies for a given Python file. It simplifies the process of setting up project dependencies by analyzing import statements, comments, and even references to requirements.txt files.

Features

  • Analyzes Python files to detect import statements
  • Identifies third-party imports by filtering out standard library modules
  • Detects pip install comments in the code
  • Recognizes references to requirements.txt files
  • Checks for already installed packages to avoid unnecessary reinstallation
  • Handles common package name mismatches (e.g., PIL for pillow)
  • Provides an interactive prompt to confirm installations
  • Supports installation from requirements.txt files

Installation

You can install PyDepDetective using pip:

pip install pydepdetective

Usage

After installation, you can run PyDepDetective from the command line:

pydepdetective path/to/your/file.py

The tool will analyze the file and prompt you to install any detected dependencies.

How It Works

  1. PyDepDetective parses the given Python file and extracts all import statements.
  2. It filters out standard library imports to identify third-party packages.
  3. The file content is also analyzed for # pip install comments and references to requirements.txt.
  4. The tool checks which packages are already installed in your environment.
  5. You are prompted to confirm the installation of detected dependencies.
  6. If confirmed, PyDepDetective uses pip to install the required packages.

Limitations (for now)

  • May not detect very complex dynamic imports or imports within deeply nested code.
  • The package name mapping is limited to common cases and may need expansion for less common packages.
  • Does not handle version specifications (e.g., package>=1.0.0).

Contributing

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

License

This project is open source and available under the MIT License.

Contact

If you have any questions or feedback, please open an issue on the GitHub repository.

Happy coding!

Metadata

Release files for pydepdetective 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydepdetective 0.1.1
File Size Uploaded Provenance
pydepdetective-0.1.1.tar.gz 4.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydepdetective 0.1.1
File Interpreter ABI Platform
pydepdetective-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / pydepdetective-0.1.1.tar.gz

Download URL pydepdetective-0.1.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cd5d4dd3ac2dc1436ef469e3db33c19f17c844b5888c946167722810f2295c59
BLAKE2b-256 checksum
How to use checksums
d8379c6cb8e0d2837d7ab41d5f119869a2e535739295bfe419db33648628d376
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / pydepdetective-0.1.1-py3-none-any.whl

Download URL pydepdetective-0.1.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3de4f7e7e99ca6f9607eaf11c2bc51912340e19c86b7cb9e92108f182ef0b9b0
BLAKE2b-256 checksum
How to use checksums
23a760351469d432c6484edce8a6af4c64889895ad6b2acb4ccce61646b9abfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Security for pydepdetective 0.1.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page