Giter Club home page Giter Club logo

cythonizer's Introduction

cythonizer

Cythonize one step faster

image

image

image

Introduction

cythonizer.py is a script that will attempt to automatically convert one or more .py and .pyx files into the corresponding compiled .pyd | .so binary modules files. Example:

$ python cythonizer.py myext.pyx

pip install cythonizer will automatically create an executable script in your Scripts/ folder, so you should be able to simply:

$ cythonizer myext.py

or even:

$ cythonizer *.pyx

You can type:

$ cythonizer -h

to obtain the following CLI:

usage: cythonizer.py [-h] [--annotation] [--numpy-includes]
                     [--debugmode] filenames [filenames ...]

positional arguments:
filenames         .py and .pyx files only

optional arguments:
-h, --help        show this help message and exit
--annotation      (default: False)
--numpy-includes  (default: False)
--debugmode       (default: False)
  • --annotation will create the HTML Cython annotation file.
  • --numpy-includes will add the numpy headers to the build command.
  • Compiler flags -O2 -march=native are automatically passed to the compiler.

cythonizer's People

Contributors

rizwan-hasan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cythonizer's Issues

ModuleNotFoundError

Thank you for the module. I made simple test file cython_study.pyx:

cpdef int test(int x):
    cdef int y = 0
    cdef int i
    for i in range(x):
        y += i
    return y

command cythonizer cython_study.pyx compiles the file successfully, but when I run import cython_study there's 'ModuleNotFoundError'. On the other hand, if I use conventional setup.py & python setup.py build_ext --inplace:

from distutils.core import setup
from Cython.Build import cythonize

setup(ext_modules = cythonize('cython_study.pyx'))

the import cython_study runs without errors. The observed difference is in output files at compilation. In cythonizer case output was: cython_study.pypy36-pp73-x86_64-linux-gnu.so and in conventional was: cython_study.cpython-36m-x86_64-linux-gnu.so.

I'm still at learning stage, so any idea how to solve import the cython_study.pypy36-pp73-x86_64-linux-gnu.so or solve the problem? Thank you.

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.