CLI Flags
Every flag available in the depwhy CLI, with examples and expected output.
--env
Scans packages installed in the current virtual environment rather than reading from a file.
$ depwhy --env✓ No conflicts found
Requires an active virtual environment. Activate one with source .venv/bin/activate before running.
--json
Outputs results as machine-readable JSON to stdout, making it easy to integrate depwhy into scripts and tooling.
$ depwhy requirements.txt --json
{
"has_conflicts": true,
"analyzed_packages": 6,
"conflicts": [
{
"package": "urllib3",
"problem": "requests==2.28.0 requires urllib3>=1.21.1,<1.27, but you have urllib3==2.0.0 pinned",
"solution": {
"description": "Remove your pin — use urllib3==1.26.18 (latest compatible)",
"pip_command": "pip install urllib3==1.26.18",
"is_alternative": false
},
"alternative": {
"description": "Upgrade requests to >=2.29.0 (loosens urllib3 upper bound)",
"pip_command": "pip install requests==2.29.0",
"is_alternative": true
}
}
],
"warnings": []
}--quiet
Suppresses all output. The result is communicated exclusively through the exit code.
$ depwhy requirements.txt --quiet$ echo $?1
--offline
Uses only cached metadata from previous runs. No network requests are made.
$ depwhy requirements.txt --offline2 conflict(s) found...
Requires a warm cache from a previous online run. If the cache is empty or stale, results may be incomplete.
--python-version
Overrides the Python version used when evaluating environment markers such as python_version < '3.11'. This lets you check for conflicts against a different Python version than the one you are currently running.
$ depwhy requirements.txt --python-version 3.11
For example, a dependency that specifies ; python_version < '3.11' will be included when you pass --python-version 3.10 but excluded when you pass --python-version 3.11.
--no-color
Disables Rich color output, producing plain text. Useful for piping output to files or tools that do not support ANSI escape codes.
$ depwhy requirements.txt --no-color2 conflict(s) foundurllib3Problem: requests==2.28.0 requires urllib3>=1.21.1,<1.27, but you have urllib3==2.0.0 pinnedSolution: Remove your pin — use urllib3==1.26.18 (latest compatible)→ pip install urllib3==1.26.18
--version
Prints the installed version of depwhy and exits.
$ depwhy --versiondepwhy 0.1.1
Flag Combinations
Several flags can be combined for common workflows:
--json --quiet— Returns only the exit code while still allowing JSON to be captured via redirection:depwhy req.txt --json --quiet > results.json--env --json— Scans the active virtual environment and outputs results as JSON, useful for automated environment audits.--offline --no-color— Runs a fast, cache-only check with plain text output, ideal for constrained environments without network access or terminal color support.
--env and SOURCE are mutually exclusive. Passing both will result in a usage error (exit code 2).