User Tools

Site Tools


dev:python

This is an old revision of the document!


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-test. 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 script should 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:

dev/python.1457699604.txt.gz · Last modified: 2020/08/21 10:14 (external edit)