Skip to content
Automagically call nanomsg from Python with 2 lines of D code
Makefile Python Shell Dockerfile D
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker
source
tests
.gitignore
Makefile
README.md
dub.sdl
dub.selections.json

README.md

Call nanomsg from Python using D as the glue layer

This repository is an example of using D's powerful metaprogramming features to enable calling C code from Python without having to write any code at all.

To package all needed dependencies to build and run the example, there is a Dockerfile but the container doesn't need to be manually built. Just:

  • Run docker/docker-run.sh. This will build the Docker container and run bash within it.
  • Run make as soon as you get a bash prompt in the container. This will build a Python extension then run Python tests that call into the nanomsg C library.

That's it. The user code that enables the magic seen in that Python file is 4 lines in two files.

The library code that enables it is in two dub packages: autowrap and dpp.

You can’t perform that action at this time.