This is needlessly complicated. You can just use Cython and annotate the types, or, even better, use shedskin to compile your Python code, usually with no changes, to C++ and make a module out of it.
There are many options to speed up your Python code by ~50 times effortlessly. See my blog posts: