Skip to main content

Open-source Vedic panchang and planetary position calculator. No API. No credits.

Project description

vedic-panchang

A fast, precise Vedic panchang and planetary position library for Python. Built on Swiss Ephemeris (JPL DE431 data). No API calls. No subscriptions. No limits.

pip install vedic-panchang

What it computes

Everything is derived mathematically from planetary positions. No hardcoded almanac tables.

Element Method
Planet longitudes (all 9) Swiss Ephemeris + JPL DE431
Nakshatra (name, id, pada, lord) moon_lon / 13.333°
Tithi (name, id, paksha, % elapsed) (moon − sun) / 12°
Yoga (name, id) (sun + moon) / 13.333°
Karana (name, id) half-tithi division
Rasi (sign) for all 9 planets longitude / 30°
Retrograde status planet speed < 0
Moon phase angle (moon − sun) % 360
Is Purnima / Amavasya tithi index 14 or 29
Moon waxing / waning tithi < 15
Gandanta moon at water→fire sign junction
Nakshatra / Tithi / Yoga end time bisection search on ephemeris
Sunrise / Sunset Swiss Ephemeris rise_trans
Ayanamsa value Swiss Ephemeris (Lahiri, Raman, KP, …)

Quick start

from vedic_panchang import Panchang
from datetime import date

p = Panchang(
    date=date(2026, 1, 1),
    time=9.25,          # 09:15 local time
    lat=19.076,
    lon=72.877,
    tz=5.5,             # IST (default)
    ayanamsa="lahiri",  # default
)

Panchang elements

p.nakshatra          # "Purva Ashadha"
p.nakshatra_id       # 20
p.nakshatra_pada     # 3
p.nakshatra_lord     # "Venus"
p.nakshatra_degree   # 6.8421   (degrees into current nakshatra)
p.nakshatra_ends_at  # "2026-01-01T14:30:15+05:30"

p.tithi              # "Amavasya"
p.tithi_id           # 30
p.tithi_pct          # 87.4     (% of tithi elapsed)
p.paksha             # "Krishna"
p.tithi_ends_at      # "2026-01-02T07:45:22+05:30"

p.yoga               # "Vyaghata"
p.yoga_id            # 13
p.yoga_ends_at       # "2026-01-01T18:22:00+05:30"

p.karana             # "Kimstughna"
p.karana_id          # 11

p.vaara              # "Thursday"
p.sunrise            # "2026-01-01T07:14:00+05:30"
p.sunset             # "2026-01-01T18:18:00+05:30"

Planet positions

p.sun_longitude      # 266.200251
p.moon_longitude     # 261.542149
p.mercury_longitude  # 242.821571
p.venus_longitude    # 230.816996
p.mars_longitude     # 250.685927
p.jupiter_longitude  # 11.600357
p.saturn_longitude   # 310.006534
p.rahu_longitude     # 356.147849
p.ketu_longitude     # 176.147849

p.sun_rasi           # "Dhanu"
p.moon_rasi          # "Dhanu"
# all 9 planets have _rasi and _rasi_id

Retrograde & Moon

p.mercury_retrograde  # False
p.venus_retrograde    # False
p.mars_retrograde     # False
p.jupiter_retrograde  # False
p.saturn_retrograde   # False
p.retrograde_count    # 0

p.moon_phase_angle    # 355.34  (0=new moon, 180=full moon)
p.moon_waxing         # False
p.is_purnima          # False
p.is_amavasya         # True
p.moon_gandanta       # False

Export

p.to_dict()      # full snapshot as dict — 55+ fields
p.to_series()    # pandas.Series (requires pandas)

Ayanamsa options

Panchang(..., ayanamsa="lahiri")        # default — Indian standard
Panchang(..., ayanamsa="raman")
Panchang(..., ayanamsa="krishnamurti")  # KP system
Panchang(..., ayanamsa="fagan_bradley")
Panchang(..., ayanamsa="de_luce")

p.ayanamsa        # "Lahiri"
p.ayanamsa_value  # 24.1983

Performance

Fields use @cached_property — computed once, only when first accessed. Full to_dict() (55+ fields including boundary times) runs in < 5ms.


Requirements

  • Python 3.9+
  • pyswisseph — installed automatically
  • pandas — optional, only needed for to_series()

Swiss Ephemeris covers 5400 BCE to 5400 CE.


License

MIT

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

vedic_panchang-0.1.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

vedic_panchang-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file vedic_panchang-0.1.1.tar.gz.

File metadata

  • Download URL: vedic_panchang-0.1.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for vedic_panchang-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8ddb9a67d881664848c453eba4bf390bdf668f75a89dcb4eb2a98ce019aeef02
MD5 a472e3c48c393a376e5e38d4c0c02a90
BLAKE2b-256 5d73c6d0b60fbfb6386373b2e7bd431fea7a281c415738d046709e7b568a66df

See more details on using hashes here.

File details

Details for the file vedic_panchang-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vedic_panchang-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for vedic_panchang-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9acaf690a4f15a18d995fbb5db780c883eb705088e00d79ddffa33ed48600c29
MD5 0b4ee6ab14e7ae7e95b8cbb95c8e1527
BLAKE2b-256 19cb9f962f2cf6fc199761e48d0ed6147214ac72015ab9fcbb9d1df00230389f

See more details on using hashes here.

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