Code Monkey home page Code Monkey logo

gbinder-python's Introduction

Cython extension module for gbinder

Prerequisites

  • libgbinder
  • libglibutil
  • pkgconf

For development, you will also need Cython:

pip install cython

Description

There are two Cython files: cgbinder.pxd describing the C++ API of the libgbinder library, and gbinder.pyx describing classes that will be visible from Python user code. The .pyx imports .pxd to learn about C functions available to be called.

There is also setup.py file. This file describes how to build the extension module, using distutils. In there, we specify the library to link with as libraries=['gbinder']. The gbinder stands for libgbinder.so that we previously installed.

There are two options to build the package:

  • One, use Cython's cythonize() function to generate a .c file from the .pyx one, and then compile it against the libgbinder.so library.
  • Two, if the .c is already provided, just compile it - no Cython required!

Development build

For development, use option 1 by providing --cython flag:

python setup.py build_ext --inplace --cython

The result will be a .so shared library named like gbinder.cpython-38-x86_64-linux-gnu.so. build_ext means we're building a C++ extension. --inplace means to put it in the current directory. If you run python from current directory, you'll be able to import gbinder.

Distribute

To distribute, call sdist with --cython flag to create source distribution (unbuilt):

python setup.py sdist --cython

The result will be a dist/ directory with a distribution named like gbinder-python-*.tar.gz inside. The archive contains setup.py and gbinder.c, so users can build and install it without having Cython!

To publish to PyPI, run:

twine upload -r pypi dist/*

Install

To install, locate the .tar.gz distribution and run:

pip install dist/gbinder-python-*.tar.gz
Readme and setup.py is based on geographiclib-cython-bindings repo thanks to @megaserg

gbinder-python's People

Contributors

erfanoabdi avatar

Watchers

James Cloos 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.