Skip to main content

Pure Python ctypes FFI wrapper for the JPL Moshier Ephemeris native library with direct jme_* API access and bundled jme plus calceph runtimes

Project description

JPL Moshier Ephemeris Python

PyPI version Downloads Python Versions License: MIT Wheel Status

Pure Python ctypes runtime FFI binding for the project-owned JPL Moshier Ephemeris C library.

This package wraps the native jme_* API directly. It is intended to be a true raw I/O surface: no recalculation, no normalization, no rounding, no reshaping, no dropped buffers, and no hidden status conversion.

Contract

  • Primary public functions: jme_*
  • Primary public constants: JME_*
  • Current wrapper target: all 204 public jme_* functions tracked by the native API inventory
  • Current constant target: all 462 public JME_* constants from the native headers
  • Native runtimes bundled in the wheel: jme plus calceph
  • No CPython extension module; pure Python loader plus bundled native libraries
  • Argument order, pointer ownership, output buffers, and return values are kept as-is from the native C API

Installation

pip install jmeph-ffi

End users do not need to download native binaries manually. The package ships its bundled jme and calceph runtimes inbuilt inside the wheel.

Native Libraries

The package bundles the same prebuilt runtimes as the PHP wrapper:

  • linux-x64/libjme.so
  • linux-x64/libcalceph.so
  • linux-arm64/libjme.so
  • linux-arm64/libcalceph.so
  • macos-x64/libjme.dylib
  • macos-x64/libcalceph.dylib
  • macos-arm64/libjme.dylib
  • macos-arm64/libcalceph.dylib
  • windows-x64/jme.dll
  • windows-x64/calceph.dll

The local/PHP release source below is for maintainers and package build refresh only, not for normal users.

Local source for those prebuilt runtimes during development:

Copy from a local checkout of jpl-moshier-ephemeris-php/libs

Published runtime source:

https://github.com/jayeshmepani/jpl-moshier-ephemeris-php/releases/tag/prebuilt-libs

You can override discovery with:

  • JME_LIBRARY_PATH
  • JME_CALCEPH_LIBRARY_PATH

Search order:

  1. explicit environment override
  2. bundled src/jpl_moshier_ephemeris/libs/<platform>/
  3. common system library paths

Quick Start

from jpl_moshier_ephemeris import (
    JME_BODY_SUN,
    JME_CALC_SPEED,
    JME_CALENDAR_GREGORIAN,
    JmeEph,
    c_double,
    create_string_buffer,
)

jme = JmeEph()

jd = jme.jme_julian_day(2000, 1, 1, 12.0, JME_CALENDAR_GREGORIAN)
xx = (c_double * 6)()
err = create_string_buffer(256)

rc = jme.jme_calc_ut(jd, JME_BODY_SUN, JME_CALC_SPEED, xx, err)
print(rc, list(xx), err.value.decode())

Development

python -m pip install -e ".[dev]"
python scripts/fetch_prebuilt.py
python -m ruff check .
python -m ruff format . --check
python -m pyright
python -m pytest
python -m build
python -m twine check dist/*

The test suite verifies:

  • 204/204 configured ctypes function signatures
  • 462/462 generated JME_* constants
  • import and runtime loading
  • basic native contract calls such as version, Julian day conversion, calculation, houses, ayanamsa, Delta-T, split-degree, body naming, and refraction
  • optional source-surface audit against the local native jpl-ephemeris- tree

License

MIT. The Python package and the project-owned JME native library are intended to remain under MIT-compatible distribution.

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

jmeph_ffi-1.0.1.tar.gz (26.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jmeph_ffi-1.0.1-py3-none-any.whl (26.9 MB view details)

Uploaded Python 3

File details

Details for the file jmeph_ffi-1.0.1.tar.gz.

File metadata

  • Download URL: jmeph_ffi-1.0.1.tar.gz
  • Upload date:
  • Size: 26.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jmeph_ffi-1.0.1.tar.gz
Algorithm Hash digest
SHA256 71180abedc4e0c10b458d83bf694b570c6304444a7c937c8ff99e313e05e1ba7
MD5 4d7be0834e0caadb50da08aeaffa402a
BLAKE2b-256 02207cffbb49ff595ad75b7461a4e8504793561321ff6d7ea223a1dcd3299dc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmeph_ffi-1.0.1.tar.gz:

Publisher: publish.yml on jayeshmepani/jpl-moshier-ephemeris-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jmeph_ffi-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: jmeph_ffi-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jmeph_ffi-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45737b6cdc51e302609f21179b201ad4b68bfe8a65bfb3ec42b3aadd9a46809b
MD5 2148fb07ad2b3fe1ec81a2eec1a2a099
BLAKE2b-256 bea03f2fe78f400b71f4a39315ca1cc5007a437fcd3db19444fa5c91f36c368c

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmeph_ffi-1.0.1-py3-none-any.whl:

Publisher: publish.yml on jayeshmepani/jpl-moshier-ephemeris-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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