classification
Title: Add MANPAGER envvar to specify pager for pydoc
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, doko, jsbronder, martin.panter, merwok, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2010-05-06 15:33 by jsbronder, last changed 2016-06-14 07:05 by martin.panter. This issue is now closed.

Files
File name Uploaded Description Edit
python-2.7-pydoc-manpager.patch jsbronder, 2010-05-06 15:33
Messages (18)
msg105151 - (view) Author: Justin Bronder (jsbronder) * Date: 2010-05-06 15:33
Similar to man(1), pydoc should respect the environment variable MANPAGER over PAGER.  The current behavior causes issues when using a PAGER that does not support man pages.

Patch based off of trunk, r80871
msg105153 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-06 18:06
Similar logic can be written simpler as

use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER')
if use_pager:
  ...
(yes, I think ignoring empty *PAGER is preferable to an error)

I am not sure, pydoc should respect MANPAGER.  Why not PYDOCPAGER?

In any case this is a feature request rather than a bug.
msg105154 - (view) Author: Justin Bronder (jsbronder) * Date: 2010-05-06 18:15
I chose MANPAGER as the command line pydoc utility already clones some of the man functionality, but I'm fine with PYDOCPAGER or anything else that allows me to use pydoc without having to change PAGER first.
msg127833 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-04 00:09
Is there a standard documenting MANPAGER somewhere?
msg127836 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-02-04 00:15
On Thu, Feb 3, 2011 at 7:09 PM, Éric Araujo <report@bugs.python.org> wrote:
>
> Éric Araujo <merwok@netwok.org> added the comment:
>
> Is there a standard documenting MANPAGER somewhere?
>

Not really a standard, but man page for man on my OSX laptop says:

"""
       -P  pager
              Specify which pager to use.  This option overrides the
MANPAGER environment variable, which in turn overrides the PAGER
variable.
"""

POSIX only mandates PAGER.  See
<http://pubs.opengroup.org/onlinepubs/007908799/xcu/man.html>.

As I said before, since pydoc is not man, if we want a pydoc-specific
variable to override PAGER, it should be callled PYDOCPAGER.
msg127841 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-04 00:39
My man(1) also respects MANPAGER (it’s the one from http://man-db.nongnu.org/), but given the lack of a standard, I agree with you.

However, I’m reluctant to add another env variable.  There are workarounds, for example using a shell alias like “docpy="PAGER=most pydoc"”.  I think this warrants a python-ideas discussion.

Justin: what exactly is a pager that does not support man pages?
msg127843 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-02-04 00:51
On Thu, Feb 3, 2011 at 7:39 PM, Éric Araujo <report@bugs.python.org> wrote:
..
> Justin: what exactly is a pager that does not support man pages?

I may know the answer to this one.  A common PAGER setting is "less
-rs" which makes less skip whitespace lines and passes through
terminal control chars.  Nether of these options are needed for pydoc,
but I don't know if they cause any harm.
msg128122 - (view) Author: Justin Bronder (jsbronder) * Date: 2011-02-07 15:24
On Thu, Feb 3, 2011 at 7:39 PM, Éric Araujo <report@bugs.python.org> wrote:
..
> Justin: what exactly is a pager that does not support man pages?

vimpager is the one I'm using.  For man pages there's vimmanpager.
msg128123 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-07 15:27
Excuse me if I was unclear: I wasn’t asking for program names but for a definition of “don’t support” or description of problematic behavior.
msg128124 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-07 15:31
Reusing MANPAGER is practical. Yet another PY* environment variable doesn't seem warranted in this case.
Agreed with Alexander's simpler logic proposal in msg105153.
msg128126 - (view) Author: Justin Bronder (jsbronder) * Date: 2011-02-07 15:35
> Éric Araujo <merwok@netwok.org> added the comment:
> 
> Excuse me if I was unclear: I wasn’t asking for program names but for a definition of “don’t support” or description of problematic behavior.

In headers with vimpager ^H is not rendered(?) correctly.

For instance, 'pydoc os' shows:

---
Help on module os:

N^HNA^HAM^HME^HE

F^HFI^HIL^HLE^HE
    /usr/lib/python2.6/os.py

---

And so on.
msg268525 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-06-14 06:38
adding MANPAGER, with the simpler logic.
msg268526 - (view) Author: Roundup Robot (python-dev) Date: 2016-06-14 06:39
New changeset 820d21c97d66 by doko in branch 'default':
- Issue #8637: Honor a pager set by the env var MANPAGER (in preference to
https://hg.python.org/cpython/rev/820d21c97d66
msg268527 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-06-14 06:40
fixed for 3.6.0a3
msg268529 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-14 06:55
Matthias: your change causes pydoc to raise KeyError if I set MANPAGER but not PAGER. I’m guessing you intended something else?
msg268532 - (view) Author: Roundup Robot (python-dev) Date: 2016-06-14 07:04
New changeset dea9f9b5582b by doko in branch 'default':
- Issue #8637: Honor a pager set by the env var MANPAGER (in preference to
https://hg.python.org/cpython/rev/dea9f9b5582b
msg268533 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-06-14 07:04
sorry, updated.
msg268534 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-14 07:05
Thanks, that version looks more sensible
History
Date User Action Args
2016-06-14 07:05:47martin.pantersetmessages: + msg268534
2016-06-14 07:04:33dokosetmessages: + msg268533
2016-06-14 07:04:05python-devsetmessages: + msg268532
2016-06-14 06:55:45martin.pantersetnosy: + martin.panter

messages: + msg268529
versions: + Python 3.6, - Python 3.3
2016-06-14 06:40:45dokosetstatus: open -> closed
resolution: fixed
messages: + msg268527
2016-06-14 06:39:46python-devsetnosy: + python-dev
messages: + msg268526
2016-06-14 06:38:59dokosetnosy: + doko

messages: + msg268525
title: Add PYDOCPAGER envvar to specify pager for pydoc -> Add MANPAGER envvar to specify pager for pydoc
2011-02-07 15:35:06jsbrondersetnosy: belopolsky, pitrou, merwok, jsbronder
messages: + msg128126
2011-02-07 15:31:51pitrousetnosy: + pitrou
messages: + msg128124
2011-02-07 15:27:12merwoksetnosy: belopolsky, merwok, jsbronder
messages: + msg128123
2011-02-07 15:24:35jsbrondersetnosy: belopolsky, merwok, jsbronder
messages: + msg128122
2011-02-04 00:51:48belopolskysetnosy: belopolsky, merwok, jsbronder
messages: + msg127843
2011-02-04 00:39:31merwoksetnosy: belopolsky, merwok, jsbronder
title: pydoc should respect MANPAGER over PAGER. -> Add PYDOCPAGER envvar to specify pager for pydoc
messages: + msg127841
stage: test needed ->
2011-02-04 00:15:37belopolskysetnosy: belopolsky, merwok, jsbronder
messages: + msg127836
2011-02-04 00:09:28merwoksetnosy: + merwok

messages: + msg127833
versions: + Python 3.3, - Python 2.7
2010-05-06 18:15:59jsbrondersetmessages: + msg105154
2010-05-06 18:06:09belopolskysettype: behavior -> enhancement

messages: + msg105153
nosy: + belopolsky
2010-05-06 15:39:12brian.curtinsettitle: [PATCH] pydoc should respect MANPAGER over PAGER. -> pydoc should respect MANPAGER over PAGER.
stage: test needed
2010-05-06 15:33:45jsbrondercreate