Pydoc
Pydoc is awesome; I don’t know how I missed it for so long. Simply type the following at the command line:
pydoc -p 8888
Then point a browser at http://localhost:8888/ to browse interactive documentation for every Python module available on your system. This includes moduldes installed in your site-packages directory. If you keep code you’ve written yourself in site-packages you’ll be able to browse the documentation for that too. If you’re even remotely consistent about writing docstrings you’ll be amazed at how useful the resulting documentation is. I can’t believe I only just discovered this!
Wow, that is amazing... I can't believe I'd never heard of it before either!
One additional note - since the current directory is always in your python path, if the directory you're in when you run pydoc contains modules or packages, you'll get the documentation for them too.
Abe - 23rd March 2004 23:14 - #
Yep, it's cool. I have it start in my "~/.kde/Autostart" as "pydoc.sh":
Adding the additional PYTHONPATH entry means that my in-development Roundup code is also added to the pydoc pages.
Richard - 23rd March 2004 23:55 - #
anders - 24th March 2004 06:44 - #
Carey Evans - 24th March 2004 06:48 - #
Python is a huge amount of fun to work with. It's like one of the countless goth chicks (pardon my German) on OKCupid.com: at first, they look pretty scary, but then you realize they're really kinky and do things you didn't know were possible, making you a much happier person.
Actually, let's not go there.
Hendrik Mans - 24th March 2004 09:41 - #
http://www.python.org/doc/current/lib/module-docte st.html
duncan - 24th March 2004 15:28 - #
Hmmph. I like the idea of docs being testable (and therefore closer to reality), but wouldn't the syntax guessing be brittle? And wouldn't you end up re-developing an xUnit framework to address problems like mocks and stateful tests?
Worth thinking about, though.
Jeremy Dunck - 24th March 2004 15:38 - #
Wow, I never cease to be amazed by python.
For those windows users out there you may have to be more specific.
From the DOS prompt type:
python.exe pydoc.py -p 8888If that still doesn't work include the full path to both python.exe and/or pydoc.py and you should be set.
waylman - 24th March 2004 21:19 - #
Ewald van Houte - 25th March 2004 14:03 - #
Unrelated to this entry, but I noticed that under IE6, there's a JavaScript error occurring.
Line 3, Expected ')'.
I took the time to look at what's causing it.
You're including Technorati's script in the head section. The problem is that it embeds the site's name in the alt attribute of the technorati image-- and the single quote in your site name is breaking the javascript string.
Technorati needs to escape the value in it's alt attribute. "Simon Willison\'s Weblog", not "Simon Willison's Weblog". Shorter-term, you might avoid the error by changing the site name in Technorati.
I figured you'd have better luck getting Technorati to do their tweak.
Jeremy Dunck - 25th March 2004 22:39 - #
pydoc:<module>in the location bar. It's one of those features in Konqueror that deserves to get a lot more publicity. ;-)David Boddie - 5th April 2004 11:31 - #
It's smart too. If you have multiple versions of python installed:
$ which pydoc
/usr/bin/pydoc
$ python2.1 /usr/bin/pydoc -p 8881 &
[1] 10852
$ pydoc server ready at http://localhost:8881/
$ python2.2 /usr/bin/pydoc -p 8882 &
[2] 10864
$ pydoc server ready at http://localhost:8882/
$ python2.3 /usr/bin/pydoc -p 8883 &
[3] 10865
$ pydoc server ready at http://localhost:8883/
Peter van Kampen - 5th April 2004 17:24 - #
Manuzhai - 29th September 2004 16:39 - #
Since the pydoc module is in the module search path, you don't have to specify its location; you can specify it as a module to be imported.
Ben Finney - 5th August 2005 03:02 - #
Clive - 9th September 2005 02:23 - #