deptry icon indicating copy to clipboard operation
deptry copied to clipboard

add support for dynamic dependencies with setuptools

Open lispandfound opened this issue 1 year ago • 6 comments

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 docs is 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?

lispandfound avatar Jun 06 '24 04:06 lispandfound

Will add tests and things later.

lispandfound avatar Jun 06 '24 04:06 lispandfound

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.

codecov[bot] avatar Jun 08 '24 07:06 codecov[bot]

Hey! Thanks for your contribution. I will check it out soon, I first need to sort out the bug in the CI/CD pipeline :)

fpgmaas avatar Jun 08 '24 15:06 fpgmaas

Could you please add a functional test? i.e.

fpgmaas avatar Jun 09 '24 08:06 fpgmaas

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.

fpgmaas avatar Jun 09 '24 08:06 fpgmaas

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.

fpgmaas avatar Jun 09 '24 12:06 fpgmaas