seddonym / import-linter

Import Linter allows you to define and enforce rules for the internal and external imports within your Python project.
https://import-linter.readthedocs.io/
BSD 2-Clause "Simplified" License
679 stars 49 forks source link

1.4 error: unexpected keyword argument 'verbose' #138

Closed Joerg-Tech closed 2 years ago

Joerg-Tech commented 2 years ago

Hello,

I've upgraded to import-linter 1.4. After the upgrade the import-linter shows the following error, when I call it without arguments:

=============
Import Linter
=============

ForbiddenRelativeImportContract.check() got an unexpected keyword argument 'verbose'

This is reproducible with import-linter 1.4. With 1.3 the problem is not there.

I use macOS Monterey (12.6) and poetry for managing the python dependencies.

Let me know, if you need more information.

Thanks, Joerg

seddonym commented 2 years ago

Thanks for the issue.

I assume this is because you're using a custom contract type, is that correct?

In Import Linter 1.4 the API has changed very slightly so that custom contract types receive a verbose argument to the check methods. See https://import-linter.readthedocs.io/en/stable/custom_contract_types.html#step-one-implementing-a-contract-class. If you add that (you don't need to do anything with it) then things should work as expected.

Apologies for the breaking change. To be honest, you are the first user I've encountered who actually uses custom contract types so I didn't put as much effort into backwards compatibility as I would otherwise have done. I've added a ticket here to help mitigate this in the future: https://github.com/seddonym/import-linter/issues/139

Let me know if that resolves your problem.

Joerg-Tech commented 2 years ago

Thanks a lot for your fast answer. You're right, we use custom contracts. I just fixed them according to your answer and they work fine with 1.4 now.

So now you know, that we use and appreciate custom contracts :-).

Thanks for you help!

seddonym commented 2 years ago

That's great to hear, thanks for raising!