Learn more about Python Docstrings to contribute high-quality documentation while coding. We follow Google Style Python Docstrings.
We call kale and examples the root-level modules, kale.xxx and examples.xxx the first-level modules, and kale.xxx.xxx and examples.xxx.xxx the second-level modules (and so on, if necessary).
-
First-level module update: If the
kale.xxxmodule is not undersourceyet, runsphinx-apidoc -o source/ ../kalefromdocsto generate the.rstfile undersourcefirst. If theexamples.xxxmodule is not undersource/examplesyet, runsphinx-apidoc -o source/examples ../examplesfromdocsto generate the.rstfile undersource/examplesfirst. Note: This should be rarely needed. -
Second-level module update: If the
kale.xxx.xxxmodel is not in the documentation yet or has been renamed, add or revise it manually tokale.xxx.rstin an alphabetically-sorted position, e.g. adding thelinformermodule by inserting the following inkale.embed.rstright before thempcamodule:kale.embed.linformer module ---------------------- .. automodule:: kale.embed.linformer :members: :undoc-members: :show-inheritance:Caution: Alternatively (e.g., lots of modules are renamed), remove all relevant
.rstfiles undersourceand then recreate them, e.g., via runningsphinx-apidoc -o source/ ../kale. After creation, edit the heading of.rstfiles, e.g., from kale.embed package to Embed (see those in an earlier version). -
Final update step: Run
make htmlfromdocsto update the.htmlfiles under thebuildfolder using the source files under thesourcefolder and verify the updated documentation in a browser atpykale/docs/build/html/index.html. Runmake cleanwill clean thebuildfolder for a fresh build. Do NOT commitdocs/build(see.gitignore). Build and view offline to check. -
Other standardization
- Put a docstring at the top of each
.pyto summarize the module - Docstring for a class should be at the top of the class definition, above
__init__ - See
examples/digits_dannand related modules for reference.
If you are aware of a better way to auto-generate documentations, create an issue or push your suggested changes.
- We use Read the Doc with Sphinx.
- Documentations can be automatically generated. Tutorial: Autodocumenting your Python code with Sphinx
- Python Docstring Generator for VScode
Key references from JMLR Machine Learning Open Source Software
- Tensor Train Decomposition on TensorFlow (T3F)
- A Graph Kernel Library in Python
- A Python Toolbox to Tackle the Curse of Imbalanced Datasets in Machine Learning
- Deep Universal Probabilistic Programming
- A Python Toolbox for Scalable Outlier Detection
Another documentation to learn from: the MONAI highlights.