Re: [sphinx-dev] Beginner's Guide?

2011-02-21 Thread TP
On Mon, Feb 21, 2011 at 8:08 AM, werner  wrote:
> On 21/02/2011 16:44, TP wrote:
>>
>> For one example of how to document a Python method see
>>
>> http://tpgit.github.com/MDIImageViewer/imageviewer.html#imageviewer.ImageViewer.scaleImage.
>> Click on the [source] link on the right to see the actual Python
>> method (along with its docstring that generated the documentation).
>>
> What causes the Inheritance diagram to go top/down instead of right/left?
>  Is this some conf.py setting or ...?
>
> I am working on documenting Dabo with Sphinx and if you look at this page
> you can see my problem with the inheritance diagram.
>
> http://thewinecellarbook.com/daboDocTest/dabo.ui.dButton.dButton.html
>
> Werner
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-dev" group.
> To post to this group, send email to sphinx-dev@googlegroups.com.
> To unsubscribe from this group, send email to
> sphinx-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sphinx-dev?hl=en.
>
>

In my conf.py I have:

inheritance_graph_attrs = dict(rankdir="TB")

Use of which is mentioned at
http://sphinx.pocoo.org/ext/inheritance.html#confval-inheritance_graph_attrs

rankdir is somewhat documented at
http://graphviz.org/doc/info/attrs.html#d:rankdir.

-- TP

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



Re: [sphinx-dev] Beginner's Guide?

2011-02-21 Thread TP
On Fri, Feb 18, 2011 at 5:00 AM, Burhan  wrote:
> Hello:
>
>  I am new to Sphinx, and am going to use it for a python project to
> generate HTML documentation.  My problem is rather basic, I'm not sure
> how to format my docstrings so that Sphinx can extract the
> information.
>
>  I understand about using autodoc extension, and making sure that my
> modules are available to python so that sphinx can find my code - my
> problem is a  bit basic, how do I actually comment the code?
>
>  Do I have to enter *verbatim* examples are written in the
> documentation? So for example, is it like this:
>
> def my_funct(param=None,param2=None):
>    """
>       .. py:func:: my_funct(param=None,param2=None)
>          This function does something with two parameters,
>          which are default to :py:`None`
>    """
>
> Or do I have to document it separately in another file? A simple
> python code example would really help me out.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-dev" group.
> To post to this group, send email to sphinx-dev@googlegroups.com.
> To unsubscribe from this group, send email to 
> sphinx-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sphinx-dev?hl=en.
>
>

The basic idea is that you just use "info field lists"
(http://sphinx.pocoo.org/domains.html?highlight=info%20field%20lists#info-field-lists)
to document function parameters directly in your docstrings.

If you need more details, I wrote a fairly simple PyQt app called
MDIImageViewer and one of its goals was to demonstrate how to document
Python projects using Sphinx. You can find the generated HTML
documentation at: http://tpgit.github.com/MDIImageViewer. Clicking on
the "Show Source" link on any page will show you the Sphinx .rst
source for that page.
http://tpgit.github.com/MDIImageViewer/implementation.html#sphinx-documentation-notes
briefly discusses how I used Sphinx to generate the documentation.

The Python sources are at:
http://github.com/tpgit/MDIImageViewer/archives/master, The Sphinx
.rst files are at
http://github.com/tpgit/MDIImageViewer/tree/master/sphinx/.

For one example of how to document a Python method see
http://tpgit.github.com/MDIImageViewer/imageviewer.html#imageviewer.ImageViewer.scaleImage.
Click on the [source] link on the right to see the actual Python
method (along with its docstring that generated the documentation).

-- TP

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



Re: [sphinx-dev] Beginner's Guide?

2011-02-21 Thread werner

On 21/02/2011 16:44, TP wrote:


For one example of how to document a Python method see
http://tpgit.github.com/MDIImageViewer/imageviewer.html#imageviewer.ImageViewer.scaleImage.
Click on the [source] link on the right to see the actual Python
method (along with its docstring that generated the documentation).

What causes the Inheritance diagram to go top/down instead of 
right/left?  Is this some conf.py setting or ...?


I am working on documenting Dabo with Sphinx and if you look at this 
page you can see my problem with the inheritance diagram.


http://thewinecellarbook.com/daboDocTest/dabo.ui.dButton.dButton.html

Werner

--
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



Re: [sphinx-dev] Beginner's Guide?

2011-02-19 Thread werner

Hi,

I am pretty new to this too, so take my advice with a grain of salt.

On 18/02/2011 14:00, Burhan wrote:

Hello:

   I am new to Sphinx, and am going to use it for a python project to
generate HTML documentation.  My problem is rather basic, I'm not sure
how to format my docstrings so that Sphinx can extract the
information.

   I understand about using autodoc extension, and making sure that my
modules are available to python so that sphinx can find my code - my
problem is a  bit basic, how do I actually comment the code?

   Do I have to enter *verbatim* examples are written in the
documentation? So for example, is it like this:

def my_funct(param=None,param2=None):
 """
.. py:func:: my_funct(param=None,param2=None)
   This function does something with two parameters,
   which are default to :py:`None`
 """

Or do I have to document it separately in another file? A simple
python code example would really help me out.


In your code you would do this:

def my_funct(param=None,param2=None):
"""
This function does something with two parameters,
which are default to :py:`None`
"""


and in the .rst file you could do:

.. autoclass::
  :members:

for other ways/options see http://sphinx.pocoo.org/domains.html

to generate the .rst files (if you don't want to do them by hand or at 
least to get a start) you might want to look at


https://bitbucket.org/etienned/sphinx-autopackage-script

Werner


--
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



[sphinx-dev] Beginner's Guide?

2011-02-19 Thread Burhan
Hello:

  I am new to Sphinx, and am going to use it for a python project to
generate HTML documentation.  My problem is rather basic, I'm not sure
how to format my docstrings so that Sphinx can extract the
information.

  I understand about using autodoc extension, and making sure that my
modules are available to python so that sphinx can find my code - my
problem is a  bit basic, how do I actually comment the code?

  Do I have to enter *verbatim* examples are written in the
documentation? So for example, is it like this:

def my_funct(param=None,param2=None):
"""
   .. py:func:: my_funct(param=None,param2=None)
  This function does something with two parameters,
  which are default to :py:`None`
"""

Or do I have to document it separately in another file? A simple
python code example would really help me out.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.