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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (591.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.9-cp313-cp313-macosx_11_0_arm64.whl (526.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.9-cp312-cp312-win_amd64.whl (447.3 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (592.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.9-cp312-cp312-macosx_11_0_arm64.whl (527.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.9-cp311-cp311-win_amd64.whl (447.5 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (593.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.9-cp311-cp311-macosx_11_0_arm64.whl (529.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: panchang-0.2.9-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 446.7 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.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d11dad7e51c4e8825ec6cb1dc0cc4ac8be7743ed9649a5f2cf95751553b4aa8c
MD5 4327e09cfe738188b9a2956706e5a896
BLAKE2b-256 0b4f26d37c8263be2218c97871a06a2c3032b9d4d9d3b0a2c4d474f953710574

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6b0c302e1e4cbe8d5bf1b68833fb691f73373fc8be9e74eabc84473735f114f
MD5 24c5aff6333fcc61454831fec5ca82ef
BLAKE2b-256 c2f615060de5561d14f6a58fa802c1e1fe59383066fe3eabaa63a72c9b29bd3d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efa686c57faf62a2960169a378d166a3e7df002785f40f9d7676a355c79b512c
MD5 32f08c40e9c48ec6121c85544539b2a4
BLAKE2b-256 5278814bbeccea69bbf414c030094f468df112ffa5fe34cb38b05af00441497e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.9-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 447.3 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.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f7b128ddbef82b823d39d13696bb24da9628af3e3eb69e4cc8ce0687baad151b
MD5 ed4c4bf3afdec257e5ae2d734d5c0ff7
BLAKE2b-256 4fd3921e3ded07178d8f77c794aecf48a8920d947a7874ca757c499bdddf3211

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff06ff03e6834e7118b384b3cc536441a998104507d955e9db43135f890d20a7
MD5 d09db634bd67f05e71d91d52befd645f
BLAKE2b-256 0e0d8a70c72a9cc70fefb10f1371d2fb44e0dfe6cd29bad062bdb575d22622e4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2d66558e903f90a973cba4a4917e1661f5def979b8035835a412e35d58345de
MD5 33d67473b5c8f39c9280e77ab46af409
BLAKE2b-256 52c93ae901b954407fe571e2820e7aedd79b20dc95968a451ba384e7aafeabc9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.9-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 447.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.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 88c64689476d5b72d502930fb1d387b908747ca80cb9ce266b55e55a0737f1c1
MD5 606707e273bf2e972c3926470a166296
BLAKE2b-256 5dfe92713fc3fb54b7b9cd2bf9eedfec48267498e27793b29b124bd78b7fbdb1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d445b065f4406078e6d9ad087f973a2469013d7cc41e36d23ca26a0d56e352d
MD5 c84798775bd5e65899e584b195fe37b9
BLAKE2b-256 fd795391e17c1224b8b05f691ff67b93f329af3d9bca8d0d6bc11e84d142e0f3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26560377179c141b5760202f1bb59e1662ba4a4a9756669fa715d66dc116976a
MD5 2900defabbc019506ce9f6010e783642
BLAKE2b-256 fb6b0c6043bcd8cba45a3ecbe9ad3752c237076b7364d96ebde54791db3b9a2c

See more details on using hashes here.

Provenance

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