kplindegaard / smbus2

A drop-in replacement for smbus-cffi/smbus-python in pure Python
MIT License
243 stars 68 forks source link

Add a typing stub to smbus2 #41

Closed MageJohn closed 4 years ago

MageJohn commented 4 years ago

I'm using Python 3 type hinting and mypy static type analysis in my project using smbus2, so I created a type stub for smbus2. This may be useful for other people, so here's a pull request.

For more info see the mypy docs and PEP 561.

Links:

kplindegaard commented 4 years ago

Thanks, @MageJohn I haven't used mypy myself, so I need to ask a novice question: We're not introducing any backwards compatibility issues with this? These are all supplementary stubs and meta that won't introduce problems in Python 2.7 or <3.5?

MageJohn commented 4 years ago

That's right; only the software that will be doing the type checking will look for the .pyi file, as far as I know. Even in versions of python >= 3.5 it doesn't have an effect at runtime, just when mypy is run.

On Sat, Aug 22, 2020 at 1:01 PM Karl-Petter Lindegaard < notifications@github.com> wrote:

Thanks, @MageJohn https://github.com/MageJohn I haven't used mypy myself, so I need to ask a novice question: We're not introducing any backwards compatibility issues with this? These are all supplementary stubs and meta that won't introduce problems in Python 2.7 or <3.5?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kplindegaard/smbus2/pull/41#issuecomment-678632017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA23QLULD425XUCOF6WMVMLSB6XQJANCNFSM4JZIPHSA .