Skip to content

Links in docstrings are broken #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weaverba137 opened this issue Oct 15, 2017 · 7 comments · Fixed by #124
Closed

Links in docstrings are broken #116

weaverba137 opened this issue Oct 15, 2017 · 7 comments · Fixed by #124

Comments

@weaverba137
Copy link
Contributor

weaverba137 commented Oct 15, 2017

Consider this docstring:

class SDSSMuNu(ac.BaseCoordinateFrame):
    """SDSS Great Circle Coordinates

    Attributes
    ----------
    stripe
        SDSS `Stripe Number`_ .
    node
        Node of the great circle with respect to the celestial equator.
        In SDSS, this is almost always RA = 95.0 degrees.
    incl
        Inclination of the great circle with respect to the celestial
        equator.
    phi
        Counter-clockwise position angle w.r.t. north for an arc
        in the +nu direction.

    .. _`Stripe Number`: http://www.sdss.org/dr14/help/glossary/#stripe

    Parameters
    ----------
    mu : :class:`~astropy.coordinates.Angle`
        Angle corresponding to longitude measured along a stripe.
    nu : :class:`~astropy.coordinates.Angle`
        Angle corresponding to latitude measured perpendicular to a stripe.

    Notes
    -----
    http://www.sdss.org/dr12/algorithms/surveycoords/
    """

Using numpydoc v0.7, I get the following warning when building documentation:

[...]/pydl/pydlutils/coord.py:docstring of pydl.pydlutils.coord.SDSSMuNu:34: WARNING: Unknown target name: "stripe number".

As far as I can tell the link "Stripe Number" is perfectly valid reStructuredText.

@MSeifert04
Copy link
Contributor

Could be related to #114.

@jnothman
Copy link
Member

jnothman commented Oct 15, 2017 via email

@weaverba137
Copy link
Contributor Author

OK, in fact moving the target to a different section does seem to work:

class SDSSMuNu(ac.BaseCoordinateFrame):
    """SDSS Great Circle Coordinates

    Attributes
    ----------
    stripe
        SDSS `Stripe Number`_ .
    node
        Node of the great circle with respect to the celestial equator.
        In SDSS, this is almost always RA = 95.0 degrees.
    incl
        Inclination of the great circle with respect to the celestial
        equator.
    phi
        Counter-clockwise position angle w.r.t. north for an arc
        in the +nu direction.

    Parameters
    ----------
    mu : :class:`~astropy.coordinates.Angle`
        Angle corresponding to longitude measured along a stripe.
    nu : :class:`~astropy.coordinates.Angle`
        Angle corresponding to latitude measured perpendicular to a stripe.

    Notes
    -----
    http://www.sdss.org/dr12/algorithms/surveycoords/

    .. _`Stripe Number`: http://www.sdss.org/dr14/help/glossary/#stripe
    """

This is a good enough workaround for me to keep working, but this could trip up lots of people, and still should be fixed.

weaverba137 added a commit to weaverba137/pydl that referenced this issue Oct 15, 2017
@jnothman
Copy link
Member

jnothman commented Oct 16, 2017 via email

@weaverba137
Copy link
Contributor Author

OK, fair enough, but it should be easy to document this as a known issue at least.

@stefanv
Copy link
Contributor

stefanv commented Oct 16, 2017

Good point; I think we answer enough numpydoc installation, configuration, and usage issues that some Sphinx documentation is warranted. With the added benefit that we can use numpydoc inside that sphinx build, to give some more examples, and to ensure that we don't break in future Sphinx versions.

@jnothman
Copy link
Member

Btw, you could have also put the link definition within the description of stripe. The problem is formatting it in a way that numpydoc then parses it as an attribute/parameter/returnvalue name.

We now have docs local to the repository. Please feel free to submit a PR modifying https://github.com/numpy/numpydoc/blob/master/doc/format.rst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants