I no longer maintain this software or the associated FreeBSD port (devel/py-kqueue).  Work is going on to locate a new maintainer and update the software to work with current Python versions.  Please don't email me asking to take over maintainership or offer updates, I've had plenty enough, thanks :-) 

I will update this page when the maintainership change is official.

What is PyKQueue?

PyKQueue is a Python module that provides an object-oriented interface to the FreeBSD syscalls kqueue(2) and kevent(2).

The kqueue system provides a more robust and less compute-intensive way to monitor system and file events. Instead of slinging huge arrays as needed with select(2), kevent(2) takes a list of KEvents to monitor, and keeps watching them until they're explicitly deleted -- no need to keep passing in the same objects over and over again. This methodology promotes the construction of large asynchronous frameworks, such as the one used in the asyncore Python module.

Where can I get PyKQueue?

The current version is 1.2, available at

How do I use PyKQueue?

PyKQueue provides fairly direct access to the kqueue and kevent calls, so reading the kqueue(2) and kevent(2) manpages is a must.

You will want to import all the symbols from the KQueue module to make accessing the functions easier: use 'from KQueue import *' in the beginning of your Python program.

The available constructors are:

The available methods of a KQueue are:

What if I have suggestions or improvements for PyKQueue?

Please email them to