fpgmaas/deptry

chardet to (>=4.0.0)

AleksandrLiadov opened this issue · 2 comments

Hello,

Thanks for your package :)

Could you safely downgrade chardet to (>=4.0.0)?

Charte version is too recent in deptry, it makes impossible to install it to pyproject which has old packages ( from 2020 ).
Like gcloud-aio-auth.

Do you think it's possible?

That's a fair request, as that's also the case for other libraries that don't allow >=5.0.0.

Another option (or cumulative option) could be to make the dependency optional through extras, since most of the time, I believe that developers will not need the support for custom encoding.

Any thought on that @fpgmaas?

Indeed, chardet is used only when an UnicodeDecodeError is encountered while trying to parse the files, so although we do not have actual numbers, my expectation is that it's use is very limited.
So I think we can safely downgrade to >=4.0.0, given the release notes.

I think adding it to optional dependencies is not really necessary, but I am also not against it. However, if we do decide to do that it might be a good idea to raise a warning in import_parser.py to the user if an UnicodeDecodeError is encountered but chardet is not installed that notifies the user that they can improve their chance at successfully running deptry by installing it with the optional dependency.