I am normally define the interface to models while defining __all__.
Defined in the __init__ it allows to define a whitelist what can be Imported from the outside.
https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
I am normally define the interface to models while defining __all__.
Defined in the __init__ it allows to define a whitelist what can be Imported from the outside.
https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
@fixmycode mypy type checking can report this error in your code:
iox3.py:3: error: Module "iox2" does not explicitly export attribute "y" [attr-defined]
which I think is roughly the problem you are encountering: an attribute in an imported module that wasn't explicitly defined in that module, but instead came from somewhere else.
I think this is the more sensitive approach, I'll take a look at putting mypy in my pipeline