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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.13-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.13-cp313-cp313-macosx_11_0_arm64.whl (549.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.13-cp312-cp312-win_amd64.whl (473.9 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.13-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.13-cp312-cp312-macosx_11_0_arm64.whl (549.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.13-cp311-cp311-win_amd64.whl (474.4 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (621.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.13-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.13-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.13-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 473.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.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b9a20f525c515fbcccb86c799246a45a7250f17776b2cf095d5661f9c02bfb6f
MD5 43edc27e5dee0e12d40d71a6e3f27e8a
BLAKE2b-256 cb47adb8e915d6ecbeb81cfcdcbb996afc177401901bd84d4c134c9dc8cef5f0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3fdb63b96b9b63a69964554099947c62a1a7603905c9e1426c52d19bb96fbfa
MD5 115df91203fa41b11dae660d0000ddba
BLAKE2b-256 664fe88871d78437e1f81bf75158bed69a5cd8372b11ec8d7617c13cef3e1470

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9017e385864d50e6bd9450c5f2f8e2cb37e61c3fe0d000d54d9c86aa986145bd
MD5 b7da012c66fccf8e3e9cece1be5afd5e
BLAKE2b-256 f8df03d40bf5c5bf5fc83ec84c279d8ad3a514d93619cfb636de713af673dc6a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.13-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 473.9 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.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4929a81370a734caa0b7d39ecf85ff6bff434d24c919fce56bb8b02e45c10ea8
MD5 0810d77aef90729882fcfd36cce0d0b9
BLAKE2b-256 ad2a7b55abd14a7d14fbb47ad8b7b48165b21897403b3bd0184790bd39ec5fe3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3420c02290cc949ffd79f73edb63177a2f3eba03010ce507a3ac0a0e66ba5c06
MD5 7d58b1f15dd5a21eb36b6e9307c3f2e1
BLAKE2b-256 412fd648037a96a29ba9f305bf812beb7f8af3fb5984143cceaf8684971ba82b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea53479ace11d2b954ee84bc2708a4ad23755a1ea048f786888520eb63570414
MD5 a3fc21cb410b869fe6bc4aa8b7d94649
BLAKE2b-256 8d5d20b164dbfaa6807984c2937a9be0fdf6aec81cd4de87be9b300505e40214

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.13-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 474.4 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.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b91e89bd5842a563454988cf8b30e79adbb9028e3c303a6292d105281c24a6fe
MD5 8bd51943819e90893bd8fcd38c2ca1e1
BLAKE2b-256 5ccf9abfdfb4105eedb270c68e1a16028720697986990d322fc6ae11aba84c6b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f8578f199e02222b1686058a8b260b19e34bbfd75f7820afca4a3e413f0e869
MD5 6efcf9266801e4a071f8b468f1cfca05
BLAKE2b-256 f32408f3216daad46558339f856e374de43592132a1abf94f583004be713a9c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f475319a317a148ea5e3c0697b2a53d4eb7dc69312536c61cbc8151b47cb413
MD5 786b664e3e6a67d2da8bab48e31755a4
BLAKE2b-256 0823b5ee98153480d1e555ab8dbbe204876c715ffa6581745ea48f341c43330f

See more details on using hashes here.

Provenance

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