typer icon indicating copy to clipboard operation
typer copied to clipboard

✨ Add docstring automation to get help message to typer objects

Open mateusoliveira43 opened this issue 3 years ago • 7 comments

Hi everyone,

Thanks for this awesome library, hope I can help :)

I hope this PR closes #227 and #336

My idea was to let typer get help messages to commands/arguments automatically from the objects docstrings.

I considered 3 docstrings formats: Numpy, Google and reST (Sphinx) (I believe they are the most common, right?).

I heve written some tests, but they can be improved (I felt that were a lot of duplications), and more can be written (units tests and more test cases, like callbacks).

mateusoliveira43 avatar Jul 24 '22 17:07 mateusoliveira43

I have updated the tests, to remove a bit of duplication.

But I noticed a problem: if a parameter documentation takes more then one line, only the first line is parsed. I did not had an idea to fix this yet :grimacing:

mateusoliveira43 avatar Aug 16 '22 16:08 mateusoliveira43

📝 Docs preview for commit 768644cd01128647d8dbdf49dc47a9eb9138a036 at: https://639cea219c18df08fdc8417d--typertiangolo.netlify.app

github-actions[bot] avatar Dec 16 '22 21:12 github-actions[bot]

@tiangolo is this something you'd consider adding? It would be exceedingly useful to incorporate this functionality directly into typer 😄

adam-moss avatar Sep 25 '23 20:09 adam-moss