Open lmmx opened 1 year ago
Thanks for the report and the offer to help. Yes, mypy checks are run as part of the test suite (via pytest-mypy). Simply run tox
and it will execute the test suite including any mypy checks. Run tox -- -k mypy
to run only the mypy tests. I just ran them and they are in fact failing in main, so probably the failing tests need to be addressed first.
I assume there are plans to fix this issue . Is there an eta?
No ETA. I welcome anyone to address it. I'm actively working on getting the test suite passing again.
Describe the bug
I am attempting to contribute an implementation using this library to a type checked project and mypy is failing the PR.
I think the cause of the failure is that the backend returned from
keyring.get_keyring()
is typed as the wrong class. It's being cast tokeyring.backend.Backend
but it is in fact a subclass.https://github.com/jaraco/keyring/blob/af7233958ece36da8d493509a6388484f5534dfc/keyring/core.py#L30-L34
Type checkers reject this incorrect casting whenever a method is used that's unique to a subclass, such as
get_preferred_collection()
which exists onkeyring.backends.SecretService.Keyring
but notkeyring.backend.KeyringBackend
.due to this code at line 666 :imp: :
and further on at 676:
It looks tricky but maybe I can help make some progress on these type annotations, maybe the cast helps identify a place to start?
I can't figure out if there is already a mypy workflow in use in this project (is
pytest-mypy
called somewhere?)