The Python Alternative to the Swiss Ephemeris
Building an astrology app, service, or research tool? Moira is an MIT-licensed Python engine that works with operator-supplied JPL DE440/DE441 kernels. Compare calculation policies, deployment requirements, and license obligations before migrating.
Direct answer
What this page answers
Moira is a permissively MIT-licensed Python astrology engine and a possible Swiss Ephemeris alternative when its documented calculation products, kernel requirements, and policies fit your application. It is not a drop-in promise of identical results or legal advice.
Method, limits & sources
- Method
- Compare like with like: kernel, date range, body, observer, coordinate frame, time scale, corrections, house policy, packaging, and license terms. The executable example requires an explicit JPL kernel path and timezone-aware input.
- Important limit
- Swiss Ephemeris offers AGPL and professional-license paths. Moira's MIT license does not remove obligations attached to other code or datasets, and published validation is product-specific rather than one universal accuracy guarantee.
- Provenance
- The comparison links to both projects' license texts, Moira's API and migration documentation, and the named astronomy-validation receipts.
Compare the published license contracts
Understanding the legal boundary between dual-licensed copyleft code and permissive open source.
Swiss Ephemeris (Free)
The standard free version of Swiss Ephemeris (`sweph` / `pyswisseph`).
- AGPL option: Read the official terms for source and network-use obligations in your architecture.
- Integration matters: Obligations can turn on how the library and the larger work are combined.
- Free of upfront monetary charge.
Astrodienst Commercial
Purchased commercial license to bypass the AGPL copyleft requirements.
- Closed-source commercial use permitted.
- Commercial terms: Obtain current scope and pricing from Astrodienst.
- Evaluate language bindings, packaging, and operational fit for your stack.
Moira Engine
Modern Python-governed engine with C++17 core on PyPI.
- MIT terms: Permissive use subject to the license notice and disclaimer.
- No MIT copyleft condition: Review all other dependencies and datasets separately.
- Modern Architecture: Native Python typing, dataclasses, and async compatibility.
import os
from datetime import datetime
from fastapi import FastAPI, HTTPException
from moira.facade import Moira, HouseSystem
app = FastAPI(title="Astrology Service")
# Planetary calculations require a JPL kernel supplied by the operator.
moira = Moira(kernel_path=os.environ["MOIRA_KERNEL_PATH"])
@app.get("/api/chart")
def get_chart(birth_iso: str, lat: float, lon: float):
dt = datetime.fromisoformat(birth_iso.replace("Z", "+00:00"))
if dt.tzinfo is None:
raise HTTPException(422, "birth_iso must include a UTC offset")
# 1. Planetary positions under the selected kernel and policies
chart = moira.chart(dt)
# 2. House cusps for the supplied observer coordinates
houses = moira.houses(dt, latitude=lat, longitude=lon, system=HouseSystem.PLACIDUS)
# 3. Inter-planetary aspects with customizable orb policies
aspects = moira.aspects(chart)
return {
"ascendant": houses.asc,
"midheaven": houses.mc,
"planets": {
name: {"lon": p.longitude, "speed": p.speed}
for name, p in chart.planets.items()
},
"houses": houses.cusps,
"aspects": [
{"b1": a.body1, "b2": a.body2, "type": str(a.aspect), "orb": round(a.orb, 2)}
for a in aspects
],
}This example requires an installed package and a compatible JPL kernel at MOIRA_KERNEL_PATH. It rejects timezone-naive input rather than guessing a civil-time offset.
What to evaluate in a migration
The projects expose different APIs, policies, data requirements, and higher-level modules.
True JPL DE440/DE441 SPK Kernels
Moira evaluates compatible JPL SPK kernels supplied by the operator. Accuracy claims must be read against a specific kernel, date range, body, observer, coordinate frame, time scale, and correction policy; see the published validation receipts.
Read the astronomy validation reportBuilt-in Predictive & Traditional Modules
Moira exposes a number of higher-level traditional modules with explicit admitted variants and omissions. Confirm the current module contract rather than assuming feature parity or identical doctrine.
Pure Typed Python Vessels
Moira returns typed Python objects for many public surfaces. Static tools can inspect those annotations, but callers must still validate runtime inputs, policies, and errors.
Transparent Calculation Pipeline
Moira exposes reduction metadata on documented surfaces, including applied-stage and policy receipts. Consult the current API and validation report for the exact fields and products covered.
Porting from pyswisseph to Moira?
Inspect the contract-first migration manual for flag-to-policy translations, time-scale mappings, coordinate conventions, divergences, and omissions.
Frequently Asked Questions
Everything you need to know about licensing, performance, and migration.
Ready to build without licensing friction?
Install the package, supply a compatible JPL kernel, run the published examples, and compare validated products under policies that match your application.