Skip to content

Auto document methods? #9

@tylerflex

Description

@tylerflex

Something to think about regarding the docs

It would be fantastic if we could come up with a way to automatically parse method docstrings and call signatures to create nicely rendering docs without having to do it manually.

    @classmethod
    def dict_from_json(cls, fname: str) -> dict:
        """Load dictionary of the model from a .json file.

        Parameters
        ----------
        fname : str
            Full path to the .json file to load the :class:`Tidy3dBaseModel` from.

        Returns
        -------
        dict
            A dictionary containing the model.

        Example
        -------
        >>> sim_dict = Simulation.dict_from_json(fname='folder/sim.json') # doctest: +SKIP
        """

would become something like

    @classmethod
    def dict_from_json(
        cls,
        fname: str # Full path to the .json file to load the :class:`Tidy3dBaseModel` from.
    ) -> dict: # A dictionary containing the model.
        """Load dictionary of the model from a .json file.

        Example
        -------
        >>> sim_dict = Simulation.dict_from_json(fname='folder/sim.json') # doctest: +SKIP
        """

Metadata

Metadata

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