3 ms·
Tangential, but do any python users have a tool they like for testing that fully-formed doc comments (e.g. Google or numpy style) are correct, meaning the arg n
by claytonjy 4y ago
Tangential, but do any python users have a tool they like for testing that fully-formed doc comments (e.g. Google or numpy style) are correct, meaning the arg names and types reflect the function signature?
Pydocstyle, pylint, and ruff will all check for some amount of presence and format, but if a type is wrong or an arg missing, you're on your own, AFAICT.
I found pydoctest¹, but it looks somewhat unmaintained, and bugs like "doesn't work with relative imports" makes me hesitant to use it.
¹https://github.com/jepperaskdk/pydoctest https://github.com/jepperaskdk/pydoctest
- charliermarsh 4y agoI've never used, but have heard good things about darglint (although it's now archived): https://github.com/terrencepreilly/darglint https://github.com/terrencepreilly/darglint A lot of folks want us to add that kind of enforcement to Ruff (https://github.com/charliermarsh/ruff/issues/458 https://github.com/charliermarsh/ruff/issues/458), and I want to do it, but it's a big project and some other stuff has higher priority :)
- claytonjy 4y agoThank you for the response Charlie! I also found darglint but yes, even less maintained than pydoctest. Totally understood this isn't a top priority, but very glad to hear it is potentially in-scope. I've been looking for an excuse to get into rust... we'll see.
- charliermarsh 4y agoOf course. There's at least one Ruff contributor who I know is working on a Python docstring parser, written in Rust, with formal grammars etc. (unlike Pydocstyle which relies on regex). I don't know the status of that project, but it would be very cool to see, and Ruff could of course leverage it :)
- deleted 4y ago[deleted]