Skip to main content

Bhāratīya calendar infrastructure — Panchang, festivals, muhurat, and regional calendars

Project description

Panchang

PyPI Python License: MIT CI

Bhāratīya calendar infrastructure for developers — Panchang, festivals, muhurat, regional calendars, and batch computation.

Built on a Rust computation engine with Swiss Ephemeris precision. Not an astrology API. It answers: "What is happening in the Bhāratīya calendar right now, at this location?"

from datetime import date
from panchang import panchang, calendar, Location

delhi = Location(lat=28.6139, lng=77.2090, tz="Asia/Kolkata")

# Daily Panchang
today = panchang.compute(date.today(), delhi)
print(today.tithi.name)        # "Shukla Dvitiya"
print(today.nakshatra.name)    # "Pushya"
print(today.nakshatra.pada)    # 3
print(today.sunrise)           # 2026-03-03 06:42:18+05:30

# Festival dates
festivals = calendar.compute_festivals(2026, delhi)
for f in festivals[:3]:
    print(f"{f.name}: {f.date}")
# Makar Sankranti: 2026-01-14
# Vasant Panchami: 2026-02-01
# Maha Shivaratri: 2026-02-15

Install

pip install panchang

Requires Python 3.11+. Wheels available for Linux, macOS, and Windows.

Features

Panchang (Daily Calendar)

All 5 Panchanga elements with precise transition times (start/end to the second):

  • Tithi (lunar day) — with Paksha (Shukla/Krishna)
  • Nakshatra (lunar mansion) — with Pada (1-4)
  • Yoga (Sun-Moon combination)
  • Karana (half-tithi)
  • Vara (weekday)

Sun & Moon

  • Sunrise/sunset using Hindu rising model (disc center at horizon, Bhāratīya atmospheric refraction)
  • Location-aware computation for any lat/lng/timezone

Muhurat (Auspicious Windows)

  • Rahu Kalam, Yama Gandam, Gulika Kalam
  • Abhijit Muhurat
  • Choghadiya (16 windows per day — 8 day + 8 night)

Festivals

55+ Hindu festivals astronomically computed for any year:

  • Tithi-based: Diwali, Holi, Janmashtami, Ram Navami, Ganesh Chaturthi, Navaratri, ...
  • Sankranti-based: Makar Sankranti, Pongal, Vishu, Bihu, ...
  • Nakshatra-based: Onam (Thiruvonam)
  • Ekadashi: All 24 per year with Smartha and Vaishnava dates
  • Vrat dates: Pradosh, Sankashti Chaturthi, Amavasya, Purnima (~60 per year)

Festival definitions are data-driven (YAML, not hardcoded) with year-agnostic astronomical rules. Each resolved date includes a reasoning string explaining the determination.

Regional Calendars

8 regional calendar systems with proper era numbering:

  • Solar: Tamil, Bengali, Malayalam, Kannada
  • Lunar: Hindi, Marathi, Telugu, Gujarati
  • Era support: Vikram Samvat, Shaka Samvat, Bangabda, Kollavarsham, Thiruvalluvar, 60-year Jovian cycle

Lunar Months

  • Both Amant (South Bhārat) and Purnimant (North Bhārat) systems
  • Adhik Maas (intercalary month) and Kshaya Maas detection

Shraddha Tithi

Death anniversary date resolution — given a death date, computes the Shraddha date for any target year using the lunar tithi and month.

Batch Computation

Full-year or date-range Panchang in a single call:

from panchang import batch, Location

delhi = Location(lat=28.6139, lng=77.2090, tz="Asia/Kolkata")
year_data = batch.compute_year(2026, delhi)  # 365 days of Panchang

Accuracy

All computations use the Swiss Ephemeris (Moshier analytical model) with Lahiri/Chitrapaksha Ayanamsa — the Government of Bhārat standard.

Cross-validated against Drik Panchang for 2026-02-24, Delhi:

Element Drik Panchang Panchang Delta
Sunrise 06:51 06:55 ~4 min
Tithi Shukla Saptami until 07:01 Shukla Saptami until 07:02 ~1 min
Nakshatra Krittika until 15:07 Krittika until 15:07 exact
Yoga Indra until 07:24 Indra until 07:23 ~1 min
Karana Vanija until 07:01 Vanija until 07:02 ~1 min
Rahu Kalam 15:26-16:52 15:24-16:48 ~2 min

All element names match exactly. Timing differences are 1-5 minutes due to sunrise geometric model variations.

Architecture

Rust core + Python API. All astronomical math runs in Rust via PyO3, giving C-level performance with a Pythonic interface.

Python (pydantic models, typed API)
  └── Rust via PyO3 (panchang, festivals, muhurat, batch)
        └── Swiss Ephemeris C (planetary positions via FFI)

Performance (Rust benchmarks):

  • Full Panchang: ~3.7 ms
  • Sunrise: ~29 µs
  • All 9 planets: ~7 µs

