Python local package dependency discovery and resolution
Project description
🕵️ pydependance 🐍
Python local package dependency discovery and resolution
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
- 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
- The AST of each python file is parsed, and import statements are found
- 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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for pydependance-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee77d6f98786f8018f21462a9acb6a04ead502b7dfc742ec4d9928be4ba52ea0 |
|
MD5 | 549ab211ef122b0e126f6cb0f442e5f8 |
|
BLAKE2b-256 | 2a7b289530a70bb93ee0ace0c2541360b9b12d8c73a0d14e92d4affc5b1d3309 |