pydocstyle icon indicating copy to clipboard operation
pydocstyle copied to clipboard

[FR] Support Cython

Open webknjaz opened this issue 5 years ago • 2 comments

Hi, it'd be great if this tool could enforce docstrings in Cython. Would it be hard to implement?

webknjaz avatar May 08 '20 21:05 webknjaz

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.

sambhav avatar May 08 '20 22:05 sambhav

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

webknjaz avatar May 08 '20 22:05 webknjaz