pydocstyle
pydocstyle copied to clipboard
[FR] Support Cython
Hi, it'd be great if this tool could enforce docstrings in Cython. Would it be hard to implement?
Not sure - but it isn't straightfoward afaict - it would involve updating https://github.com/PyCQA/pydocstyle/blob/master/src/pydocstyle/parser.py to support cython. Currently we heavily rely on the tokenize module to parse files, we also use the ast module for complex use cases around google/numpy styles. Unless cython has something equivalent, it will require a bit of research and implementing/using some library that can parse cython source code per our needs.
Right... It'd probably require integrating something like https://github.com/cython/cython/tree/master/Cython/Plex
Also: https://github.com/cython/cython/blob/master/Cython/Compiler/Parsing.py
Looks like there's some private helpers for extracting docstrings @ https://github.com/cython/cython/blob/3bba77a2bf9ed7da4c118fd7887658c597e14cd2/Cython/Compiler/Parsing.py#L3627