Python Forum

Full Version: how to suppress not to display the package contents from pydoc!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

Below is my sample code, where I do not want to display the PACKAGE CONTENTS section (means I wanted to suppress this, as not to display it) while issuing the command as pydoc3 -w mymodule

NAME
    whatever - This is whatever help info.

FILE
    /home/el/whatever/__init__.py

DESCRIPTION
    This is whatever description

    EXAMPLES:
        ...

PACKAGE CONTENTS
    nothing (package)
    something

DATA
    __version__ = '1.0'
    variable = 'variable'

VERSION
    1.0
any suggestion on this? thanks a lot.
Regards,
maiya
what you are showing is not sample code.
It looks more like a document header.
Please post your code.
(Mar-18-2021, 10:19 AM)Larz60+ Wrote: [ -> ]what you are showing is not sample code.
It looks more like a document header.
Please post your code.

Quote:No Sir, actually when I issue pydoc3 -w mymodule
where in the document PACKAGE CONTENTS section also display, but I do not want pydoc3 to display the PACKAGE CONTENTS section. So suppress this section.
Is there any command to do so? or in my code possible to do so? or in pydoc code is possible to do so? or it is pydoc feature and we cannot do anything with this pydoc feature.?
Looks like pydoc simply sees if the module has a __path__ attribute. If it does, it creates the section and adds all the objects inside to the section. So I assume you have a multi-file module? Are you using a __init__.py file?

Maybe if you had one you could try deleting the path variable if it thought that pydoc was being run. That doesn't seem very safe, but it might work. Something like:

import sys
if "pydoc" in sys.argv[0]:
    del __path__