How to search help using python console

前端 未结 10 1318
长发绾君心
长发绾君心 2021-02-08 20:25

Is there any way to search for a particular package/function using keywords in the Python console?

For example, I may want to search \"pdf\" for pdf related tasks.

10条回答
  •  心在旅途
    2021-02-08 20:44

    (Years later) I now use pip search
    and yolk -M or -H packagename: -M for metadata, -H to browse to its web page .


    To search PyPI (Python Package Index) package info locally, try pypi-grep. An example: pypi-grep 'pyqt' -->

    # day  status  packagename  version  homepage  summary
    2009-06-07  3  "pydee"  0.4.11  http://code.google.com/p/pydee/
        Pydee development environment and its PyQt4-based IDE tools: ...
    2009-06-05  4  "Sandbox"  0.9.5  http://www.qtrac.eu/sandbox.html
        A PyQt4-based alternative to IDLE
    ...
    

    pypi-grep is just a file with one long line per PyPI package, with the info you see above, plus a trivial bash script to egrep the file.
    Why ? Grepping a local file is very fast and very simple, for old Unix guys and simple searches: "what's XYZ ?"

    hg clone http://bitbucket.org/denisb/pypi-grep/ should download pypi-grep and pypi-grepfile-2009-06-08 or the like; move them to a directory in your PATH. (First easy_install hg if you don't have hg.)

    Notes:

    the pypi-grepfile has only one version per package, the newest; multiline summaries are folded to one long line (which I chop with pypi-grep | less -iS).

    pypi-grep -h lists a few options

    The data comes from http://pypi.python.org/pypi xmlrpc, but beware: some packages in list_packages have no package_releases or no releasedata, and a few releasedatas timeout (timeout_xmlrpclib); what you see is All you get.

    Feedback is welcome.

提交回复
热议问题