Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

The interface files are the heart of Pyste. The user creates one or more interface files declaring the classes and functions he wants to export, and then invokes Pyste passing the interface files to it. Pyste then generates a single cpp file with Boost.Python code, with all the classes and functions exported.

Besides declaring the classes and functions, the user has a number of other options, like renaming e excluding classes and member functionis. Those are explained later on.


Suppose we have a class and some functions that we want to expose to Python declared in the header hello.h:

    struct World
        World(std::string msg): msg(msg) {} 
        void set(std::string msg) { this->msg = msg; }
        std::string greet() { return msg; }
        std::string msg;

    enum choice { red, blue };
    namespace test {
    void show(choice c) { std::cout << "value: " << (int)c << std::endl; }

We create a file named hello.pyste and create instances of the classes Function, Class and Enum:

    Function("test::show", "hello.h")
    Class("World", "hello.h")
    Enum("choice", "hello.h")

That will expose the class, the free function and the enum found in hello.h.


Pyste automatically generates the correct code (specifying bases<> in the class_ declaration) if the Class() function that exports the base classes and their children are in the same Pyste file. If that's not the case, you have to indicate that there's a relationship between the Pyste files using the Import function specifying the other Pyste file.

Suppose we have two classes, A and B, and A is a base class for B. We create two Pyste files:


    Class("A", "A.h")


    Class("B", "B.h")

Note that we specify that B needs to know about A to be properly exported.