Hello group,
i'm in the process of writing a sphinx-based documentation for a
Cython-based package right now and noticed that it seems to be the case
that attribute docstrings don't get properly added when building
extension types, although method and property docstrings work just fine.
I noticed that support for public attribute docstrings was added here
(
https://github.com/cython/cython/issues/766), but my attributes are
readonly, so still important to the public, but just not writable. I
don't know if this has something to do with this issue/feature though,
but my docstring simply doesn't get copied over.
I've got a pxd file with my class definition and a .pyx file, which
looks like this:
foo.pxd:
cdef class foo:
cdef readonly Version api_version
cdef readonly Version version
foo.pyx:
cdef class foo:
def __cinit__(foo self):
self.api_version = Version(_API_VERSION)
"""
the version this package was designed to work with.
"""
self.version = Version(get_version())
"""
version of the shared library currently loaded
"""
Version and api_version don't get properly annotated when using sphinx
autodoc, but they get detected properly. I tried annotating them
manually within the class docstring, but since they already got
detected, sphinx tells me that I now got two separate documentations for
the same attribute, which obviously is a problem.
Is there any way to properly annotate attributes (readonly if possible)
for sphinx to properly pick up?
Thanks.
Best Regards.
Toni Barth