[QGIS-Developer] PyQGIS docstrings only show the SIP wrapped function signature, not the actual docstring?

Nathan Woodrow madmanwoo at gmail.com
Mon Jun 19 14:36:44 PDT 2017


You won't be able to get the doc strings like that in 2.x as we never
included them in the sip files meaning they are never exposed to Python.
The automatic sip generation which also includes docs string is only for
3.x.

Nathan

On Tue, 20 Jun 2017, 7:31 AM Kevin Stadler <e0425926 at student.tuwien.ac.at>
wrote:

> Hello,
>
> I'm trying to access the docstrings of various QGIS 2.* components
> from the IPython console, but instead of the actual documentation I
> only seem to get dummy docstrings generated by SIP:
>
> >>> QgsMapLayerRegistry.instance().mapLayers.__doc__
> 'mapLayers(self) -> object'
>
> >>> QgsMapLayerRegistry.instance().mapLayer.__doc__
> 'mapLayer(self, QString) -> QgsMapLayer'
>
> >>> QgsVectorLayer.__doc__
> 'QgsVectorLayer(path: QString = QString.null, baseName: QString =
> QString.null, providerLib: QString = QString.null,
> loadDefaultStyleFlag: bool = True)'
>
> Using help(...) instead of .__doc__ doesn't look much different. Is
> this just something wrong with my build (from the Fedora stable
> repository), can somebody reproduce this on a non-Linux build?
>
> I've looked through the mailing list archive but haven't found
> anything conclusive. The flag to have SIP generate docstrings
> requested here is still enabled:
>
> http://osgeo-org.1560.x6.nabble.com/Sip-flag-to-generate-docstrings-td4485370.html
>
> I'm thinking it might have to do with the new SIP file generation
> workflow described here:
>
> http://osgeo-org.1560.x6.nabble.com/automatic-sip-files-generation-td5314970.html
> although I'm not clear on which branch this actually applies to (and
> whether it might be the source or the solution of my problem)?
>
> Best,
> Kevin
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170619/0de6be79/attachment.html>


More information about the QGIS-Developer mailing list