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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (595.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.10-cp313-cp313-macosx_11_0_arm64.whl (531.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.10-cp312-cp312-win_amd64.whl (452.5 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (596.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.10-cp312-cp312-macosx_11_0_arm64.whl (532.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.10-cp311-cp311-win_amd64.whl (452.6 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (597.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.10-cp311-cp311-macosx_11_0_arm64.whl (534.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: panchang-0.2.10-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 451.9 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.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cc81a6089c9a92c9b9b1cf3b34d7ae09df70caa11956a8eff615c0782c2adb70
MD5 7421fc56532aab58bf7b4abbb15a070e
BLAKE2b-256 c2727653ef0af36e7bb55420f4f28ad31bee9e255904b2a0325e627d54ce081b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd2d563ecdf58d6e541dbbb99ca7d9f59df1e3e75ac903f0b3d701dde83ddcd2
MD5 60a8a900589f46301353b11683c19c8d
BLAKE2b-256 bc0d39e8c9a4c4f41fa6d35d510c3fd2ba4f911fbd7f9bb6356813531e408099

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 732c993c217ff614ee4a1b9c4d3d5e6f81172744228d6a3a66a585aff16c6992
MD5 e1d9e465845d3b4972090d175aa01003
BLAKE2b-256 ee01197b5fdbda13ab1addbd666ea3fa1ecabfd7927dda6672afdf35ba349b4b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.10-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 452.5 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.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e18750e3fbfedb612c0717c9dd162f3fd292472080e6be250beb35f132887528
MD5 7620a00570c3c06d7cb4688825eaff58
BLAKE2b-256 b8a9ae14bcab68dfb9783662c2c538803fa769c8d9ab622a857a02f2872bbf69

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f4764b78c42f64fedace8216a32fc23fb69161b69bc11e2e27702e3081ac822
MD5 3a1a1589324369990c8c7525296575f7
BLAKE2b-256 0f4f354305fcdb5f3b80ea9a4d7bb4145b15a0a619a3ba28dfba42f87a4b31ef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa4dae5e001e1d15baa5a43bdbd15ead5f8e55b1bb6347e1ce0e56655988e415
MD5 e4e766fe8426e874924b8eb9448a6356
BLAKE2b-256 dcd3b63a8dbab2ccdf03e579a35449c1e7add890d6d6fa6b7490b414093f7e7a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.10-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 452.6 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.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 890e97437d22ee121f7a0de6b69cf5f4fa21974edefb7f9e046dac20581ab7c9
MD5 05459544ed8d362e4b1b8dfca73c0413
BLAKE2b-256 fb32e617ec10730c31cf59ddb3e720d01857c1227247cd4283e9508acddd9ea5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18b783449819f27613fec4b3e3c1af91365519dda28fc4d8e4db9bea6eb6cdfb
MD5 1644d17a8845391fa1cc1438e7d79f46
BLAKE2b-256 5d6033406b9a972b350eea56a1993d65b48223f7d02632e0172d72a6f0a40bcb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.10-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffd47ae4b6b8e79667ee4443cb871604df9b7114d7f641bbd2281e45f60b5f4b
MD5 218cd10b15e8cb54345bfc8494f09b66
BLAKE2b-256 45f7428d3a3b7f0b389246469d88a264edfa573c33f53cb6c69b4d24482e18e3

See more details on using hashes here.

Provenance

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