Skip to content

Instantly share code, notes, and snippets.

@nrtkbb
Last active May 8, 2024 12:32
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nrtkbb/5b65d2f5ed42bd9947b5 to your computer and use it in GitHub Desktop.
Save nrtkbb/5b65d2f5ed42bd9947b5 to your computer and use it in GitHub Desktop.
Hello Cython in Maya
# Install pip
# $ curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
#
# Install Cython
# $ pip install cython
#
# compile command
python setup.py build_ext --inplace
"""
This is pure python file.
Called from maya
"""
import helloworld
def hello():
helloworld.hello()
"""
This is cython file.
Compiled from setup.py and python ( same version to mayapy )
"""
def hello():
print "Hello World"
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("helloworld", ["helloworld.pyx"])]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment