hakancelikdev/unimport

pyproject.toml usage doesn't work

Closed this issue · 6 comments

I use the following commands and files

unimport foo --config pyproject.toml 
[tool.unimport]
exclude = "foo/_whatever"
remove = true

However, unused imports are not removed and paths I configured are not excluded. I guess this is related to
config = config.merge(**vars(args)), because the default config has already values for exclude and remove and these overwrite my configured ones.

What is the path of the pyproject.toml config file?

The --config parameter takes a path. https://unimport.hakancelik.dev/#config

Are you sure you gave the path?

I executed it in the main directory where the pyproject.toml is stored. I also set a breakpoint and could see that the TOML is loaded

Okey, seem like a bug, I will work on it.

I can confirm that we are facing the same issue. We needed to add an explicit --exclude flag to our CLI command, because an exclude param is not taken from the pyproject.toml file.

Thank you for reporting the issue, I would be very happy if you could test it with the final version.

Thanks, works fine