# 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.

Source: https://astronode.dev/compare/self-hosting/pyswisseph · Facts checked: 2026-12-01

## When self-hosting 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

|  | pyswisseph | AstroNode API |
| --- | --- | --- |
| Language / runtime | Python 3.5+ C extension ([source](https://github.com/astrorigin/pyswisseph)) | Any language: HTTPS + JSON, OpenAPI 3.1 spec ([details](https://astronode.dev/guides/openapi-typed-client)) |
| Install and native build | Prebuilt wheels for Linux, macOS and Windows (2.10.3.2); sdist otherwise ([source](https://pypi.org/pypi/pyswisseph/json)) | Nothing to compile; an API key and an HTTP client ([details](https://astronode.dev/quickstart/curl)) |
| Planet positions | Yes - the Swiss Ephemeris functions, called from Python ([source](https://github.com/astrorigin/pyswisseph)) | Sidereal and tropical, from Swiss Ephemeris data files ([details](https://astronode.dev/capabilities/vedic)) |
| House systems | Yes - the C library's house functions ([source](https://github.com/astrorigin/pyswisseph)) | Whole-sign (Vedic), Placidus (KP), five Western systems ([details](https://astronode.dev/guides/house-systems)) |
| Sidereal / ayanamsa | Yes - the C library's sidereal modes ([source](https://github.com/astrorigin/pyswisseph)) | Fixed per tradition: Lahiri, KP-Newcomb, tropical ([details](https://astronode.dev/guides/ayanamsa)) |
| Dashas | Not documented | Vimshottari, Yogini, Char ([details](https://astronode.dev/guides/vimshottari-dasha-calculation)) |
| Divisional charts (vargas) | Not documented | 16 vargas in one call, plus D150 ([details](https://astronode.dev/guides/divisional-chart-calculation)) |
| KP sub-lords | Not documented | Cuspal sub-lord chain, significators, horary 1-249 ([details](https://astronode.dev/capabilities/kp)) |
| Panchang | Not documented | Tithi, nakshatra, yoga, karana, sunrise, muhurta windows ([details](https://astronode.dev/guides/panchang-sunrise-conventions)) |
| Yogas | Not documented | 55 classical yogas with reasons ([details](https://astronode.dev/capabilities/vedic)) |
| Kundli matching | Not documented | Ashtakoot, Dashakoot, Porutham, batch scoring ([details](https://astronode.dev/capabilities/compatibility)) |
| Ephemeris data you ship | You install the .se1 files and set the path ([source](https://github.com/astrorigin/pyswisseph)) | None on your side |
| Time zones and historical offsets | Not handled (same as the C library); pass UT ([source](https://www.astro.com/swisseph/swephprg.htm)) | You send the offset in force at birth; no zone-name lookup ([details](https://astronode.dev/guides/birth-time-and-time-zones)) |
| Maintenance signal | Latest PyPI release 2.10.3.2, uploaded 4 June 2023 ([source](https://pypi.org/pypi/pyswisseph/json)) | Hosted; changes published in the changelog ([details](https://astronode.dev/changelog)) |
| Stated accuracy | Not documented separately; README describes the DE431-based engine ([source](https://github.com/astrorigin/pyswisseph)) | Measured in CI vs NASA JPL Horizons: Moon 3.1″, planets ≤ 0.5″ (1900-2050) ([details](https://astronode.dev/)) |

| More from their docs |  |
| --- | --- |
| Test data | Test suite needs four ephemeris files on SE_EPHE_PATH ([source](https://github.com/astrorigin/pyswisseph)) |

## What you still build yourself

- 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.

## 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](https://astronode.dev/tools/utc-offset-finder) and the [time-zone guide](https://astronode.dev/guides/birth-time-and-time-zones) cover the traps.

## Accuracy

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.

## 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.

## Questions

**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.
