views:

706

answers:

5

Since Python 2.6, it seems the documentation is in the new reStructuredText format, and it doesn't seem very easy to build a Texinfo Info file out of the box anymore.

I'm an Emacs addict and prefer my documentation installed in Info.

Does anyone have Python 2.6 or later docs in Texinfo format? How did you convert them? Or, is there a maintained build somewhere out there?

I know I can use w3m or haddoc to view the html docs - I really want them in Info.

I've played with Pandoc but after a few small experiments it doesn't seem to deal well with links between documents, and my larger experiment - running it across all docs cat'ed together to see what happens - is still chugging along two days since I started it!

+3  A: 

Python docs are now generated using Sphynx framework. This framework does not have texinfo output format. Currently it has:

  1. HTML
  2. latex
  3. plain text

Maybe you can get what you want using the Latex output. With the text output you will lost the cross ref.

Personnaly I prefer using pydoc when I want textual output. With Vim I have a shorcut to call pydoc and open a window with the doc for the entity under my cursor...

Nikokrock
Thanks Nikokrock. I know about Sphinx, the original question links to it. I've dug about and it doesn't seem trivial to convert LaTeX to Texinfo - Pandoc seems more promising. There seem to be a few people watching this question but yours is the only answer so far - I wonder if most Python-Emacs programmers just live without Info since 2.6?
Matt Curtis
p.s. Here's links to a package that I found: http://members.inode.at/wjenkner/pari-info/The-tex2texi-conversion-package.html - I could get this or Pandoc working, or write my own converter, but what I'm seeking is a way of avoiding that if possible, because it's a bit of a distraction from the code I actually want to write! :-)
Matt Curtis
A: 

Another "workaround" is to execute pydoc as suggested by Nikokrock directly in Emacs:

(defun pydoc (&optional arg)
  (interactive)
  (when (not (stringp arg))
    (setq arg (thing-at-point 'word)))

  (setq cmd (concat "pydoc " arg))
  (ad-activate-regexp "auto-compile-yes-or-no-p-always-yes")
  (shell-command cmd)
  (setq pydoc-buf (get-buffer "*Shell Command Output*"))
  (switch-to-buffer-other-window pydoc-buf)
  (python-mode)
  (ad-deactivate-regexp "auto-compile-yes-or-no-p-always-yes")
)
wr
Thanks wr. That's a top tip for using Python in Emacs in general, but doesn't answer the question.
Matt Curtis
A: 

Michael Ernst used to maintain Info formats of Python docs:

http://www.cs.washington.edu/homes/mernst/software/#python-info

You can try using his makefile and html2texi script to generate an updated version. Both are linked at the above URL. I'm not sure how well it works now (the last version was around 2001), but his script is well commented (grep for "python").

ars
A: 

For those following this question in the hope of an answer, I found another rst2texinfo implementation which you might like to try:

http://bitbucket.org/jonwaltman/rst2texinfo/src

Matt Curtis
+3  A: 

Jon Waltman http://bitbucket.org/jonwaltman/sphinx-info has forked sphinx and written a texinfo builder, it can build the python documentation (I've yet done it). It seems that it will be merged soon into sphinx.

Here's the quick links for the downloads (temporary):

Steps to generate python doc in texinfo format:

Download the python source code

Download and install the sphinx-info package (in a virtualenv)

Enter in the Python/Doc directory from the python sources

Edit the Makefile, to the build target replace $(PYTHON) tools/sphinx-build.py with sphinx-build, then add this target to the makefile, pay attention, the space before echo is a TAB:

texinfo: BUILDER = texinfo
texinfo: build
    @echo
    @echo "Build finished. The Texinfo files are in _build/texinfo."
    @echo "Run \`make' in that directory to run these through makeinfo" \
          "(use \`make info' here to do that automatically)."

Edit the Python/Doc/conf.py adding:

texinfo_documents = [
    ('contents', 'python', 'Python Documentation', 'Georg Brandl',
     'Python', 'The Python Programming Language', 'Documentation tools',
     1),
]

Then run make texinfo and it should produce the texifile in the build/texinfo directory. To generate the info file run makeinfo python.texi

pygabriel
I've had this question open for over a year, thanks for answering it! I'd earlier spotted Jon's work (see my answer from Sep 9th) but I didn't realise he'd gotten so far. I just ran `install-info python.info` and now I have all the Python docs at my fingertips. Awesome!
Matt Curtis
Can you describe the steps to genererate the .texi and .info files? I'd like to have the Python 2.7 docs.
Eddy Pronk
I've added some guidelines please tell me if you are in trouble with it
pygabriel
Thanks, that works. I needed a "sudo ginstall-info --dir-file=/usr/local/info/dir --info-file=python.info"
Eddy Pronk