Python

Python is the preferred scripting language of the CP2K project.

Self-Testing

All python scripts should support self-testing. This means that the script can be invoked with --selftest as its sole argument.

Ideally, a script's self-test consists of an exhaustive suite of unit-tests. At the very least, it should not crash or break anything. Even an empty self-test will still reveal syntax and import errors, which are the most common Python 3 compatibility issues.

Once per night all Python executable are self-tested automatically.

Language Versions

All scripts should work with Python 2.7 or later. In particular the scripts should be future-proof and also work with Python 3.x . Additionally, a small set of essential scripts should work with Python 2.4 as well. Essential scripts are those required for building CP2K plus prettify.py and instantiateTemplates.py.

For more information on how to achieve Python 2+3 compatibility see: