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

Uploaded CPython 3.13Windows x86-64

panchang-0.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (586.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

panchang-0.2.5-cp313-cp313-macosx_11_0_arm64.whl (515.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

panchang-0.2.5-cp312-cp312-win_amd64.whl (435.4 kB view details)

Uploaded CPython 3.12Windows x86-64

panchang-0.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (587.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

panchang-0.2.5-cp312-cp312-macosx_11_0_arm64.whl (516.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

panchang-0.2.5-cp311-cp311-win_amd64.whl (435.3 kB view details)

Uploaded CPython 3.11Windows x86-64

panchang-0.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (587.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

panchang-0.2.5-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.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: panchang-0.2.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 434.8 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.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e444fca3cdc4f48090a4385a20c2135577304410c45dd039f25658c981d510eb
MD5 5973a3f9a9fd7e87b02d2dc17a367e01
BLAKE2b-256 abfa24ebca5a98f49ef57e97213dd4b8489c3904b4a46c74c06d0232af5dd0e1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b7781a249fa04f8f7a9c9af5bd0272fe084acba7054c1a15081096b0f9fc5cb2
MD5 63fc98ea7d6945fbb8d58198c96c290b
BLAKE2b-256 f72f3afe445104135e85ea5d91d942aef37425efd42de4e5517560fa1461c130

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c18ad0746cbfceb2381416a3ddf700c4ec9f8226f20f1df801d73bcd72104bbe
MD5 6e245eaf4127d39b143a4793bd721efb
BLAKE2b-256 36c30b5ff461e289261a3e279209181b4c129f58f391f7a9af01070666d6964d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 435.4 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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7efc1269d70ca434c1b5803f732c7717970b248eb3dacad6316c303c0843a912
MD5 8925ee23588efb50dc95f92880cb016c
BLAKE2b-256 91c3fa5d4203f5ebd9a6058ba2de695e5caead5a3d32eae5d9bce7d22b20ddc4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a3cd8191579beb4b1de2f4b4973258d385bed86a200d8a0a1fd52f3b31175e0
MD5 746c20a512b87e9bbbb33f159155fdc1
BLAKE2b-256 5bd67484731c0b1de8300ec550c1197259413eec26b4ecbafce5029e38441f5b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb3260386ab79c87b0d4b678f9be3162c0d95f6ef735034b4f2ee0f1bf331dcf
MD5 21c3f19928360011ec49793f9a09f206
BLAKE2b-256 48e6e6666cafebef835b2882dc5f6ab100030de8ceb9c86c87f1895d12693ccc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: panchang-0.2.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 435.3 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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a88debe668496cd4caba076d7d027610f4cd2b494523c7ea9f644d874bd9566c
MD5 17d92b872a5e27f9f25bba5e3f052ce1
BLAKE2b-256 a2d88bb24ab21dfc4f31ed21f843651abed5fd78001d8715d6951a0c9810c4bd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d28008a84d9418d9bfec22cfdb77dfa5ca0d8ef1d9b10b6cc8b6567ec7b118a6
MD5 88d05f51657a3f5a4b46a989128bcb80
BLAKE2b-256 f0e6571e818760905875c0f199ec1edb5d0d1b4d2affd12e8199cd9d7f2fbea2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panchang-0.2.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38bd2dd20bc78121c5e836840f3dc69d17c2bb6ebc79ea8c2b4e56a0d65268e3
MD5 070766d662d50c6d79f56b9b6624e12c
BLAKE2b-256 f258474732c7f084351acd6161427e8ce61e81ed63cc4d1896154c90dd473c27

See more details on using hashes here.

Provenance

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