I\'m building a Python package, and using Sphinx to create the docs. Aside from my package code, I also include a lot of command line Python scripts, which use argparse. I w
You can use sphinxcontrib.autoprogram. pip install sphinxcontrib-autoprogram, then put 
extensions += ['sphinxcontrib.autoprogram']
in your conf.py. To document command cli.py by importing cli with the argparse parser object parser (which can be a Python expression, like a function get_parser()), use
.. autoprogram:: cli:parser
   :prog: cli.py