fpgmaas / deptry

Find unused, missing and transitive dependencies in a Python project.

Home Page:https://deptry.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclusions listed with `extend-exclude` in `pyproject.toml` get overwritten by passing `--extend-exclude`

jlopezpena opened this issue · comments

Describe the bug

Exclusions listed with extend-exclude in pyproject.toml get overwritten by passing --extend-exclude to the command line

To Reproduce

Steps to reproduce the behavior:

  1. Add a list of exclusions in the [tool.deptry] extend-exclude: ... section of a project using pyproject.toml
  2. Call deptry from the command line adding a parameter --extend-exclude ... with a different list of exclusions
  3. deptry will check locations listed as excluded in pyproject.toml

Expected behavior

The parameter name "EXTEND" exclude suggests that additional exclusions passed in the command line would be appended to whatever is listed in the project file, not overwrite them. This results in very anti-intuitive behaviour.

If this is intended (as for other parameters it makes sense to overwrite the project setting by command line settings if explicitly requested), then at least a warning should be shown in the command line mentioning that the rules set in the project file are being overridden.

System [please complete the following information]:

  • OS: e.g. Ubuntu 23.10 running on Docker in an M1 Mac
  • Language Version: Python 3.11
  • Poetry version: Poetry 2

Thanks for raising the issue. This is indeed intended behavior, as explained in the documentation, see this section specifically. I agree that it can be perceived as counter intuitive for a parameter that has the word 'extend' in it's name.

On the other hand, it can also be perceived as counterintuitive that the behavior for some parameters is different than for others. Someone might try to overwrite the configuration from pyproject.toml through the CLI argument, and then unexpectedly find that the lists are concatenated.

We could choose to add some logging statements in this file when parameters are overwritten.