JonathanWaltman

Emacs user since 2009

Added a Texinfo generator to the documentation system used by Python so I could access it using Info.

Wrote a package to improve ‘info-lookup-symbol’ in python-mode.

Welcome to the wiki. – DrewAdams

Wow this info file is over 9MB uncompressed. makeinfo defaults to splitting info files in 300k byte chunks by default. I think it is time to bump up this value to some higher value, but 9MB is by far the largest info file I’ve ever seen. However it may be ok these days with most computers having several gigabytes of memory. – RichardKim

Yes, it is quite large; it includes all of the Python docs in a single file. You can download the Texinfo source file from <https://bitbucket.org/jonwaltman/pydoc-info/downloads/python.texi.gz> and build it yourself if you want a split-up info file. – JonathanWaltman

Thanks for the latest python.info! I am very glad that you added texinfo support to Sphinx. I’ve been using python info files for version 2.4, because of lack of texinfo support in Sphinx. Now I can upgrade the python info files to version 2.7. I would be interested in knowing what you changed to info-lookup-symbol, because I’ve been using the following elisp for years to setup info-lookup. – RichardKim

(eval-after-load “info-look” ‘(let ()

     (info-lookup-add-help
      :mode 'python-mode :topic 'symbol
      :regexp "[_a-zA-Z][_a-zA-Z0-9]*"
      :doc-spec '(
                  ("(python-lib)Function-Method-Variable Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-lib)Miscellaneous Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-lib)Module Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-lib)Class-Exception-Object Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-ref)Function-Method-Variable Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-ref)Class-Exception-Object Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-ref)Miscellaneous Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  ("(python-ref)Module Index" nil
                   ;;"^[ \t]+- [^:]+:[ \t]*" "\\b"
                   nil nil)
                  )
      )
     ))

This code and the code in “python.el” was broken by some changes introduced with the new info docs.

  • The info files “python-ref” and “python-lib” have been merged into a single file, “python”.
  • There is now only a single Index section, “Index”

The following code (modified copy from “python.el”) provides the basic support needed to make ‘info-lookup-symbol’ work with the new docs:

(require 'info-look)

(info-lookup-add-help
 :mode 'python-mode
 :regexp "[[:alnum:]_]+"
 :doc-spec '(("(python)Index" nil "")))

pydoc-info is more complex and expects index entries to match the format produced by Sphinx. It tries to convert index entries to more precise symbol names in order to avoid duplicate and ambiguous names. For example, performing ‘info-lookup-symbol’ on the phrase “os.write” using the above code, it will lookup the symbol “write” and direct you to the documentation for array’s write method. pydoc-info should work as expected and direct you to the documentation for the os.write function.

Feedback or suggestions on pydoc-info are welcome. – JonathanWaltman

I started using your python.info as well as the new info-lookup setup. So far it is very very good. - I see over 16 thousands index entries - almost 8 thousand @deffn* entries in the texinfo file - I get completion to all built-in libraries symbols with completion, e.g., “os path abspath”, “sys path”, etc. - all items I looked for, I was taken to the correct node and to the correct line on my info browser! - despite my initial surprise at finding a single 9MB info file, I like the fact that it is one file! Now I can do a single regexp search and find everything.

You have done a truly wonderful job Jonathan! I think this is a vast improvement over the old info files that I’ve been hanging onto since python 2.4. I have completely switched over to using the new info file. Thanks again! RichardKim

Great job on pydoc-info. Works perfectly out of the box. Thanks. JonMoore


CategoryHomepage