DiamondLightSource / dodal

Ophyd devices and other utils that could be used across DLS beamlines
Apache License 2.0
2 stars 8 forks source link

Expose help and docs from device factory functions. #780

Open DiamondJoseph opened 1 week ago

DiamondJoseph commented 1 week ago

After #597 but also relevant for the current state:

Device classes have docstrings about their capabilities/use/expected behaviour. Specific device factory functions may also have docstrings about their expected behaviour, other usage information. Some combination of these should be presented to the user when they use the python builtin help function on the device_factory_function.

Acceptance Criteria

DiamondJoseph commented 1 week ago

Note that the help method uses the docstrings generated via pydoc, which may require that we are using numpydoc style docstrings. @coretl has opinions about the verbosity.

coretl commented 1 week ago

Note that the help method uses the docstrings generated via pydoc, which may require that we are using numpydoc style docstrings. @coretl has opinions about the verbosity.

Really? That SO post seems to be about Spyder. help seems to just print what you wrote:

class A:
    def google_meth(self, a: int):
        """A google style doc method.

        Args:
            a: The parameter
        """
    def numpy_meth(self, b: str):
        """A numpy style doc method

        Parameters
        ----------
        b
            The parameter
        """
help(A)
class A(builtins.object)
 |  Methods defined here:
 |  
 |  google_meth(self, a: int)
 |      A google style doc method.
 |      
 |      Args:
 |          a: The parameter
 |  
 |  numpy_meth(self, b: str)
 |      A numpy style doc method
 |      
 |      Parameters
 |      ----------
 |      b
 |          The parameter