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.12-cp313-cp313-win_amd64.whl (473.5 kB view details)

Uploaded CPython 3.13Windows x86-64

panchang-0.2.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (620.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.12-cp312-cp312-win_amd64.whl (474.0 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.12-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.12-cp312-cp312-macosx_11_0_arm64.whl (549.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.12-cp311-cp311-win_amd64.whl (474.5 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.12-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.12-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.12-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.12-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 473.5 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.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6a9c0bfe91fc18bec0cd00518309799d1050db218e1470de10ca9d1854cd16a1
MD5 cae6ae8160127563b6e2606edc0d77db
BLAKE2b-256 3f0d035bb6e34699ecbf35adfd7d626224c58b47c0b5c5f375b22e310010d82b

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for panchang-0.2.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f5a2576f825d4873f49ba4a3acd9e786fc05e1600a583e4fa682685c4d1309e
MD5 71754e9c55ecf14329f8b846862abb72
BLAKE2b-256 3da81573200027d2ea08eb2a9d90f3c60f718e2e9eb10e417dc809022ee9aa4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panchang-0.2.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8040214008bb0b635e10163c31afb46401d9920f26942cfbf7f7ee5a2608f232
MD5 0e03752266293469cb84d3f703a7d9b9
BLAKE2b-256 7bf49bcdf7e06893c125f67f41a6c627828495992d78f9bcc19091ed7caabb47

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 474.0 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.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 20c8743913be57a67d08faaede4f1cfcbd095148105d5154e65793680a7bde12
MD5 ba8c6a95b7c915793a6aea94a8119347
BLAKE2b-256 7bc0e73f73ad83428bf87a5e56f99df04132a355fcd9feec72e5a133a7bda322

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for panchang-0.2.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 765391bfaa250454d19533ef6b69235f868d4805431550cdd2d7a174d9e43312
MD5 5c0dd075d8aa33d5d0cea5ddd490bd2b
BLAKE2b-256 0f8e9754680785e19a3f23a5791940cb69b990a13984a5accd3fa116a84208d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panchang-0.2.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b32b6fef94f1095f7818e61900b9e123ca7762242aa9dce51aa7710b22eda3bb
MD5 f1ab9a4ce61dad9adbfad551ae6dcca0
BLAKE2b-256 c0859823f386039d7741e13ac0654a91f90b311f755b1e76d567508705e647b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.12-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 474.5 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.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8e8bcd0ca0cb4ac54438c001d17139a2836c66ba711b057a531f3e81189dd696
MD5 d90b697c55683691f25a2793e07973a9
BLAKE2b-256 415832f5c85a4ab0f01fe14fd76f53d7d5e216b6b267b854f12aac9fcad7d5a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for panchang-0.2.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e21342ec0d5b13496894e4230a031ddbbe81e8c1067e59fec16499b9481be8e1
MD5 4537175f3c1a6d273228708d3701e49d
BLAKE2b-256 6474f40985c40a83dad9e855680c49f29eb41aef365901108c3e04573744feb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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.12-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panchang-0.2.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60d95aa2d90c97da25cc02ce23f2e4f8aa6cf5f08c305aa5fc2addb4648d40d1
MD5 352ab59616619fdbcbe7fa526cb34853
BLAKE2b-256 590c7013e6eb1422261cfa05f5981525b1d03c810f0fa3ee48467fb1b1273688

See more details on using hashes here.

Provenance

The following attestation bundles were made for panchang-0.2.12-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