Enums implementation in Python requires a enum support as described in PEP-0435. This support is available out of the box in standard libraries since Python v3.4, or since v2.4 using enum34 PyPi compatibility layer.

  • On Debian / Ubuntu, this library can be installed with sudo apt-get install python-enum34

  • Otherwise, one can use just sudo pip install enum34

setuptools extension

Setuptools is the de-facto standard way of building and installing python packages. This library allows extension with plugins. have developed an extension to setuptools, allowing you to automate compilation of *.ksy files as the part of python module build process. The library provides a mostly declarative syntax to facilitate installation: you add a parameter kaitai to your where you enumerate files that you want compiled, output directory, compilation flags, and source code post-compilation transformations. Here are some examples: 1, 2.

Here are the docs in JSON Schema format.

Please remember that this lib is VERY UNSTABLE and very likely to be improved in a way that changes API (but due to API simplicity it’d be easy to fix your code), but I guess it’s much better to use this than to reinvent the wheel. Contributions are welcome!

Please note that this lib is NOT available on pypi and if you want to install it automatically, you should add git+ into dependency_links in the config passed to setuptools.setup.