Skip to main content

An example Python package written in x86-64 assembly.

Project description

# Building Python Extension Modules in Assembly

This repository is a proof-of-concept to demonstrate how you can create a Python Extension in 100% assembly.

Demonstrates:

  • How to write a Python module in pure assembly

  • How to write a function in pure assembly and call it from Python with Python objects

  • How to call the C API to create a PyObject and parse PyTuple (arguments) into raw pointers

  • How to pass data back into Python

  • How to register a module from assembly

  • How to create a method definition in assembly

  • How to write back to the Python stack using the dynamic module loader

  • How to package a NASM/Assembly Python extension with distutils

The simple proof-of-concept function takes 2 parameters,

`default >>> import pymult >>> pymult.multiply(2, 4) 8 `

## But, Why?

Just because it can be done.

Also, I want to see if some AVX/AVX2 instructions (high-performance matrix multiplication especially) can be used directly from Python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymult-0.0.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distributions

pymult-0.0.0-py3.8-macosx-10.9-x86_64.egg (4.0 kB view hashes)

Uploaded Source

pymult-0.0.0-cp38-cp38-macosx_10_9_x86_64.whl (3.3 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page