Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MANPAGER envvar to specify pager for pydoc #52883

Closed
jsbronder mannequin opened this issue May 6, 2010 · 18 comments
Closed

Add MANPAGER envvar to specify pager for pydoc #52883

jsbronder mannequin opened this issue May 6, 2010 · 18 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@jsbronder
Copy link
Mannequin

jsbronder mannequin commented May 6, 2010

BPO 8637
Nosy @doko42, @abalkin, @pitrou, @merwok, @jsbronder, @vadmium
Files
  • python-2.7-pydoc-manpager.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-06-14.06:40:45.065>
    created_at = <Date 2010-05-06.15:33:44.967>
    labels = ['type-feature', 'library']
    title = 'Add MANPAGER envvar to specify pager for pydoc'
    updated_at = <Date 2016-06-14.07:05:47.009>
    user = 'https://github.com/jsbronder'

    bugs.python.org fields:

    activity = <Date 2016-06-14.07:05:47.009>
    actor = 'martin.panter'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-06-14.06:40:45.065>
    closer = 'doko'
    components = ['Library (Lib)']
    creation = <Date 2010-05-06.15:33:44.967>
    creator = 'jsbronder'
    dependencies = []
    files = ['17238']
    hgrepos = []
    issue_num = 8637
    keywords = ['patch']
    message_count = 18.0
    messages = ['105151', '105153', '105154', '127833', '127836', '127841', '127843', '128122', '128123', '128124', '128126', '268525', '268526', '268527', '268529', '268532', '268533', '268534']
    nosy_count = 7.0
    nosy_names = ['doko', 'belopolsky', 'pitrou', 'eric.araujo', 'jsbronder', 'python-dev', 'martin.panter']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue8637'
    versions = ['Python 3.6']

    @jsbronder
    Copy link
    Mannequin Author

    jsbronder mannequin commented May 6, 2010

    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

    @jsbronder jsbronder mannequin added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir labels May 6, 2010
    @briancurtin briancurtin changed the title [PATCH] pydoc should respect MANPAGER over PAGER. pydoc should respect MANPAGER over PAGER. May 6, 2010
    @abalkin
    Copy link
    Member

    abalkin commented May 6, 2010

    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.

    @abalkin abalkin added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels May 6, 2010
    @jsbronder
    Copy link
    Mannequin Author

    jsbronder mannequin commented May 6, 2010

    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.

    @merwok
    Copy link
    Member

    merwok commented Feb 4, 2011

    Is there a standard documenting MANPAGER somewhere?

    @abalkin
    Copy link
    Member

    abalkin commented Feb 4, 2011

    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.

    @merwok
    Copy link
    Member

    merwok commented Feb 4, 2011

    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?

    @merwok merwok changed the title pydoc should respect MANPAGER over PAGER. Add PYDOCPAGER envvar to specify pager for pydoc Feb 4, 2011
    @abalkin
    Copy link
    Member

    abalkin commented Feb 4, 2011

    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.

    @jsbronder
    Copy link
    Mannequin Author

    jsbronder mannequin commented Feb 7, 2011

    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.

    @merwok
    Copy link
    Member

    merwok commented Feb 7, 2011

    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.

    @pitrou
    Copy link
    Member

    pitrou commented Feb 7, 2011

    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.

    @jsbronder
    Copy link
    Mannequin Author

    jsbronder mannequin commented Feb 7, 2011

    É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.

    @doko42
    Copy link
    Member

    doko42 commented Jun 14, 2016

    adding MANPAGER, with the simpler logic.

    @doko42 doko42 changed the title Add PYDOCPAGER envvar to specify pager for pydoc Add MANPAGER envvar to specify pager for pydoc Jun 14, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 14, 2016

    New changeset 820d21c97d66 by doko in branch 'default':

    @doko42
    Copy link
    Member

    doko42 commented Jun 14, 2016

    fixed for 3.6.0a3

    @doko42 doko42 closed this as completed Jun 14, 2016
    @vadmium
    Copy link
    Member

    vadmium commented Jun 14, 2016

    Matthias: your change causes pydoc to raise KeyError if I set MANPAGER but not PAGER. I’m guessing you intended something else?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 14, 2016

    New changeset dea9f9b5582b by doko in branch 'default':

    @doko42
    Copy link
    Member

    doko42 commented Jun 14, 2016

    sorry, updated.

    @vadmium
    Copy link
    Member

    vadmium commented Jun 14, 2016

    Thanks, that version looks more sensible

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants