DEV Community

Jayesh Patel
Jayesh Patel

Posted on

A Zero-Abstraction Swiss Ephemeris Binding in Python (No Extensions)

I recently built something I couldn’t find in the Python ecosystem:

👉 A true 1:1 runtime-FFI binding for Swiss Ephemeris.

swisseph-ffi


The Problem

Most Python bindings for Swiss Ephemeris:

  • Use CPython extensions
  • Depend on compiled wheels
  • Wrap or modify the API

That’s fine — until you need:

  • Full API coverage
  • Exact C-level behavior
  • Long-term compatibility across Python versions

The Approach

This project uses:

👉 ctypes (runtime FFI)
👉 No compiled Python extension
👉 Direct shared library loading

Result:

You call Swiss Ephemeris exactly like C does — from Python.


What You Get

  • 106/106 C functions mapped
  • Full constant parity
  • No output reshaping
  • No abstraction layer
  • Prebuilt native libraries included
  • Cross-platform support

What You DON’T Get (intentionally)

  • No helper abstractions
  • No “Pythonic” transformations
  • No hidden logic

This is a low-level tool by design.


Why This Exists

To solve:

  • ABI breakage across Python versions
  • Wheel distribution complexity
  • Loss of control in higher-level wrappers

Use Cases

  • Astro/ephemeris engines
  • Jyotish/Panchang systems
  • Research tools
  • Custom astrology platforms

Positioning

Not a replacement for existing libraries.

A foundation layer for developers who want full control.


Fun Fact

This is likely one of the first complete ctypes-based Swiss Ephemeris bindings in Python.


Links


If you like low-level, transparent systems — this might interest you.

Top comments (0)