A how-to to help Zwiki code developers get started. Add examples and instructions here.

Working with git

Zwiki code is kept on github like many other FOSS projects. As usual you can fork it or clone it with eg

git clone https://github.com/simonmichael/ZWiki.git

You can jump to the github project by typing code.zwiki.org into a web browser. CodeRepos has more details about past and present code repositories.

Why you want a better editor/IDE

You can do useful Zwiki development with nothing more than a simple text editor - go right ahead. Still, Zwiki's (and Zope's!) codebase is large enough that good tools can make a big difference. Setting up a more powerful development environment may reduce suffering, increase satisfaction and make you more productive.

  • You will be able to see the big picture far more clearly
  • you will be able to debug many small and large mysteries that would otherwise be a roadblock
  • you will be more productive.

Here are some tools which can help.

Wing IDE

Very complete, stable and polished. Code navigation, documentation and debugging features are better than everybody else. Source assistant and auto-completion help with code comprehension. You can attach the debugger to a running zope server, set breakpoints anywhere, automatically break on exceptions etc. Non-free software, otherwise very highly recommended. $179 for the pro version, $35 for the less featureful personal version. See http://zopewiki.org/WingIDE .

Emacs

The most flexible general-purpose programmer's editor & toolbox; works everywhere; fast. You can jump around the code with tags; do fast whole-project search and replace; and debug with source display. See various how-tos here and on http://zopewiki.org . Highly recommended.

Vim

Emacs alternative. Use ptags.py to generate tags, so you can jump around the source code with ^} and ^T.

Boa Constructor

Some of the same useful features as Wing, but slower and harder. Also makes UML diagrams and generates HTML API docs. Free.

Leo

A highly scriptable outliner geared for programmers. You can organize classes, methods, notes etc. in an outline that's clearer and less repetitive, without altering the underlying source files much. Install from http://leo.sourceforge.net , check out the ZWiki-leo branch from CodeRepos, and open zwiki.leo to get a more organized view of the Zwiki code. It's a little too intrusive for our main repo at the moment, but feel free to work in that branch.

Eclipse ? Other python ides ?

No real experience with these.

Testing

Code tests

After making some changes, doing a syntax check is fast and can often save a lot of time. Some of the tools above will do this for you. Or, just do 'python ChangedFile?.py'. Expect some kind of Zope import error - you'll get to know what these look like - but if you have introduced syntax errors you'll see them instead.

Unit tests

Install Zope 2.9.1 or greater, to get the testrunner that comes with it. In the ZWiki directory, 'make test' to run all product tests. If you need to run with different arguments, copy the command line it prints and adapt it. The more often you run these, the quicker you'll catch your breakages and the better you'll feel.

Zope test server

For testing non-trivial changes and for general exploration, you'll probably want to run a zope server of your own, on your local development machine, where you can - stop and start at will - run in debug mode - turn on verbose security reporting - add and remove products - turn on product auto-refresh - insert breakpoints/prints/logs in product or zope code - run wing/boa debug servers etc. There's probably no need to run ZEO. Clone the ZWiki repo directly into the Products directory, or symlink it there, so zope will run your latest code. Fewer products will mean faster restarts.

ZEO debug client

For testing changes and fixing bugs on your production server, use a ZEO debug client with your production ZODB.