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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (575.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.2-cp313-cp313-macosx_11_0_arm64.whl (505.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.2-cp312-cp312-win_amd64.whl (426.7 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (576.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.2-cp312-cp312-macosx_11_0_arm64.whl (506.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.2-cp311-cp311-win_amd64.whl (426.2 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (577.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.2-cp311-cp311-macosx_11_0_arm64.whl (508.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: panchang-0.2.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 426.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panchang-0.2.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 20dba3f86af67d1be774fc67d357364d6a382b9de1f9f4c14d2e918b1fb8cb86
MD5 6dd168169335861b4ff6166b0b5e4f6f
BLAKE2b-256 e1dd571640b2d94810ab767089c51b71a8fdbb75677b17c573f0a07f9ff6f080

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9ee763baf9b80db8be9428edd9d3acff21491074c8152047490d5e9a2275167
MD5 4ad75d42fcbd0bf9abfe3b09a9cff1f6
BLAKE2b-256 bba04ded27f053e7b865b4247e0503f3a64c48b796a0558486c7c70c36944cbe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 238b2e5de481ec82b66d7b0ec7c8ee5aa1381d41768d41d00809ee2f2db953d4
MD5 8b18ac9059df2b66e4ca51a220bc8528
BLAKE2b-256 541fa465732a2139ca776ab5418728c9aa383750ee7129b7a31213b91611e00b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 426.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panchang-0.2.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 20cd1a93dda81c6d32915d14b1fbb5dbb59f6962449d08371dfb4a3d4cb266e1
MD5 ecd0b7f04f3044715fe16c0092f2a41e
BLAKE2b-256 e811f876bad72b1ec44d966ae8caa3a5dd32ba7e5bed6e45d22e62c2ecb7f66b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f7f6c66cee4bedb1a97bb798806382e7390ef067908274ddbe61d5dcb24ab2b
MD5 98b620b747b80af12181a97138747448
BLAKE2b-256 8e849456419d24b6267f3f5a2a015d189e56982a48ab9b1525ed22d32e1f7af0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 837fd3d3d7de336068880e55515f12431b4bd6a636c63ae2542b99cd0d02a318
MD5 41242f9c158b354a3c1842ff4aab7385
BLAKE2b-256 3c02990a70391aa26b516f56af542097e8db84004cc64e2f4d35bca7f04457e6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 426.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panchang-0.2.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 78049953a852db3023e5b886d009ff2eb69d1e061d20c198a7a9fbddedcca1fb
MD5 377f79f5c27470f63a8ebc420e0783ef
BLAKE2b-256 b3b433aa5aa32e4f2b1f30f731817f1acb47c7bc98adbec6529e6964f6724d4e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 887f27d217f193a55d1043e229034726c1c1b75c279bd7806d4b4e3533706742
MD5 0745aa4c1bfb70ba0321eb8f8cfa6082
BLAKE2b-256 48488743e19d39d98aad1bd3300504623d7749d009c8d6d8c46d96ff332675ec

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 952d01e7704bb2feadb9127d6f08b7eff6b4f31e5a92a939f2c6384c792ae294
MD5 91a482b98b30601d86038cd2a3571b84
BLAKE2b-256 27c22a5dd633c6b9ab54ee76b5df7eb0d3b658bbbba7efdb17312466d4240c11

See more details on using hashes here.

Provenance

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