py_cppmodel
is a Python wrapper around clang's python bindings to generate a
simple Python model of a C++ translation unit.
Currently the environment variable PY_CPPMODEL_LIBCLANG_PATH
must be defined
to specify where libclang can be found. This may be fixed in the future.
To run the tests, run:
python3 -m venv .venv # Create a Python virtual env.
source ./.venv/bin/activate # Activate the virtual env for bash by source.
mypy *.py --check-untyped-defs # Run mypy to check type hints.
unittest discover . # Run tests.
We've made considerable use of the following in putting this together:
- http://szelei.me/code-generator
- http://blog.glehmann.net/2014/12/29/Playing-with-libclang
- http://eli.thegreenplace.net/tag/llvm-clang
Design of the python bindings is taken from clang's cindex.
Mistakes are our own.