You are not logged in Log in Join
You are here: Home » Members » Alexandre Fernandez » How to use epydoc with Zope 2.7

Log in
Name

Password

 

How to use epydoc with Zope 2.7

 

Created by lunatik . Last modified 2004-06-02 15:27:43.

This howto describe how to extract docstring documentation with epydoc wiht Zope 2.7 and epydoc 2.1 in a linux box.

What you need:

  • Epydoc 2.1 or greater

    Source

    or urpmi epydoc.

    or apt-get install epydoc.

  • a Zope 2.7 instance
  • Your docstrings not empty.

What you have to do:

  • Create this script do_api.py:

#!/usr/bin/env python
CONFIG_FILE_NAME = /.../my_instance/etc/zope.conf

import sys, os.path, re, getopt import epydoc

import Zope.Startup import Zope.Startup.run from Zope.Startup import ZopeStarter from Zope.Startup.run import _setconfig

cfg = _setconfig(CONFIG_FILE_NAME) starter = ZopeStarter(cfg.configroot) starter.setupLocale() starter.setupSecurityOptions() starter.setupZServerThreads() starter.setupServers() starter.dropPrivileges() starter.makeLockFile() starter.makePidFile() starter.startZope()

from epydoc.cli import cli cli()

  • Make it executable

chomod +x do_api.py

Where CONFIG_FILE_NAME is the filename and path of your zope configuration file Change this value

  • Modify your PYTHONPATH as bin/runzope value

    PYTHONPATH have to point to /.../Zope-2.7-base/lib/python/

  • include site-package of your python distribution in your PYTHONPATH
  • Call the script you made with corrects values.

    cd /.../my_instance
    /.../do_api.py --html Products/CMFCore

  • Wait and see.
  • Browse and share your api :-)
Comment

Discussion icon feedback

Posted by: simon at 2004-09-22

Thanks for the how-to. CONFIG_FILE_NAME needs quotes in the script. I got this far, any ideas ?:

 export PYTHONPATH=/zope/lib/python; \
  cd /zope1; epydoc-zope --output /var/www/zopewiki.org/epydoc --html /zope1/Products/ZWiki
 Traceback (most recent call last):
  File "/usr/local/bin/epydoc-zope", line 17, in ?
    starter.setupServers()
  File "/usr/local/src/Zope-2.7.2-0/lib/python/Zope/Startup/__init__.py", line 198, in setupServers
    raise ZConfig.ConfigurationError(socket_err
ZConfig.ConfigurationError: There was a problem starting a server of type "HTTPServer". This may mean that your user does not have permission to bind to the port which the server is trying to use or the port may already be in use by another application. (Address already in use)

Comment

Discussion icon You don't need all that - use zopectl!

Posted by: slinkp at 2005-06-09

bin/zopectl already provides all that startup stuff. So you can write a much smaller script:

 #!/usr/bin/env python2
 """
 epydoc_zope.py
 """

 from epydoc.cli import cli
 cli()

Now run this script from an instance home like so:

./bin/zopectl run epydoc_zope.py --html Products/FooProduct Products/BarProduct ...

Presto, your docs are in $INSTANCE_HOME/html.