Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7bb30b7

Browse files
committed
Improve Pydoc interactive browsing (#2001). Patch by Ron Adam.
* A -b option to start an enhanced browsing session. * Allow -b and -p options to be used together. * Specifying port 0 will pick an arbitrary unused socket port. * A new browse() function to start the new server and browser. * Show Python version information in the header. * A *Get* field which takes the same input as the help() function. * A *Search* field which replaces the Tkinter search box. * Links to *Module Index*, *Topics*, and *Keywords*. * Improved source file viewing. * An HTMLDoc.filelink() method. * The -g option and the gui() and serve() functions are deprecated.
1 parent 9af2a6e commit 7bb30b7

6 files changed

Lines changed: 656 additions & 73 deletions

File tree

Doc/library/pydoc.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,21 @@ manner similar to the Unix :program:`man` command. The synopsis line of a
5050
module is the first line of its documentation string.
5151

5252
You can also use :program:`pydoc` to start an HTTP server on the local machine
53-
that will serve documentation to visiting Web browsers. :program:`pydoc -p 1234`
54-
will start a HTTP server on port 1234, allowing you to browse
55-
the documentation at ``http://localhost:1234/`` in your preferred Web browser.
53+
that will serve documentation to visiting Web browsers. :program:`pydoc -p 1234`
54+
will start a HTTP server on port 1234, allowing you to browse the
55+
documentation at ``http://localhost:1234/`` in your preferred Web browser.
56+
Specifying ``0`` as the port number will select an arbitrary unused port.
57+
5658
:program:`pydoc -g` will start the server and additionally bring up a
5759
small :mod:`tkinter`\ -based graphical interface to help you search for
58-
documentation pages.
60+
documentation pages. The ``-g`` option is deprecated, since the server can
61+
now be controlled directly from HTTP clients.
62+
63+
:program:`pydoc -b` will start the server and additionally open a web
64+
browser to a module index page. Each served page has a navigation bar at the
65+
top where you can *Get* help on an individual item, *Search* all modules with a
66+
keyword in their synopsis line, and go to the *Module index*, *Topics* and
67+
*Keywords* pages.
5968

6069
When :program:`pydoc` generates documentation, it uses the current environment
6170
and path to locate modules. Thus, invoking :program:`pydoc spam`
@@ -69,3 +78,4 @@ be overridden by setting the :envvar:`PYTHONDOCS` environment variable
6978
to a different URL or to a local directory containing the Library
7079
Reference Manual pages.
7180

81+
.. versionchanged:: 3.2

Doc/whatsnew/3.2.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ New, Improved, and Deprecated Modules
566566

567567
(Contributed by R. David Murray, :issue:`10321`.)
568568

569-
570569
* The :mod:`inspect` module has a new function :func:`getgenatorstate`
571570
to easily identify the current state of a generator as one of
572571
``GEN_CREATED``, ``GEN_RUNNING``, ``GEN_SUSPENDED`` or ``GEN_CLOSED``.
@@ -583,6 +582,12 @@ New, Improved, and Deprecated Modules
583582
- non-UTF8 percent encoding of non-ASCII characters
584583
Issue 2987 for IPv6 (RFC2732) support in urlparse
585584
585+
* The :mod:`pydoc` module now provides a much improved Web server interface,
586+
as well as a new command-line option to automatically open a browser
587+
window to display that server.
588+
589+
(Contributed by Ron Adam; :issue:`2001`.)
590+
586591
Multi-threading
587592
===============
588593

0 commit comments

Comments
 (0)