TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Writing a Python C extension in 2018

6 pointsby jbaviatabout 7 years ago

1 comment

jbaviatabout 7 years ago
I&#x27;m the author of <a href="https:&#x2F;&#x2F;github.com&#x2F;sqreen&#x2F;PyMiniRacer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sqreen&#x2F;PyMiniRacer</a>, used as example in this deck.<p>I introduce how I leveraged ctypes + Python manylinux wheels (PEP513 &#x2F; PEP571) in order to allow loading V8 easily into Python, without requiring local compilation on install nor having us maintaining a huge test matrix:<p><pre><code> $ pip install py-mini-racer $ python &gt;&gt;&gt; from py_mini_racer import py_mini_racer &gt;&gt;&gt; ctx = py_mini_racer.MiniRacer() &gt;&gt;&gt; ctx.eval(&#x27;1+1&#x27;) 2 </code></pre> So this shared object could be used in any language allowing to interact with arbitrary shared objects (e.g. Ruby with fiddle).