Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python-sphinx documenting scripts with no py extension

Apologies - this is a complete n00b question:

I have a couple of python scripts with no .py extension.

How do I convince Sphinx that it should document that script? Example error:

/home/XXX/YYYYY/development/dst/build/index.rst:25: (WARNING/2) autodoc can't import/find module 'site_scons.random', it reported error: "No module named random", please check your spelling and sys.path

like image 309
user2573436 Avatar asked Nov 01 '22 07:11

user2573436


1 Answers

In order for your script to be a module, it needs to include the .py suffix. From the Python docs:

A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended.

Without giving it the suffix, Sphinx won't be able to import it to generate documentation using automodule.

like image 108
dirn Avatar answered Nov 15 '22 03:11

dirn