← Self-hosting vs an API

pyswisseph vs a hosted astrology API

pyswisseph is the thin Python layer over Swiss Ephemeris: swe.calc_ut, swe.houses, swe.set_sid_mode and friends, called from Python with the C engine underneath. If your stack is Python and you want the astronomy in-process, it is the shortest path there.

Every pyswisseph fact below links the page it was read from on .

Honestly

Where pyswisseph is the better choice

  • You are already in Python - a data-science notebook, a Django or FastAPI backend, a research pipeline - and want positions without leaving the process. pip install and import swisseph is the whole integration.
  • You run bulk research: thousands of charts for a statistical study, a backtest of transit timings, an ephemeris table for a print calendar. Per-call network latency and per-request pricing both work against you there.
  • You want the exact Swiss Ephemeris switches from Python - topocentric positions, fixed stars, eclipses - rather than the subset an API chooses to expose.
  • Air-gapped or offline environments, where no outbound HTTPS call is allowed at all.

Side by side

What you get vs what you build

pyswisseph self-hosted compared with the AstroNode API, checked 1 December 2026
 pyswisseph (self-hosted)AstroNode API
Language / runtimePython 3.5+ C extension sourceAny language: HTTPS + JSON, OpenAPI 3.1 spec details
Install and native buildPrebuilt wheels for Linux, macOS and Windows (2.10.3.2); sdist otherwise sourceNothing to compile; an API key and an HTTP client details
Planet positionsYes - the Swiss Ephemeris functions, called from Python sourceSidereal and tropical, from Swiss Ephemeris data files details
House systemsYes - the C library's house functions sourceWhole-sign (Vedic), Placidus (KP), five Western systems details
Sidereal / ayanamsaYes - the C library's sidereal modes sourceFixed per tradition: Lahiri, KP-Newcomb, tropical details
DashasNot documentedVimshottari, Yogini, Char details
Divisional charts (vargas)Not documented16 vargas in one call, plus D150 details
KP sub-lordsNot documentedCuspal sub-lord chain, significators, horary 1-249 details
PanchangNot documentedTithi, nakshatra, yoga, karana, sunrise, muhurta windows details
YogasNot documented55 classical yogas with reasons details
Kundli matchingNot documentedAshtakoot, Dashakoot, Porutham, batch scoring details
Ephemeris data you shipYou install the .se1 files and set the path sourceNone on your side
Time zones and historical offsetsNot handled (same as the C library); pass UT sourceYou send the offset in force at birth; no zone-name lookup details
Maintenance signalLatest PyPI release 2.10.3.2, uploaded 4 June 2023 sourceHosted; changes published in the changelog details
Stated accuracyNot documented separately; README describes the DE431-based engine sourceMeasured in CI vs NASA JPL Horizons: Moon 3.1″, planets ≤ 0.5″ (1900-2050) details

“Not documented” means the project's own README and docs do not describe it - not that it is impossible to build on top.

On top

What you would still write with pyswisseph

  • Everything above raw positions: pyswisseph's README documents the binding, not any astrology. Dashas, vargas, KP, panchang, yogas and matching are not documented, so plan to write them.
  • A wrapper that turns tuples like (xx, rflags) into typed objects your app can serialise - and the sign, nakshatra and house placement for each body.
  • Time handling: local time to Julian day in UT with the historical offset for the birthplace.
  • Tests against a trusted reference for every rule you add - the binding cannot tell you whether your navamsa formula is right.

Operations

Running it in production

  • Pinning. The newest PyPI release is 2.10.3.2 from June 2023, and its README still describes the DE431-based engine, while Swiss Ephemeris itself moved to DE441 in May 2026. Which C version you actually run depends on the wheel you pin; check before you assume upstream changes are in.
  • Wheels cover common Linux (manylinux and musllinux), macOS and Windows targets, built for CPython 3.6 to 3.11. On a newer interpreter or an unusual platform pip falls back to the source distribution, which needs a working C compiler in your build image.
  • Data files are separate. The README's own example starts by pointing swe.set_ephe_path at a directory of .se1 files; your container, Lambda layer or app bundle has to carry them, and a wrong path silently degrades to the Moshier model.
  • Whatever the library, the birth input is a local clock time, and turning it into UT needs the offset that was in force on that date - our UTC offset finder and the time-zone guide cover the traps.

Accuracy

What the numbers say

The pyswisseph README gives no accuracy figure of its own; it describes the engine as high-precision and based on JPL's DE431. Precision is whatever the bundled C library and your data files deliver - see the Swiss Ephemeris page for the upstream figures. For comparison, AstroNode's CI measures the Moon within 3.1″ and every planet within 0.5″ of NASA JPL Horizons from 1900 to 2050.

And

Where an API saves work

  • The Vedic code you would otherwise write on top of the binding - dashas, vargas, KP, panchang, yogas, matching - is already behind an endpoint, with typed JSON out.
  • No wheel-compatibility matrix to track when you upgrade Python, and no ephemeris directory to mount in every environment.
  • Clients in JavaScript, Swift, Kotlin or Go call the same endpoints; you are not tied to a Python service just to host the binding.

pyswisseph or an API: quick answers

What do I need to install to use pyswisseph?
pyswisseph: Prebuilt wheels for Linux, macOS and Windows (2.10.3.2); sdist otherwise. AstroNode API: Nothing to compile; an API key and an HTTP client. Checked 2026-12-01.
Does pyswisseph calculate dashas?
pyswisseph: Not documented. AstroNode API: Vimshottari, Yogini, Char. Checked 2026-12-01.
Does pyswisseph support KP sub-lords?
pyswisseph: Not documented. AstroNode API: Cuspal sub-lord chain, significators, horary 1-249. Checked 2026-12-01.
Does pyswisseph do kundli matching?
pyswisseph: Not documented. AstroNode API: Ashtakoot, Dashakoot, Porutham, batch scoring. Checked 2026-12-01.
Does pyswisseph handle time zones and historical offsets?
pyswisseph: Not handled (same as the C library); pass UT. AstroNode API: You send the offset in force at birth; no zone-name lookup. Checked 2026-12-01.

Sources

Quoted from pyswisseph's own pages

pyswisseph is named only to identify the project. Values were read from public pages on 1 December 2026; projects change, so check their pages before you decide, and tell us if anything here is out of date.

Other options: Swiss Ephemeris · Kerykeion · Flatlib · PyJHora