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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (587.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.6-cp313-cp313-macosx_11_0_arm64.whl (520.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.6-cp312-cp312-win_amd64.whl (437.0 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (588.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.6-cp312-cp312-macosx_11_0_arm64.whl (520.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.6-cp311-cp311-win_amd64.whl (437.2 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (589.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.6-cp311-cp311-macosx_11_0_arm64.whl (521.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: panchang-0.2.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 436.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.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 45c0f72f5530d79ca54f967ba6cfefc5cc5b4c3d8b2bb60614911848ee9aa601
MD5 6cdb1c3fef8733e170d78c44e4dd7ac6
BLAKE2b-256 8ec6f4a4fe3dccf9706b4b53cc178f7d1353c4cfdd08ec1059c767df90765210

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8cdf892d91f1813452f6a48873c52985c80dc1bad5dffe071e073fcb629918d5
MD5 0abe51f28e7a552373408453fb7c1ce3
BLAKE2b-256 360d832c1ca71ed2a1054a36a374e1ab47422c448af37e5c3ec037f1bc22236d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ddbd3a4bfe5eaa4dbf84d32fff2580e17ae4c081eff227815aba79908304ec5
MD5 b6f8db07726e07f5d4d062a00363ea3d
BLAKE2b-256 6467749e9c5364ec11a123627bb4138b8c32a951bf81c8e94482d0702745a1d2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 437.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.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 92b2a53823e939cd74c5c7750045525764427a80d3fed2761d391ec2cc6123d2
MD5 45285089bdab512c7721dee751a660c7
BLAKE2b-256 f20be6174982d8a866f181c9e92cc866b68ee88f66afdd32b6d2f26fa7ed6fdb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a1521d3619a93e30a35631821ecd9f2e85c271e1f92f27ae49b4111ae61071d
MD5 393ec45b267f5ab82887f4943414e0cf
BLAKE2b-256 315a3ba09617f5f93a59df31c269a0e6732da7a6d28b214a73a6d48b9b65ba82

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27dde5840eb5557c2f184747fcb349d6c79559d13de3723bb11db92475a9e6c9
MD5 72dacc5fee26aa0731d3f3e741ff118b
BLAKE2b-256 ec0110b9d2f1b7308360c08ad0f7d9ce1df6e37e60b9e76f32abeff91ba84e2a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.6-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 437.2 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.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f00bac2b4b8b2e21bc7e4fe1efd8aafc662d93f8362a741122d7fe54749c9ade
MD5 f47a0e3536f4b5b7eddc504dda26db5b
BLAKE2b-256 103d3490426782201be96905e2ce1340af34601932fc3e62211eac63d6c04add

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5be64dcc428651b9eb37eca07e82a618d2aff52ba84327c1a9caf1ea03db44ea
MD5 4e14d0ad15637ec8a9e43f19e7d1e1a3
BLAKE2b-256 5b01c9a02f022b107b1444666742ae5d6f40a2792402729301ad24bccb3ef64b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce288898621b7b4d34b4fa549f9d5fd33c449066e251cfbfa7e93134bed0073e
MD5 a200adb4e07b4f1e7e82dcc99eb8e572
BLAKE2b-256 3d417558bb1ebed3ba972dacd2bdd4d96e655ccb104d0c0dc6154f8d640cf775

See more details on using hashes here.

Provenance

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