MyDocstring is a small Python package that allows you to extract and parse docstrings. It is suited for building your own documentation system. Docstrings can be displayed as either plain-text, Markdown, or JSON data.
- Supports Python PEP484 type hints.
- Supports pybind11 docstrings.
- Supports Google-style docstrings.
- Produces JSON, plain-text, and Markdown output for modules, classes, functions, and methods.
If you are interested in building a documentation solution for your own project, a good place to start is this tutorial. This tutorial will teach you how to extract and parse docstrings.
If you are after a complete documentation solution, then see the showcase section that features solutions built on MyDocstring.
The project also comes with a command line tool that serves as an example of what you can build with the package. See here for learning how to use the command line tool and to see some example output.
The package is available on the Python packaging index PyPi and can be installed via pip as follows.
$ pip install mydocstring
This project uses:
- docopt for the command line interface application.
- mako for producing markdown templates.
- pytest for testing.
If you are having problems extracting your docstrings, or parts of their content end up missing, then please make sure that your are only using spaces (no tabs). Four spaces should be used for each level of indentation. Also, make sure that you conform to the Google style guide when writing your docstrings.
Otherwise, please submit a new issue using the issue tracker and explain the problem.
Contributions are more than welcome. Please reach out via the issue tracker to discuss and also see here for some guidelines.
If you end up using this tool in your project in one way or another. I would love to hear about it and showcase it here. Please go ahead and make a pull request.
- NetKet is an open-source project for machine learning and many-body quantum systems. It uses mydocstring for generating reference documentation from pybind11 docstrings. See here for the source.
This project is licensed under the MIT License - see the LICENSE.md file for details.