question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `pydoc` command

See original GitHub issue

The standard library has a module pydoc which can be used for generating and viewing documentation. I suggest a command such as [prefix] pydoc <NAME> which calls pydoc.doc with the given name to show instant documentation. I feel like this could be useful when referring to a certain method when helping someone - here’s an example with str.find:

>>> import io
>>> import pydoc
>>> out = io.StringIO()
>>> pydoc.doc('str.find', output=out)
>>> print(out.getvalue())
Python Library Documentation: method_descriptor in str

str.find = find(...)
    S.find(sub[, start[, end]]) -> int
    
    Return the lowest index in S where substring sub is found,
    such that sub is contained within S[start:end].  Optional
    arguments start and end are interpreted as in slice notation.
    
    Return -1 on failure.

for “bigger” documentation such as help(dict), this generates quite the long output. It might be a good idea to truncate this or put it into a “pageable embed” (with reactions to move around). Also, I’ve yet to figure out if it’s somehow possible to include a link to the official docs…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
gdude2002commented, Feb 23, 2018

No, I think the versatility would serve us well - the command will be a lot more useful if we can expand it out that way.

And it’s a great idea to not pollute your environment with packages.

3reactions
jb3commented, Feb 23, 2018

It’s not important that only installed modules work, we can add modules in high demand. The majority of questions asked in our guild can normally be answered with python built-in functions. I’d say pydocs is fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get pydoc command working in Windows?
Remember to access pydoc in windows, it's python -m pydoc. If you want to access info on "file", add the word "file" after....
Read more >
pydoc — Documentation generator and online help system ...
The pydoc module automatically generates documentation from Python modules. The documentation can be presented as pages of text on the console, served to...
Read more >
Documentation generation using the pydoc module in Python
The pydoc module automatically generates documentation from Python modules. The documentation can be saved as pages of text on the console, ...
Read more >
Learn How to View Python Documentation Using Pydoc
pydoc - the Python documentation tool pydoc <name> ... Show text documentation on something. <name> may be the name of ...
Read more >
Python Docstrings Tutorial : Examples & Format for Pydoc ...
pydoc - the Python documentation tool pydoc <name> ... Show text documentation on something. <name> may be the name of a Python keyword,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found