This repository has been archived by the owner on Nov 21, 2020. It is now read-only.
Type annotations issues with documentation #11
Labels
blocked
Not our fault that this cannot be done (yet)
documentation
Improvements or additions to documentation
There are two separate issues with the type hinting in the documentation at the moment (either generated by Python's
help
or Sphinx):query_extension(str name: str) -> bool
Until these get fixed upstream, there should be work-arounds (especially for number 2, whose fix is unlikely to be backported to, say, Python 3.6 which we want to support).
If time allows, we can try to patch the first one upstream. Cython codebase is huge to study but it is not impossible.
Edit: To elaborate, the first one is caused by the signature generated by Cython when
embedsignatures
compiler directive is set toTrue
, which add prepend each docstring with the function's signature (which is otherwise missing due to, welp, that's common for extension types). To work around this, we can simply turn off this directive and add the signature manually, which I find ugly but not too ugly. Another choice is to setbinding=True
, but currently it wraps types in single quotes, e.g.query_extension(name: 'str') -> 'bool'
.I have yet to find the issue documenting that bug, maybe it's time to file the issue on Cython.As described in PEP 563,query_extension(name: 'str') -> 'bool'
is totally an excepted behavior.The text was updated successfully, but these errors were encountered: