google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library
https://flatbuffers.dev/
Apache License 2.0
22.52k stars 3.19k forks source link

Missing type annotations in Python Library #8294

Open AlexMax opened 2 months ago

AlexMax commented 2 months ago

When I incorporate flatbuffers into a Python program that is typed, I get the following warning from mypy when I attempt to import flatbuffers:

Skipping analyzing "flatbuffers": module is installed, but missing library stubs or py.typed marker

I took a look at the library, and indeed, the library is not typed.

Is there any interest or plan to add type annotations to the Python library? Would a pull request that adds types to the library be acceptable? If so, what are the officially supported versions of Python, and would you prefer if the types were inline, or put in an external pyi file?

fliiiix commented 1 month ago

I haven't tried it yet but https://github.com/google/flatbuffers/commit/3b27f5396e84de2a131863ecdc96415af65d003b should add that.