Skip to content

Instantly share code, notes, and snippets.

@m33m33
Created May 11, 2024 19:22
Show Gist options
  • Save m33m33/4e45788ef563d08594ba27cd918dcaf7 to your computer and use it in GitHub Desktop.
Save m33m33/4e45788ef563d08594ba27cd918dcaf7 to your computer and use it in GitHub Desktop.
Mistral.ai generated hello world cytonized exemple
Create setup.py file:
from setuptools import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("hello.pyx")
)
Create hello.pyx file:
print("Hello, World from Cython!")
Compile hello.pyx :
python setup.py build_ext --inplace
Create hello_cython.py file:
import hello
Run hello_cython.py:
python hello_cython.py
@m33m33
Copy link
Author

m33m33 commented May 11, 2024

python hello_cython.py output: Hello, World from Cython!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment