Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Parse2docs, turn Python Argparsers into usage documentation (github.com/mrcordeiro)
14 points by brauhaus on July 7, 2023 | hide | past | favorite | 3 comments



This is the first person library I've published! :)

I was getting tired of creating command line interfaces in Python whose contents I would then copy to create the Usage documentation. Now I pass the path to the script the ArgumentParser is located and it generates the markdown for me.

Currently, it can only find parsers located either in the module scope out that are returned by a function.

It doesn't handle subparsers yet, but I'm thinking about leaving like that for now. As of next steps, I wanted to add an option to generate docs in .rst format or wrap the library as a plugin for mkdocs.

I'm here for all feedback - bugs, feature suggestions, and usability comments. You can comment, open a GitHub issue, or reach out directly.

Ofc, I'm also welcoming any contributions. Please test parse2docs and send me your suggestions!


There's also help2man, which turns help output into man pages.


Hm, they took an interesting approach where they capture the echoed help messages using shell scripts.

I was struggling to capture the python nodes and that would bypass it completely. It could even work with other python libraries, such as Click.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: