1

When using Napoleon with google docstrings (I haven't tested numpy, but I suspect similar problems) with the napoleon_use_ivar option set to True, it creates links to the names of instance variables. These names are obviously very common (things like "name"), and linking them to some random definition is not helpful - is there any way to disable this?

Given the following docstring:

"""
Attributes:
  name (str): Friendly name
"""

It will attempt to cross-reference name in the html output. It complains about this, given the ambiguity of the target:

/home/nbastin/geni-lib/geni/rspec/pgad.py:docstring of geni.rspec.pgad.AdInterface:None: WARNING: more than one target found for cross-reference u'name': geni.rspec.igext.AddressPool.name, geni.rspec.vtsmanifest.GREPort.name, geni.rspec.vtsmanifest.InternalPort.name, geni.rspec.pg.
Node.name, geni.rspec.vtsmanifest.PGLocalPort.name, geni.rspec.pg.Interface.name, geni.rspec.vtsmanifest.GenericPort.name, geni.rspec.vtsmanifest.ManifestContainer.name, geni.urn.GENI.name, geni.rspec.vtsmanifest.InternalContainerPort.name

However, it still creates a link in the HTML output - if you click on the name attribute it happily sends you to some random symbol that has nothing to do with the current attribute. Is there any way to disable this behaviour?

If napoleon_use_ivar is set to False this doesn't happen, but the attribute output is not at all compact and is very hard to read.

This is not Napoleon specific - if you specify the attributes by hand with ivar it also cross-references them in a way you cannot control:

:ivar name: Friendly name
:vartype name: str

That still gets a link for name.

Nick Bastin
  • 30,415
  • 7
  • 59
  • 78
  • Possible duplicate of [Sphinx :ivar tag goes looking for cross-references](https://stackoverflow.com/questions/31784830/sphinx-ivar-tag-goes-looking-for-cross-references) – David Röthlisberger Jul 04 '17 at 08:28

0 Answers0