pytransitions / transitions

A lightweight, object-oriented finite state machine implementation in Python with many extensions
MIT License
5.67k stars 529 forks source link

Explicitly reexport package names #620

Closed DrewDevereux closed 4 months ago

DrewDevereux commented 1 year ago

When in strict mode, mypy objects to imports from transitions with errors like

error: Module "transitions.extensions" does not explicitly export attribute "LockedMachine"; implicit reexport disabled  [attr-defined]

This occurs because the __init__.py files import names into the package namespace, but do not explicitly reexport them.

The fix is for __init__.py files to provide an explicit __all__.

Meanwhile, downstream packages can workaround this by adding to mypy.ini

[mypy-transitions]
implicit_reexport = True