recurse_tree() only looks for files with extension .py and .pyx. Compiled python modules with the extension .so work perfectly fine with sphinx automodule but are not found by by recurse_tree(). Simply adding .so to the search path would be problematic because it would not properly handle situation where there is a directory and a .so file with the same name.
I note that refactoring this function to use pkgutil.walk_packages() would be the most correct solution, as it searches the directory using the same code python actually uses to load modules. However, it would exclude the possibility of having followlinks=false even though I am not sure why someone would want this option to be false.
Any updates on this? I can confirm that *.so files are not included.
I seem to have also run into this issue.
Hi,
I created a sample .so file in the hopes that it will be helpful in developing this feature. Within the attached .zip file is helloworld.cpython-35m-x86_64-linux-gnu.so. It defines a c extension module by the name helloworld. There is one function called helloworld as well. It was built against python3.5 for 64-bit linux. Here is how to use it:
>>> import helloworld
>>> help(helloworld)
Help on module helloworld:
NAME
helloworld - This is the module level docstr :).
FUNCTIONS
helloworld(...)
This is the docstr for helloworld function :).
FILE
/usr/local/lib/python3.5/dist-packages/helloworld.cpython-35m-x86_64-linux-gnu.so
>>> help(helloworld.helloworld)
Help on built-in function helloworld in module helloworld:
helloworld(...)
This is the docstr for helloworld function :).
>>> helloworld.helloworld()
'Hello World!'
>>>
The helloworld extension can be built with sudo python3 setup.py install.
Please add the ability to sphinx-apidoc to pick up c-extension modules like this. .pyd files are the windows equivalent of .so files.
I just posted #6801 to fix this. It seems working fine on Linux. But I can't test it in Windows platform. Can someone test this?
@highvelcty Thank you for example. It was very helpful to me!
Fixed by #6801.
Thank you for comment, all!