Quick redirects to Python documentation.
pydoc.me is a fairly straight-forward Flask app, with routes with
routes declared in pymod/routes.py (preliminary
pymod.me, might change the package dir some day).
The actual work is two-part: 1) pymod/index.py handles indexing of the https://docs.python.org site (mostly via the requests and BeautifulSoup libraries). And 2) pymod/mappings.py looks up names and the URLs to redirect to.
Indexing creates a 'modules cache' file
pymod/modules.dat (generated, so it's not visible
in the repo). The cache file must be generated locally and is included
in the distribution package via standard
setuptools mechanics, as
can be seen in the MANIFEST.in and the
When running with a module index cache, names are fetched using the
url() function in the pymod/mappings.py
url() function first checks a few special embedded
structures representing built-in symbols, then looks for the search
term in the modules cache. Certain modules are considered 'priority'
and functions in them do not need to be prepended by their module name
pdb). I have simply chosen modules
that I use more often and that I subjectively consider more central.
I can't yet guarantee complete portability from machine to machine for
pydoc.me. If interest grows, I'll add it. Since it's
not overly complex, you could probably do it, though - you need GNU
Make, Python 3 and a recent version of
virtualenv. Have a look at the
pydoc.me at WebFaction, so obviously I would have to
deploy new versions, though ;-). But you can probably have it running
locally without too much trouble.