Giter Site home page Giter Site logo

pybind11-code-generator's Introduction

Pybind11 (partial) code generator

This is an attempt for a simple code generator to generate python binding for C++ libraries using Pybind11.

It is completely based on the ideas and code presented in the excelent article implementing a code generator with libclang, Source Code.

It is absolutely not complete or well tested and probably contains mistakes. However it uses Clang for introspection and written in Python (3) so it can be easily understood, extended and adjusted. It therefore might be useful for somebody at some point in time. For occasional use it should be suitable for generating a basic code that will be further edited and adjusted (It basically just saves some annoying typing).

Usage:

Given a header file the generator will use clang to build the object model of the elements defined in the file and generate a function that will bind the functions, enumerations and classes that are defined in the file. It will not generate the code to generate the module itself (i.e. will not generate 'example.cpp').

The code is shared as a Jupyter Notebook so the user can play around with the code interactively.

To notebook will allow you to generate the binding code, (section 1-3), build the module (section 4), and test it (section 5).

Dependencies:

  • libclang-py3 (libclang python binding)
  • mako (for working with code templates)
  • asciitree (for presenting the AST)

pybind11-code-generator's People

Contributors

psidium avatar sztomi avatar

Stargazers

Ivo Ivanov avatar Bjorn avatar Ellis Breen avatar

Watchers

James Cloos avatar Ran Rubin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.