Auto-tools/Projects/MozBase/WritingDocs: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "= Writing docs for Mozbase = == Getting started == * Install sphinx (sudo easy_install sphinx), and read the [http://sphinx.pocoo.org/tutorial.html tutorial] if you aren't fami...")
 
Line 12: Line 12:
== Conventions ==
== Conventions ==


* Mozbase is written as "Mozbase" (not MozBase)
* "Mozbase" is written as "mozbase" normally, as "Mozbase" at the beginning of a sentence, and never as "MozBase" (though there is lingering usage of the latter, particularly in wiki page names).
* Modules (e.g. mozfile) should be written as all lower case
* Modules (e.g. mozfile) should be written as all lower case
* Python conventions for writing docstrings:  
* Python conventions for writing docstrings:  

Revision as of 22:37, 1 November 2012

Writing docs for Mozbase

Getting started

Conventions

Procedure

  • Read: http://packages.python.org/an_example_pypi_project/sphinx.html
  • Add a toplevel .rst to docs/ (use mozfile as an example)j
  • Add a link to your module's .rst to index.rst (again, use mozfile as an example)
  • Modify your .rst to contain the magic strings
    • if all classes and functions are public you do not have to list them. Just provide an empty list
  • Update docstrings so that the generated docs look good
    • To get an overview text for your module add a docstring to the __init__.py module
  • To get updated documentation, run "make clean && make html"
    • Sphinx is not smart enough to figure out that it needs to rescan python files included by .rst files. To get around this, run 'make clean && make html' instead of just 'make html'
  • Profit!

Note: if you are documenting a new module you will need to add it to sys.path here: https://github.com/mozilla/mozbase/blob/master/docs/conf.py#L20