Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dev-cafe/context-api-example

Shows how to implement context-aware APIs in different languages.
https://github.com/dev-cafe/context-api-example

api c cffi cmake context cpp fortran

Last synced: 3 months ago
JSON representation

Shows how to implement context-aware APIs in different languages.

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/bast/context-api-example.svg?branch=master)](https://travis-ci.org/bast/context-api-example/builds)
[![License](https://img.shields.io/badge/license-%20MPL--v2.0-blue.svg)](../master/LICENSE)

# context-api-example

Shows how to implement and use context-aware APIs in C++, Fortran, and Python.
Inspired by Armin Ronacher's
["Beautiful Native Libraries"](http://lucumr.pocoo.org/2013/8/18/beautiful-native-libraries/).

Comments, contributions, and improvements are most welcome!

## How to build and run this demo

### Install Python dependencies

```shell
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
```

### Configure and build the compiled code

```shell
$ mkdir build
$ cd build
$ cmake ..
$ make
```

### Test the C++/Fortran interfaces

```shell
$ make test
```

### Test the Python interface

```shell
$ ACCOUNT_LIBRARY_DIR=$PWD/build/lib ACCOUNT_INCLUDE_DIR=$PWD/account PYTHONPATH=$PWD pytest -vv test/test.py
```