A simple tool to see where your dependencies are imported
Project description
dep-appearances
A simple tool to see where your dependencies are imported. The dep-appearances
CLI produces a report of which files import each of your dependencies. At this
time, the CLI only works for projects that use
pipenv, but support for any dependency
management tool could be added.
Requirements
- Python 3
How to Use dep-appearances
You can install dep-appearances via pip:
pip install dep-appearances
Installing the package provides a CLI:
dep-appearances --help
usage: dep-appearances [-h] [--underused_threshold UNDERUSED_THRESHOLD] [PATH]
Find dependencies that are unused and underused in your codebase.
positional arguments:
PATH The path to your project's root (defaults to your
current working directory)
optional arguments:
-h, --help show this help message and exit
--underused_threshold UNDERUSED_THRESHOLD
The threshold to set for marking dependencies as
underused (default: 2)
From the root of your project (i.e. wherever your Pipfile is) you can run
dep-appearances and you will get a report of dependencies that don't appear to
imported and a report of dependencies that my not be imported in very many
places.
> dep-appearances
Unused dependencies:
build
pytest
twine
Underused dependencies (usage threshold = 2):
pipfile
imported in:
src/dep_appearances/appearances_report.py:3
Known Shortcomings
There are, unfortunately, packages that have a different name when importing
them than when installing them. For example, the apache-airflow package shows
up in a Pipfile as apache-airflow, but when it is used in a codebase you use
import airflow
dep-appearances currently does not account for such cases. Therefore
you should not remove dependencies from your codebase without confirming that
packages are unused.
How to contribute to dep-appearances
Pull requests are definitely welcome. Just fork this repo and open a PR
against the main branch.
Useful Development Commands
Install dependencies
pipenv install
Install and use the package locally (to work on the CLI):
pipenv run pip install -e .
pipenv run dep-appearances
Running tests:
pipenv run pytest
Release Process
# Generate distribution archives:
python3 -m build
# => Should create files in dist/
# Push to pypi
python3 -m twine upload dist/*
Building for test.pypi
python3 -m build
python3 -m twine upload --repository testpypi dist/*
Install from test.pypi:
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps dep-appearances
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dep-appearances-0.0.2.tar.gz.
File metadata
- Download URL: dep-appearances-0.0.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c661153ba0b099fa67805524b177a0bf43ecfc02348b4222073cbd5005b2dee2
|
|
| MD5 |
847920c8ff22ec965829d35d5646216f
|
|
| BLAKE2b-256 |
7f2f505ee253722e31ba7fe0571e7aa223b1cf357fcd9dad674edf6a8f07de49
|
File details
Details for the file dep_appearances-0.0.2-py3-none-any.whl.
File metadata
- Download URL: dep_appearances-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4224a18000b9a442d906a95ffbb6b0e3e2dd2b1196b9c468455ce7c075b2f1fc
|
|
| MD5 |
a0b122403e688f57ec4c78c55de305f0
|
|
| BLAKE2b-256 |
b0bc012eca47f0627968a722c2ec4f47188795b39fe523977d33faf6b07e2add
|