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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.7-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.7-cp313-cp313-macosx_11_0_arm64.whl (520.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.7-cp312-cp312-win_amd64.whl (437.3 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (588.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.7-cp312-cp312-macosx_11_0_arm64.whl (521.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.7-cp311-cp311-win_amd64.whl (437.4 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.7-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.7-cp311-cp311-macosx_11_0_arm64.whl (521.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: panchang-0.2.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 436.6 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.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 190a8539fd7ff9a724f1b32d9ae738a21f8e790122dd2439e485707b7d21f0df
MD5 1dcab04f1f86fe23854adb41e1539d19
BLAKE2b-256 905d4cbfb0e81fd9199bec59244d0ce46c3281838fb3c04a52bc611b01d22a4e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48e13ced25d04866fe993404f432a77fc708a81a9367e04f76f9bba1aab87ea6
MD5 4653c44d6d634568ef0355ed8646a28f
BLAKE2b-256 9d6c298f9de9a5aac2ae2d8df73083877fdae916ff16654bac9e4d892d64d027

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f905c47684a68b9ea1aed014b48584be686761b09639d54c5132d932ef18a68
MD5 fc0a3102bf641319982f06f9d013c349
BLAKE2b-256 aed27a78c5d39e646a58fa0bf807fc905f28b214a5785c979c6ed83769801107

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 437.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.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5f9665913e6f07f9116b6c28cccd1a671b113903d8e1b58cde7a7123f2933e98
MD5 1637be0a60b304ef0da4d348913526fc
BLAKE2b-256 0813d707a9ec9db2fc70b30a23cbf716948200b25a66a0e9347801d3bd18c7aa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e88ec3ee29e8c84a27ca8213c7daffb9282a77be45a176e2f8a82e742bce9d3
MD5 d29aab9063103ad5789b8d1dd8f17c66
BLAKE2b-256 f3e2d6420f159cf3ba8e3fdf0aac09887267657f657b554877dd411eb4787b0e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10f69d55fe0ab006638a5be47657a5bbcc6afb3d05bdc71c26a00f63d914f97b
MD5 48dbd0c97eb024516f04bb010a0970b0
BLAKE2b-256 503eaf8147f61a8179fbe88ee3208149b140a60c6f0e44b18241a549516d2c63

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 437.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.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1304bb77455c2d4b964429dfe5c0187e6950d94971a60d02a3da5ab2609856a3
MD5 ba545c1fc070f8fc39e0d23b12cf6f03
BLAKE2b-256 8539b55dd87ae3ffef91e96301c1561168811752f313df3815a19f7f6c604be3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d69a9f76b0e847150c2073e8d2c9b39528e3e2991761a2745655fb074789453
MD5 f7bddd9a49ca6ae98eb16a37d98a5af0
BLAKE2b-256 fd83d48a6d707a33a92dbb4d9b8f8881ad5bea939dcf3cf1fe698f1edd247aba

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 918b3a6e0c03cf2efdbb4aefb6fa165b99f25e515565ac8ebc18a9e68873a672
MD5 b074449951cdc94aa0c49f89b7647728
BLAKE2b-256 656148c703d2a22325b95f4f32dcfe1e39f0a3ed90c4cb7b001256fdd4a87a2c

See more details on using hashes here.

Provenance

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