Phatch is written in Python and ships with an api so it can also be used as a library. In that sense it is a shell around the Python Imaging Library on which it is based.
from phatch.core import api
settings = api.create_settings()
actionlist = api.open_actionlist('filename.phatch')