1

The question is in the title. As a use case one can imagine the situation about finding function basing on its known functionality.

I already know about Zeal which is packaged. It downloads documentation sets from Dash project. This is great but the Python versions differ from installed on system. They are usually newer.

The DevHelp application do not know about Python libraries. The search on pydoc3 -p 8080 does not work as expected. KHelpCenter does not know about Python. The doc-central package seems to be broken for long time. dochelp shows only index from /usr/share/doc-help and does not provide full-text search.

What else should I try to have ability for reading and searching Python documentation offline from /usr/share/doc (and similar locations)?
My system reports that I have 467 folders there (ls -1d /usr/share/doc/*python* | wc -l).

2 Answers 2

3

If you're talking about the documentation for Python itself (installable from the python3-doc package which depends on the actual system Python version's doc package), then you can just run a web server from /usr/share/doc/python3/html (e.g., using python3 -m http.server). The Python docs use Sphinx, which supports client-side searching.

Example using 18.04:

  • The index page:

    The sidebar links are mostly external.

  • The reference section:

  • Searching:

5
  • Great, but what about all python libraries in folders like /usr/share/doc/python3-* ? And search for all functions in for example SciPy, NumPy and so on...
    – N0rbert
    Apr 25, 2021 at 12:11
  • Depends on what formats those are in. Sphinx-based documentation is pretty common in Python, but of course it's not mandated.
    – muru
    Apr 25, 2021 at 12:15
  • NumPy's docs also use Sphinx, so you can do the same from /usr/share/doc/python-numpy-doc/html/. The same is true for SciPy too, I think.
    – muru
    Apr 25, 2021 at 12:17
  • What is interesting is that only 15 of installed libraries ship html-based help (this number is from find /usr/share/doc/*python* -type f -name *.html | awk -F/ '{print $5}' | sort -u | wc -l). My main need is global user-friendly search from the single interface.
    – N0rbert
    Apr 25, 2021 at 12:18
  • For that, all I can say is good luck. If it were a language like Go, there might be some hope, since Go has a standard method for documentation. But there's no such standard in Python, and even in the case of Sphinx, I don't think it's possible to merge already built documentation indexes.
    – muru
    Apr 25, 2021 at 12:26
1

I have created Bash shell script for searching locally installed Python documentation on Debian-based systems (such as Ubuntu) and placed it at GitHub.

This script allows one to run first preliminary full-text search to get Python package name and way to read the relevant documentation in the HTML-format.

It uses aptitude for Python package selection, html2text and/or pandoc packages to run the conversion from HTML to plain-text to get better search results.

The script shows found local HTML documents in default web-browser and provides information about further methods of documentation reading - via DevHelp, DocHelp or web-browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.