[Numpy-discussion] SphinxDocString class in new numpy doc framework

Matt Knox mattknox_ca at hotmail.com
Sun Jun 29 22:17:01 EDT 2008


I guess this question is mostly for Stefan... but I am trying to port the
scikits.timeseries module wiki documentation into a sphinx framework, and
also
trying to follow the numpy doc string standards (which can't be parsed
directly
by sphinx), so I'm trying to use the SphinxDocString class in
docscrape_sphinx.py to pre-process the doc strings. However, the doc strings
do
not seem to be getting processed correctly. I didn't dig deep into the
issue,
but I thought I'd ask first before I go any further in case I am approaching
this incorrectly all together.

If I try to process the numpy.swapaxes docstring for example, I get the
following output (note the formatting of the parameters):

>>> print SphinxDocString(np.swapaxes.__doc__)

Return a view of array a with axis1 and axis2 interchanged.


**Parameters**
``````````````

    **a** : array_like

        Input array.
        axis1 : int
        First axis.
        axis2 : int
        Second axis.

**Examples**
````````````

        >>> x = np.array([[1,2,3]])
        >>> np.swapaxes(x,0,1)
        array([[1],
               [2],
               [3]])

        >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]])
        >>> x
        array([[[0, 1],
                [2, 3]],

               [[4, 5],
                [6, 7]]])
        >>> np.swapaxes(x,0,2)
        array([[[0, 4],
                [2, 6]],

               [[1, 5],
                [3, 7]]])
================================================================

I don't know if the SphinxDocString class is even ready for use yet or not,
but
this didn't look right to me.

The other thing I was wondering is if anyone knows how to pre-process doc
strings on the fly such that you can mix them in with your .rst files
similar to
how the autodoc sphinx extension works (rather than just pre-generating a
big
dump of all the doc strings into a single .rst file). This is probably a
question more for the sphinx mailing list, but I thought I'd ask while I'm
on
the topic in case anyone has any quick tricks they can share.

Thanks,

- Matt

-- 
View this message in context: http://www.nabble.com/SphinxDocString-class-in-new-numpy-doc-framework-tp18187697p18187697.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list