Closed snowman2 closed 2 years ago
can you explicit what you've in mind with this ticket ?
I should have provided some more context initially. I ran into this when working on https://github.com/rasterio/rasterio/pull/2537.
If I download https://gdal.org/objects.inv, and use https://sphobjinv.readthedocs.io/en/latest/index.html to convert to json (sphobjinv convert json objects.inv
), I can find:
{"name": "GDALCreateRPCTransformerV2", "domain": "cpp", "role": "function", "priority": "1", "uri": "api/gdal_alg.html#_CPPv426GDALCreateRPCTransformerV2PK13GDALRPCInfoV2idPPc", "dispname": "-"}
However, I cannot find UseExceptions
or any other python functions indexed. This means I cannot use intersphinx to automatically link to the gdal Python API documentation. I am assuming this is because sphinx is not used to generate the Python API documentation?
I am assuming this is because sphinx is not used to generate the Python API documentation?
yes, the Python API doc is really scarce (due to SWIG not really supporting that), and using epydoc: https://github.com/OSGeo/gdal/blob/130bc9862e4080750be953d026f7ddbf9e81ddc3/swig/python/CMakeLists.txt#L463
I wonder if https://github.com/sphinx-contrib/apidoc would be any help?
I wonder if https://github.com/sphinx-contrib/apidoc would be any help?
not sure: the root issue is that it is not easy to associate Python docstrings with bindings generated by SWIG
Not sure if you're interested or not, but I gave it a try in #6137.
Does SWIG produce any sort of structured output surrounding the Python functions? If so, it should be possible to use sphobjinv's API either to augment the objects.inv with the C/CPP objects to also contain the Python ones, or to create an auxiliary objects.inv with just the Python items.
https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
It seems to work for the C/CPP functions, but not for Python.