Ask Your Question

Using Sphinx to document a module using Sage

asked 2011-03-13 11:48:14 +0200

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

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


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 11:54:48 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-03-13 13:05:43 +0200

updated 2011-03-14 07:55:20 +0200

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


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 14:29:40 +0200 )edit
Laurent Claessens gravatar imageLaurent Claessens ( 2011-03-14 04:37:52 +0200 )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


Asked: 2011-03-13 11:48:14 +0200

Seen: 859 times

Last updated: Mar 14 '11