Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm interested in reading Python documentation when I'm traveling.

Right now, I'm doing that by entering the command:

$ pydoc2.7 PyQt4.QtGui.QPushButton
Help on class QPushButton in PyQt4.QtGui:

PyQt4.QtGui.QPushButton = class QPushButton(QAbstractButton)
 |  QPushButton(QWidget parent=None)
 |  QPushButton(QString, QWidget parent=None)
 |  QPushButton(QIcon, QString, QWidget parent=None)
 |  
 |  Method resolution order:
 |      QPushButton
 |      ...
 |      ...
 |      ...

I don't really like this way of reading the documentation. I'm interested if there are other applications which let me read Python documentation offline.

share|improve this question
1  
pydoc -p 1234 starts a web server (http://localhost:1234/) which lists all libraries on the system. This still only shows documentation from inside the .py files though - most libraries provide some other sort of documentation but there isn't a sufficiently consistent standard for how to access them. –  chronitis Oct 7 '13 at 10:02
add comment

2 Answers 2

up vote 7 down vote accepted

Ubuntu provides the documentation for Python and its major libraries as different packages. The documentation is in HTML format and can be viewed in your browser once installed.

These documents are installed as a sub-directory in /usr/share/doc/. After installing the packages, we may browse to this folder and open the index.html file contained therein with our Browser and bookmark its location for easy access.

It's good to search Ubuntu Software Center for the package of the documentation you want. Use the keywords as:

  • python-<library_name>-doc for documentation relating to Python 2 third-party library; and
  • python3-<library_name>-doc for documentation relating to Python 3 third-party library.

You should be able to find them with some trial and error, otherwise Google is your friend.

Example for installing Python documentation and PyQt4 Reference Guide

Following is an example relating to:

Install the documentation package

sudo apt-get update
sudo apt-get install python-doc python-qt4-doc

Add as Browser bookmark

Open your File Manager and browse to /usr/share/doc/python-doc and look for index.html file to open it with your browser. Then add it as a bookmark.

Similarly, browse to /usr/share/doc/python-qt4-doc/html and look for index.html and add that as a bookmark. I would also suggest to bookmark the location of /usr/share/doc/python-qt4-doc/examples for some good example code written in PyQt4.

You may follow similar approach for having access to offline documentation for other third-party Python libraries.

share|improve this answer
1  
Very handy. I've seen *-doc before when using apt-get, but I never knew its use. Thank you! –  Exeleration-G Oct 7 '13 at 13:56
add comment

you could always download the documentation from here. But you need to keep it up-to-date with the online version.

share|improve this answer
    
Does this also include library documentation? I'm asking because I need to look up a lot of PyQt stuff. –  Exeleration-G Oct 7 '13 at 9:35
    
@Exeleration-G well it says here that it does, To download an archive containing all the documents for this version of Python in one of various formats. But download one and search for the topics that you need and you will know for sure. –  Alvar Oct 7 '13 at 9:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.