-
Notifications
You must be signed in to change notification settings - Fork 77
Description
It'd be very nice for cffi to include PEP 484 type hints in its compiled modules. This would allow Python code using (or further wrapping) CFFI-compiled modules to be statically checked against e.g. typos in function names, field names, enum names, type names (*), argument or return type mismatches, etc. This is also being requested in other automatic FFIs (swig/swig#735, PyO3/pyo3#2454).
If it's decided that CFFI will not support this and instead leave it to 3rd party projects, a proper introspection API should be added so that the generated interface can be examined programmatically (functions, signatures, structs, members..). Otherwise people end up relying on undocumented implementation details to get this working (LorenzoPeri17/cffi-stubgen#1) or basically reimplementing parts of CFFI and hoping the behavior is consistent with it.
(*): the current style of API, where the user passes a C-style syntax type as a string, wouldn't be very compatible with this... but a new API could easily be introduced to make full checking possible.