1 Writing examples {#write_examples}
4 Writing examples is a very important part of being an IMP developer and
5 one of the best ways to help people use your code. To write a (Python)
6 example, create a file `myexample.py` in the example directory of an
7 appropriate module. The first few lines of the script should
8 should provide a brief overview of what the code in the module is
9 trying to accomplish as well as key pieces of IMP functionality that
10 it uses. (This is a comment parsed by Doxygen, so should start with
11 the `\example` command.)
13 \note Examples are run by the build system in the same way as unit tests, and so
14 should run to completion in *under 2 minutes*. If your example takes longer
15 than this, it is not a very good example! (For one, users will tire of waiting
16 for it to finish.) The build system passes each example the `--run_quick_test`
17 argument, so this can be used to run a faster subset (e.g. fewer iterations
18 of an optimization). If you are trying to demonstrate the application of your
19 method to a real biological system, you should write a
20 [biological system](http:
23 The example should have enough comments that the reasoning behind each line of code is clear to someone who roughly understands how IMP in general works.
25 Examples must use methods like IMP::get_example_path() to access
26 data in the example directory. This allows them to be run from
27 anywhere (when they are run by `ctest` the working directory is *not* the
28 directory the example is in).