Open jcapriot opened 4 years ago
I realize this was late last night, so hopefully I can expand this a little more clearly...
let's say we construct a properties.Instance
from a properties.HasProperties
class.
prop = properties.Instance('This property has properties', properties.HasProperties)
prop.sphinx_class()
will evaluate to properties.base.base.HasProperties
.
What I would like is for something like:
prop = properties.Instance('This property has properties', properties.HasProperties, module_name='properties')
in which case
prop.sphinx_class()
will evaluate to properties.HasProperties
.
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 thediscretize
documentation for thediscretize.base.BaseMesh
(http://discretize.simpeg.xyz/en/master/api/generated/discretize.base.BaseMesh.html) where the actual module where it is defined is in thediscretize.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__
. https://github.com/seequent/properties/blob/85dccbbd5455e4a34a255f18fbf1db6f71311868/properties/base/instance.py#L183 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 thismodule_name
.