You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In pyproject.toml, you can configure the plugin behavior:
[tool.pdm.shear]
# Paths to include in the analysis (glob patterns)include = ["src/*.py", "tests/*.py"]
# Paths to exclude from the analysis (glob patterns)exclude = ["tests/fixtures/*.py"]
# Don't show missing dependencies warningsignore_missing_deps = true
How It Works
pdm-shear analyzes your Python source code to:
Find all import statements and their locations
Compare them against your declared dependencies
Identify dependencies that aren't used in your code
Optionally detect imports that don't map to any dependency
Note
We are currently unable to detect build dependencies (declared as requires in [build-system]). As a result, if files used during the build, such as pdm_build.py, are also scanned, it may report a missing dependencies error. The solution is to exclude these files using the include/exclude configuration.
License
MIT
About
Detect and remove unused dependencies for Python projects