Pyd

Pyd is a library for the D programming language that wraps the raw Python/C API with a cleaner, simpler interface. It makes exposing raw D functions and classes to Python almost trivially simple. It bears certain similarities to Boost.Python, and indeed Boost.Python is a major influence on Pyd. Pyd was written by Kirk McDonald.

Pyd also comes with its own extension to Python's distutils, called CeleriD, making the building of extension modules quite easy. CeleriD was originally written by David Rushby and is currently maintained by Kirk McDonald.

Pyd includes the meta.Nameof package by Don Clugston. The source files meta.Nameof and meta.Demangle are copyright © 2005-2006 Don Clugston.

Pyd's Trac page can be found here.

A simple "hello, world" module might look like this:

import pyd.pyd;
import std.stdio;

void hello_func() {
    writefln("Hello, world!");
}

extern (C) void PydMain() {
    def!(hello_func);
    module_init();
}

When compiled, the module can be loaded and used from Python like any other module:

>>> import testdll
>>> testdll.hello_func()
Hello, world!