Skip to main content

Python integration of the 'nuklear' C library.

Project description

A semi-automatic Python binding for the nuklear C library.

The core of this is a python program that parses the nuklear.h header for declarations and passes this to the ‘cffi’ Python binding generator.

Declarations are extracted using a C preprocessor followed by some simple ad hoc text transformations. The ‘pcpp’ preprocessor is used. This is a C preprocessor written in Python, so the preprocessing step doesn’t actually require a C compiler to be installed.

However, the process of generating the Python binding requires a C compiler.

Some code for interfacing nuklear with pygame is provided under pynk.nkpygame.


See The gist of it is to call the nuklear API via the ffi and lib objects imported from pynk - this is provided by the cffi library. Some code for interfacing with pygame is provided.


The package on pypi should work:


python2 install

in the git repository should do it.


  • cffi, a Python library.
  • pcpp, a C preprocessor written in Python.

As such you will need a C compiler installed if you want to build the library.

Note that at present the pcpp in pypi won’t cut it, because in order to preprocess nuklear.h we rely on a fix that has not (as of writing) yet been integrated. You will have to install the one in my github fork.

For the pygame integration code, pygame is necessary, but it’s not a requirement for installation or to use the binding.

How to do a release

The following script will increment the version, commit the change and push a tag. The Travis build will then deploy a new version.

python ./bin/ (--major|--minor|--patch)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pynk, version 0.4.7
Filename, size File type Python version Upload date Hashes
Filename, size pynk-0.4.7-py2.7-linux-x86_64.egg (886.2 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size pynk-0.4.7.tar.gz (187.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page