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

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

Open
jlopezpena opened this issue Feb 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jlopezpena
Copy link

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
@jlopezpena jlopezpena added the bug Something isn't working label Feb 5, 2024
@fpgmaas
Copy link
Owner

fpgmaas commented Feb 6, 2024

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.

@fpgmaas fpgmaas changed the title Bug Summary Exclusions listed with extend-exclude in pyproject.toml get overwritten by passing --extend-exclude Mar 21, 2024
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