Ask Your Question
3

Using Sphinx to document a module using Sage

asked 14 years ago

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

Preview: (hide)

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 ( 14 years ago )

1 Answer

Sort by » oldest newest most voted
6

answered 14 years ago

updated 14 years ago

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.

Preview: (hide)
link

Comments

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

niles gravatar imageniles ( 14 years ago )
Laurent Claessens gravatar imageLaurent Claessens ( 14 years ago )

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: 14 years ago

Seen: 940 times

Last updated: Mar 14 '11