Skip to main content

Python local package dependency discovery and resolution

Project description

🕵️ pydependance 🐍

Python local package dependency discovery and resolution

license pypi version

Contributions are welcome!


Table Of Contents


Overview

If multiple dependencies are listed in a project, only some of them may actually be required! This project finds those dependencies!

Why

This project was created for multiple reasons

  • Find missing dependencies
  • Generate optional dependencies lists, eg. for pyproject.toml
  • Create minimal dockerfiles with only the dependencies that are needed for a specific entrypoint

How This Works

  1. Specify root python packages to search through (we call this the namespace)
    • This can either be modules under a folder, similar to PYTHONPATH
    • Or actual paths to modules
  2. The AST of each python file is parsed, and import statements are found
  3. Finally, dependencies are resolved using breadth-first-search and flattened.
    • imports that redirect to modules within the current namespace are flattened and replaced with imports not in the namespace.

Install

pydependance currently requires python==3.10, however, it can still be run in a virtual environment over legacy python code

pip install pydependance

Usage

python -m pydependance --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydependance-0.1.0.tar.gz (10.6 kB view hashes)

Uploaded Source

Built Distribution

pydependance-0.1.0-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page