-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Missing __all__ in bidict/__init__.py leads to implicit reexport error with mypy in strict mode. #154
Comments
Hi @FlorianKoegler, thanks for opening this. I deliberately removed Line 53 in 2f0a387
I think mypy's Hope this helps clarify! |
pallets/click#1880 (comment) seems applicable here:
(substitute "bidict" in place of "click") See also pallets/click#1879 (comment) (by one of the mypy developers):
|
Note here, though, that the from typing import List
def generate_list() -> List[int]:
return [1] This module will provides both |
While I agree that the behavior without using |
What would be a better solution in your eyes, would you propose any? |
I am hoping someone more qualified - who’s studied, or even designed, module systems for several languages - will propose something. I know that there are other dynamic and gradually-typed languages whose designs avoided this problem from the start, but designing from scratch is a very different problem from improving an existing design. In any case, if you’re interested in discussing Python module design questions further, I encourage you to do so on the Python-Dev list or some other place with a wider and more appropriate audience than this closed issue. |
While I agree that |
If everyone always just accepted the one bad solution available, there would not be any pressure to create better solutions. Please try not to presume one size fits all especially when there are tradeoffs involved and especially for open source projects where the work is done voluntarily. Open source maintainers have the right to evaluate the tradeoffs associated with any particular new suggestion and make the right decision for their projects based on their circumstances. |
I gave up and did the “import foo as foo” dance in the latest release, out now: https://bidict.readthedocs.io/en/v0.22.0/changelog.html Hope this helps! |
Hi,
Pull request 107 has removed
__all__
frombidict/__init__.py
.This leads to implicit reexports of all the imported classes etc., which generates a error when typechecking with mypy in strict mode (which sets --no-implicit-reexport).
So for example with test.py...
... due to disallowing implicit reexports, the imports will not be found by mypy, while the code obviously works:
Was there some reasoning behind removing
__all__
or could it be re-added?Thanks in advance. :)
The text was updated successfully, but these errors were encountered: