Giter Club home page Giter Club logo

cython-project-template's Introduction

Cython Project Template

Creating long-term Cython projects can be laborious, especially when it comes to writing a setup.py file with NumPy support. This repository hosts a general-purpose setup.py file that allows arbitrary project structures and hierarchies, as well as a small code template. It allows you to:

  • Compile your code to a library
  • Mix python and cython files in the same project
  • C and C++ support
  • Support NumPy
  • Support increasingly complex project structure without having to change the setup.py file

Create your own project

Follow the following simple steps:

  • Download this template
  • Delete the content of myawesomelib folder
  • Rename it with the name of your project
  • Open setup.py and set SOURCE_FOLDER to the name of your project
  • If you wish to use SIMD instructions within your project, place these header files wherever you want in your source folder
  • Enjoy

Running the example

Install the package with:

make build

or:

python setup.py install

Execute it with:

import numpy as np

# This is a C extension generated with Cython
from myawesomelib.array.math import sigmoid, logit

arr = np.random.rand(1000)
logit(sigmoid(arr))

# This is a python module
from myawesomelib.wrapper import wrapped_sigmoid, wrapped_logit

wrapped_logit(wrapped_sigmoid(arr))

cython-project-template's People

Contributors

antoinepassemiers 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.