Ask Your Question
3

Using Sphinx to document a module using Sage

asked 2011-03-13 05:48:14 -0500

Hi all

I wrote a module using sage (first line : from sage.all import *)

My module contains quite a lot of docstrings with doctests that I want to be exported in html.

Following the documentation of Sphinx, I can create the source directory, but make html does not work :

"No module named sage.all"

Well. I understand why, but I don't see how to get further. The Sage's documentation says how to sphinxify one docstring, but what I want is a html file with all my doctrings, that is, as far as I understood, the result of that :

.. automodule:: mymodule
   :members:

I'm sure that it is possible : the whole documentation of Sage itself is made like that :)

In one word, I want to do "docstrings of my module -> html". Any help is accepted

Thanks Laurent

edit retag flag offensive close merge delete

Comments

I've wanted to do this several times too, and I think others have asked about it on the sage-devel list. I've seen answers there, but I can't ever find the threads later when I need them! Hopefully a good answer will show up here :)

niles gravatar imageniles ( 2011-03-13 05:54:48 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
6

answered 2011-03-13 07:05:43 -0500

updated 2011-03-14 01:55:20 -0500

I got it. It was indeed on the forum. One has to launch make html inside a sage bash shell.

Mini tutorial :

  • go in the directory in which you want the documentation to appear
  • launch sphinx-quickstart and answer the questions. The key question on which you have to answer "yes" is

autodoc: automatically insert docstrings from modules (y/N) [n]:

  • get into the directory in which it created index.rst
  • launch sage -sh and then make html in the new shell.

That'it. Hope it will help the next one.

edit flag offensive delete link more

Comments

thanks! -- can you give us links to the forum emails too, in case there's useful additional information there?

niles gravatar imageniles ( 2011-03-13 08:29:40 -0500 )edit
Laurent Claessens gravatar imageLaurent Claessens ( 2011-03-13 22:37:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-03-13 05:48:14 -0500

Seen: 444 times

Last updated: Mar 14 '11