A utility to analyze a Python project and its virtual environment to identify unused direct dependencies. Helps you keep your dependency list lean and accurate.
Project description
direct-deps
Table of Contents
Introduction
A utility to analyze a Python project and its virtual environment to identify direct dependencies. Helps you keep your dependency list lean and accurate.
The tool automatically detects common virtual environment setups including:
- Current activated virtual environment (
$VIRTUAL_ENV) - Local
.venvorvenvdirectories - Hatch environments
- Pipenv environments
Installation
Installation is optional! You can run direct-deps without installing it using uvx or pipx run.
# Optional: Install globally
pipx install direct-deps
Usage
Run without installation (Recommended)
The easiest way to use direct-deps is to run it directly without installation. The tool will automatically detect your project's virtual environment:
# Using uvx (uv's tool runner)
uvx direct-deps .
# Using pipx
pipx run direct-deps .
# Or analyze specific directories
uvx direct-deps src
uvx direct-deps tests
Recommendation
To split packages and dev-packages you can do the following.
# Sample Project Structure
├── pyproject.toml
├── src
│ └── comma-cli
│ └── ...
└── tests
└── ...
$ uvx direct-deps src
Direct Dependencies:
- persistent-cache-decorator
- requests
- rich
- setuptools-scm
- typedfzf
- typer
$ uvx direct-deps tests
Direct Dependencies:
- pytest
- runtool
- tomlkit
- typer
# So my [project.dependencies] would be:
[project]
dependencies = [
"persistent-cache-decorator",
"requests",
"rich",
"setuptools-scm",
"typedfzf",
"typer",
]
# And my [project.optional-dependencies.dev] would be (notice that since typer is a main dependency, there is no need to list it here):
[project.optional-dependencies]
dev = [
"pytest",
"runtool",
"tomlkit",
]
Limitations
This tool relies on being able to look at the import <package> and from <package> import ... as
well as use your virtualenv to find the appropriate package name. This means that anything
not imported directly will not appear in the list such as plugins (pytest-cov) and static analysis tools (ruff, pre-commit).
License
direct-deps is distributed under the terms of the MIT license.
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
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 direct_deps-0.0.3.tar.gz.
File metadata
- Download URL: direct_deps-0.0.3.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0757a8bb09fc2ee8b90a55a23135f3643a19a58b9d74f9774dce9bc154c7edd7
|
|
| MD5 |
14d5fe2a74bf40d4ddf492e4f1e13a71
|
|
| BLAKE2b-256 |
87661003fc0cda08f58236e9301da42ea07e68ce22c415afe47ba7eb3c1bc2d1
|
Provenance
The following attestation bundles were made for direct_deps-0.0.3.tar.gz:
Publisher:
main.yaml on FlavioAmurrioCS/direct-deps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
direct_deps-0.0.3.tar.gz -
Subject digest:
0757a8bb09fc2ee8b90a55a23135f3643a19a58b9d74f9774dce9bc154c7edd7 - Sigstore transparency entry: 342600332
- Sigstore integration time:
-
Permalink:
FlavioAmurrioCS/direct-deps@dff9d3bfe21ad89a4fe75ce6371a9fc88a3e52d3 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/FlavioAmurrioCS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@dff9d3bfe21ad89a4fe75ce6371a9fc88a3e52d3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file direct_deps-0.0.3-py3-none-any.whl.
File metadata
- Download URL: direct_deps-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af74751f822b8951e85496f4ce16c54b4a65f54b9dd89c625bbb00119f7e4f21
|
|
| MD5 |
809bac46a273e80dbb0c57b6c9689b3c
|
|
| BLAKE2b-256 |
c0dee6c19136e92f9ff117dbafc625be5de0e47be37018f43fd0c632656fd140
|
Provenance
The following attestation bundles were made for direct_deps-0.0.3-py3-none-any.whl:
Publisher:
main.yaml on FlavioAmurrioCS/direct-deps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
direct_deps-0.0.3-py3-none-any.whl -
Subject digest:
af74751f822b8951e85496f4ce16c54b4a65f54b9dd89c625bbb00119f7e4f21 - Sigstore transparency entry: 342600342
- Sigstore integration time:
-
Permalink:
FlavioAmurrioCS/direct-deps@dff9d3bfe21ad89a4fe75ce6371a9fc88a3e52d3 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/FlavioAmurrioCS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@dff9d3bfe21ad89a4fe75ce6371a9fc88a3e52d3 -
Trigger Event:
push
-
Statement type: