********************************** Introduction for documenting ********************************** .. rubric:: Some hints on writing documentation with Sphinx for web2py Writing documentation ======================== official documentation ---------------------------------- * `Sphinx `_ Docstrings ------------------------ * official python standard * `Docstring Conventions `_ * `Documenting Python `_ * numpy standard * `documentation standard `_ * `Example file `_ * `Docstring Template `_ If you use `Eclipse / Pydev `_ you can define this piece as template. Helpers ------------------------ Editors ________________________ * `Emacs: see docutils page `_ * `Gedit (Linux) `_ * `Ulipad (Win) `_ Others ________________________ * creating tables in ReST can be painful. Here is a module that can help:: easy_install prettytable import prettytable as pt mytable =pt.PrettyTable(["id", "category", "recipie"]) print mytable # copy & paste this into your ReST document! mytable_string = mytable.get_string() # or insert this string when generating automatic documents Building documentation ======================== Follow these steps: #. easy_install -U sphinx #. built with custom make files for web2py => **Note: we could create a cross-platform python script for this!** #. unix-like: ``sh doc/make-doc_html.sh`` #. windows: ``doc\make-doc_html.bat`` Due to the special manner of the *web2py* import mechanism it requires that the doc is built from the *web2py* root directory. #. the result will written to: ``web2py/applications/examples/static/sphinx`` (the target directory will be automatically created) #. inspect any error #. on the :term:`CLI`: see the errors and warnings floating on ``stderr``/``stdout`` #. using the above mentioned make files a log file will be written to ``web2py/doc/sphinx-build.log`` Contributing ======================== .. warning:: Please ask on the `Mailinglist `_ before commiting or pushing to the repositories. So far, it has not been agreed on a proper setup to mutually edit the documentation and especially how to correct the docstrings without getting to many :term:`DVCS` conflicts. #. branch the web2py Sphinx code:: bzr branch lp:~web2py/web2py/web2py-sphinx cd web2py-sphinx #. pull the latest code from web2py Sphinx branch:: bzr pull #. pull latest web2py development version:: bzr pull http://bazaar.launchpad.net/~mdipierro/web2py/devel/ #. change and edit the documents or docstrings with your edior #. push the changes to the web2py Sphinx branch:: bzr push lp:~web2py/web2py/web2py-sphinx This requires that you are a member of the `web2py team at Launchpad `_ and registered at Launchpad `with your SSA keys `_. You can find more info on the `Launchpad help page `_