CLI Reference
Basic Usage
depwhy is invoked as:
depwhy [SOURCE]
or
depwhy --env
SOURCE can be:
- A
requirements.txtfile - A
pyproject.tomlfile
Scanning a requirements.txt
$ depwhy requirements.txt2 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.18Alternative: Upgrade requests to >=2.29.0 (loosens urllib3 upper bound)→ pip install requests==2.29.0
Scanning a pyproject.toml
$ depwhy pyproject.toml1 conflict(s) foundnumpyProblem: scikit-learn==1.2.0 requires numpy>=1.22.4, but you have numpy==1.21.0 pinnedSolution: Upgrade numpy to satisfy scikit-learn's constraint→ pip install numpy==1.22.4Alternative: Downgrade scikit-learn to a version compatible with numpy==1.21.0→ pip install scikit-learn==1.1.3
Scanning a virtual environment
$ depwhy --env✓ No conflicts found
Exit Codes
| Code | Meaning | Example |
|------|---------|---------|
| 0 | No conflicts detected | depwhy clean-requirements.txt |
| 1 | At least one conflict found | depwhy conflicting-requirements.txt |
| 2 | Usage error or runtime error | depwhy nonexistent.txt |
Checking exit codes
$ depwhy requirements.txt --quiet; echo "Exit code: $?"Exit code: 1
$ depwhy clean-requirements.txt --quiet; echo "Exit code: $?"Exit code: 0
Error handling
Exit code 2 is returned for usage errors and runtime errors.
$ depwhy nonexistent.txtError: File not found: nonexistent.txt
$ depwhyError: Provide a SOURCE file or use --env.
Use --quiet in CI pipelines to suppress all output and rely solely on the exit code. This pairs well with shell conditionals like if depwhy requirements.txt --quiet; then ....