Development

# Setup
uv venv
uv pip install -e ".[dev]"

# Build Rust extension
maturin develop --uv

# Run tests
uv run pytest tests/ -v
cargo test --manifest-path crates/panchang-core/Cargo.toml -- --test-threads=1

# Lint
uv run ruff check python/ tests/
cargo clippy --manifest-path crates/panchang-core/Cargo.toml -- -D warnings

Tech Stack

Layer Technology
Computation Rust + PyO3
Ephemeris Swiss Ephemeris (vendored C, Moshier model)
Python 3.11+ with Pydantic v2
Build maturin + uv
Testing pytest + proptest + criterion
CI GitHub Actions + maturin-action

Contributing

Contributions welcome! Please open an issue first to discuss what you'd like to change.

# Run the full check suite before submitting
uv run ruff check python/ tests/
uv run pytest tests/ -v
cargo test --manifest-path crates/panchang-core/Cargo.toml -- --test-threads=1
cargo clippy --manifest-path crates/panchang-core/Cargo.toml -- -D warnings

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

panchang-0.2.11-cp313-cp313-win_amd64.whl (473.4 kB view details)

Uploaded CPython 3.13Windows x86-64

panchang-0.2.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (620.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.11-cp313-cp313-macosx_11_0_arm64.whl (549.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.11-cp312-cp312-win_amd64.whl (473.9 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (620.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.11-cp312-cp312-macosx_11_0_arm64.whl (549.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.11-cp311-cp311-win_amd64.whl (474.4 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (621.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.11-cp311-cp311-macosx_11_0_arm64.whl (551.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file panchang-0.2.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.11-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 473.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for panchang-0.2.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 354093b21f74c05d0cd3384a36aeb9d96000d910bca9f8dd6ecfee34b01cd6b1
MD5 9f3ddede6895297f70edfcb7a2317daf
BLAKE2b-256 81289d59793cdde4bf5ef1c92318a89a26b4996c68f512c0372f9b77cd77f736

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp313-cp313-win_amd64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for panchang-0.2.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62b3a9668ded9d3e949b1d0f92eef281c345fcf3298dc05aa3d3433c8f63bdb5
MD5 4952e184ea8bf62a654f501e6ce247e3
BLAKE2b-256 51d39103645d7b90af4c6d66a6c62b0f61373def5867ed3393af32198352e0d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panchang-0.2.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0649bef9540a2cb4d2c3ac6f6ef42f09a7f86e51d85c2f1b899411657a434cbd
MD5 ae89650fb2c9232a3d590227e9202cca
BLAKE2b-256 736d00cb1464b75912c64aa1fec08de2fd92d245a87b66711a0bbbe253e5aa57

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.11-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 473.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for panchang-0.2.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b0e69a5f96c4cee9fbdaf89cb9a2fb2e3640488fe2f131a4e7c9be1d11d185e9
MD5 52178711a61e838af5e0a533387b5258
BLAKE2b-256 0da40af590835b3c4015135282a79c695bfc44993f6322669116e503dc79e229

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp312-cp312-win_amd64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for panchang-0.2.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 efae59053519104bd0d38d01bbe1d964638fc4de89e4bb37ec6028df42b2568a
MD5 5bf3e28480d34bd86adf1b067c68514a
BLAKE2b-256 08b381247b5c434a0714c69da324f41783cedbbc62c09828d84ae54a763f8ce7

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panchang-0.2.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b2172435a6fdbf789b275c1d508d99ea4b46cbcac6a2daed3aceaacb2902545
MD5 1716010ada543a655f659c92014f06aa
BLAKE2b-256 7247a87cdf176716d36af8073d7d67dd0a9de2a9676460b2268aa4c43121cd26

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.11-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 474.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for panchang-0.2.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f0a4fd3ec4edcc2b7c1328d7f8b04dd920b28e6831fb1a7d9651f11423980ddb
MD5 7c618835232d00d55b6a226836f24bd9
BLAKE2b-256 67a475ee6cc2f1ff2af89c95c50a17c7510c341dc74191ea6c6d79e0866ffd72

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp311-cp311-win_amd64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for panchang-0.2.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5bd4641b366f71f1d4dff2e2dd56f6c1a82e90bb2ae2586e9d841a0717ef5696
MD5 94a827fd20cfe4778a9e4902ba877801
BLAKE2b-256 56be49034751d0dda3c7894d5543b1f98117f85ccb3794e499ca169e2f16908e

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on vibzart/panchang

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

File details

Details for the file panchang-0.2.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panchang-0.2.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2c1e1bbc54ae975d2a7751373bb8b2ebe80d87c798cc55b00ba44d54ebc2757
MD5 4a4bc59db7103fa47269893c3b35f1ca
BLAKE2b-256 b3ed25dc0ec29e53fc726aa4e909b9f9c20bb77b2ca9356375eb0d8e2c46ad9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.11-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on vibzart/panchang

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