Skip to content
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

When using dynamic with setuptools in pyproject.toml, deptry won't detect dependencies. #855

Closed
balihb opened this issue Sep 13, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@balihb
Copy link

balihb commented Sep 13, 2024

Environment

  • deptry version: 0.20.0
  • Python version: 3.11.9
  • Operating system (e.g. Ubuntu 22.04, Windows 11): Windows 11

Describe the issue

When using dynamic with setuptools in pyproject.tomll, deptry won't detect dependencies. Even if I explicitly define the requirements.txt explicitly.

deptry . --requirements-files requirements.txt --extend-exclude "somexclude"

No configuration for deptry was found in pyproject.toml.
Running with the following configuration:
root: (WindowsPath('.'),)
config: pyproject.toml
no_ansi: False
per_rule_ignores: {}
ignore: ()
exclude: ('venv', '\\.venv', '\\.direnv', 'tests', '\\.git', 'setup\\.py')
extend_exclude: ('someexclude',)
using_default_exclude: True
ignore_notebooks: False
requirements_files: ('requirements.txt',)
using_default_requirements_files: True
requirements_files_dev: ('dev-requirements.txt', 'requirements-dev.txt')
known_first_party: ()
json_output: None
package_module_name_map: {}
pep621_dev_dependency_groups: ()
experimental_namespace_package: False

pyproject.toml found!
pyproject.toml does not contain a [tool.poetry] section, so Poetry is not used to specify the project's dependencies.
pyproject.toml does not contain a [tool.pdm.dev-dependencies] section, so PDM is not used to specify the project's dependencies.
pyproject.toml does not contain a [tool.uv.dev-dependencies] section, so uv is not used to specify the project's dependencies.
pyproject.toml contains a [project] section, so PEP 621 is used to specify the project's dependencies.
Collecting Python files to scan...
...
some.py:1:8: DEP003 'click' imported but it is a transitive dependency

but click is clearly in the requirements.txt.

...
click~=8.1.6
...

In pyproject.toml:

[project]
...
dynamic = ["version", "dependencies", "optional-dependencies"]
...
[tool.setuptools.dynamic]
dependencies = { file = "requirements.txt" }
...

Minimal way to reproduce the issue

Have a project with dynamic dependencies.

Expected behavior

Detect or at least override where dependencies are coming from.

Additional context

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

@balihb balihb added the bug Something isn't working label Sep 13, 2024
@mkniewallner
Copy link
Collaborator

It looks this is the same issue as #421.

@balihb
Copy link
Author

balihb commented Sep 13, 2024

it is. sorry I haven't found it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants