deptry
deptry copied to clipboard
add support for dynamic dependencies with setuptools
PR Checklist
- [x] A description of the changes is added to the description of this PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [x] If you've fixed a bug or added code that should be tested, add tests!
- [x] If you've added or modified a feature, documentation in
docsis updated
Description of changes
This pull request adds support for dependencies dynamically specified when using setuptools. This fixes #421. The changes should not affect users of setuptools that do not use dynamic dependencies, as in this case it will revert to the PEP621 compliant dependency checker.
Known issue: if the specified file to source dependencies from does not exist, this code will crash. @fpgmaas what is the best way to present this error to the user?
Will add tests and things later.
Codecov Report
Attention: Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.
Project coverage is 92.3%. Comparing base (
8a3b0bd) to head (d7e9263). Report is 150 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| python/deptry/dependency_getter/builder.py | 77.7% | 5 Missing and 1 partial :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #724 +/- ##
=======================================
- Coverage 92.8% 92.3% -0.5%
=======================================
Files 35 35
Lines 920 946 +26
Branches 165 168 +3
=======================================
+ Hits 854 874 +20
- Misses 52 57 +5
- Partials 14 15 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey! Thanks for your contribution. I will check it out soon, I first need to sort out the bug in the CI/CD pipeline :)
Could you please add a functional test? i.e.
- Add a directory with an example project structure in `tests/data'
- Add a corresponding test under `tests/functional/cli'
Looks like there were a few formatting issues; https://github.com/fpgmaas/deptry/actions/runs/9409803890/job/25970899533?pr=724. You can resolve this by installing the pre-commit hooks locally with poetry run pre-commit install.
Known issue: if the specified file to source dependencies from does not exist, this code will crash. @fpgmaas what is the best way to present this error to the user?
I think in this case, it would be best to catch the FileNotFoundError, display a logging message to the user and exit.