-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for dynamic dependencies with setuptools #724
Conversation
Will add tests and things later. |
Codecov ReportAttention: Patch coverage is
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 ☔ View full report in Codecov by Sentry. |
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.
|
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 |
I think in this case, it would be best to catch the |
) | ||
|
||
raise DependencySpecificationNotFoundError(self.requirements_files) | ||
|
||
def _project_uses_setuptools(self, pyproject_toml: dict[str, Any]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _project_uses_setuptools(self, pyproject_toml: dict[str, Any]) -> bool: | |
@staticmethod | |
def _project_uses_setuptools(pyproject_toml: dict[str, Any]) -> bool: |
) | ||
return False | ||
|
||
def _project_uses_dynamic_dependencies(self, pyproject_toml: dict[str, Any]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _project_uses_dynamic_dependencies(self, pyproject_toml: dict[str, Any]) -> bool: | |
@staticmethod | |
def _project_uses_dynamic_dependencies(pyproject_toml: dict[str, Any]) -> bool: |
) | ||
return False | ||
|
||
def _project_dynamic_requirements_file(self, pyproject_toml: dict[str, Any]) -> tuple[str, ...]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _project_dynamic_requirements_file(self, pyproject_toml: dict[str, Any]) -> tuple[str, ...]: | |
@staticmethod | |
def _project_dynamic_requirements_file(pyproject_toml: dict[str, Any]) -> tuple[str, ...]: |
) | ||
|
||
raise DependencySpecificationNotFoundError(self.requirements_files) | ||
|
||
def _project_uses_setuptools(self, pyproject_toml: dict[str, Any]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move the 3 new methods between _project_uses_pdm
and _project_uses_pep_621
? That way we use the same order as the order methods are called from build
method.
) | ||
return False | ||
|
||
def _project_dynamic_requirements_file(self, pyproject_toml: dict[str, Any]) -> tuple[str, ...]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can remove this method and make _project_uses_dynamic_dependencies
return a tuple[bool, tuple[str, ...]]
, like
def _project_uses_requirements_files(self) -> tuple[bool, tuple[str, ...]]: |
3. a `[tool.setuptools.dynamic]` section containing `dependencies = { file = [some_requirements_file] }`, | ||
|
||
then _deptry_ will assume the project uses setuptools with dynamic dependencies. It will extract dependencies | ||
from the file specified in the `[tool.setuptools.dynamic]` section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the file specified in the `[tool.setuptools.dynamic]` section. | |
from the files specified in the `[tool.setuptools.dynamic]` section. |
since this could be a list of files?
PR Checklist
docs
is updatedDescription 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?