Skip to content

Allow custom module name for a properties.Instance #291

@jcapriot

Description

@jcapriot

I would like to be able to specify the module name of a properties.Instance property. Sometimes these class reside in a module that does not specifically have documentation of it. This can happen fairly often in a code. For example, see the discretize documentation for the discretize.base.BaseMesh (http://discretize.simpeg.xyz/en/master/api/generated/discretize.base.BaseMesh.html) where the actual module where it is defined is in the discretize.base.base_mesh.BaseMesh (https://github.com/simpeg/discretize/blob/e353fb53ec254aa2a18733679da3fddae71ddbb7/discretize/base/base_mesh.py#L14) However we don't necessarily want that module exposed to the documentation, but would still like to generate automatic links to it from other packages.

The current Instance class will generate a documentation target for the property using instance_class.__module__.

def sphinx_class(self):
Which would then fail to find the accurate reference in the documentation.

As far as I know there would be no way to programmatically get where the item was imported through, so I propose adding an optional argument to the properties.Instance class that would hold this module_name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions