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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (576.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.4-cp313-cp313-macosx_11_0_arm64.whl (506.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.4-cp312-cp312-win_amd64.whl (428.0 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (577.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.4-cp312-cp312-macosx_11_0_arm64.whl (507.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.4-cp311-cp311-win_amd64.whl (427.5 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (578.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.4-cp311-cp311-macosx_11_0_arm64.whl (510.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: panchang-0.2.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 427.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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8bce6bbe73cdf80c671825a858089d1fe5ff8e98824994301e14e29c2bcedfbf
MD5 78305b5f13911cb0349b3eb1766f304c
BLAKE2b-256 7b58df386e39159cf8bb19442e880ca7da27618e7c3edb3fe4b8aa0016ba549e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 85c1b3e772a9f2425986c2afbe3b7c271ba7a44cc4eb51a0d56daa5d86d484fe
MD5 c57a9c452ca04434d6c33ee7c8073204
BLAKE2b-256 5c07300cf356c5b50d1bef415590731a6421682a78f7e08beaf4810bf30f856f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca6a55c8e83cae2e5ba7d8aede15c064acf7a0f645b09d550fe6fdabc1c92f17
MD5 faf6052e8041f8db1e6fbbd026da4f99
BLAKE2b-256 203680d957e720fe6efea95343f254c5e642593861a2a5b2aed3c1976c6aaba8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 428.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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ff91e6ae80f97ea8400550d512409a083d98e3a291ebe394cadf2d64e9d52650
MD5 1925e9fd7b7ed8999e361c0de3eec2f3
BLAKE2b-256 fdb5a873f57e1bd999682db935fd54b061dd9fe9ebf754001586070686173788

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4789d9cac66562e81e01236c81748abac49ebdf52f0d2c26fb60695a1298f4ed
MD5 79316755c957e2ffc6d10d5a23ecd004
BLAKE2b-256 2df424fa63837fe6b3b2b677c982a25910ff29941551a70a4b349b0235f3385a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c99bc1a073485cf636825faa6217ee6d148b0eeb75ae9a7d4678de581f81639
MD5 49ec4c6c40ce0fdfe41ed6cecca6881d
BLAKE2b-256 463ed4d8ce3f1d76a31fd35660be030185d66c7c039cae4b4209548006617c3b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 427.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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 48048e4737be4f64e5ba402613e59e045631ef3401801e1e86e94875c1f32f1c
MD5 614c3f74f02dfe2d8a7ea03ae8342e35
BLAKE2b-256 e78119d95170237dfe2f8dfc63122a4ecd4c590448dca11b05e4ba290896a3c6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 20f548ad7b17ccc30cfa1ba1cc6dedb5fe15e7c2d23b70fd9f7d9bf1f8ea47ee
MD5 3c8f68eb34449889de7e040b36b5c0b0
BLAKE2b-256 0df5c23226e66157cd1a55aef3e13bd7cda2bf5b39464bbaae3b735ef64e77b5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7754a83832a2df82a19c34372a622cbfba8891aa57b312d2a7da49a4317fa9d2
MD5 45cdfc9a4da0484774c598ff5b3d355d
BLAKE2b-256 9d87e777388f6b0ba79dce93b67b7e26d6785d776e720f285eb59c103a6f01ad

See more details on using hashes here.

Provenance

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