Skip to content

al-falak

This content is for v1.0.0. Switch to the latest version for up-to-date documentation.

An offline Python library for calculating Islamic prayer times. A community-maintained fork of alphahm/adhanpy, which is a Python port of batoulapps/adhan (Java).

Audience Use case
Python developers Integrate prayer times into applications, bots, or services
Researchers Analyze prayer time data across locations and dates
Embedded systems Run on devices with no network connectivity
Does Does not
Calculate all 6 prayer times (Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha) Require network access
Support 11 calculation methods Provide Hadith or fiqh rulings
Handle polar day/night with configurable strategies Calculate prayer times for other religions
Return timezone-aware UTC datetimes Include a GUI or web interface
Calculate Qibla direction
Calculate Sunnah night markers
Provide a CLI
from datetime import datetime
from alfalak import PrayerTimes, CalculationMethod
coordinates = (35.7750, -78.6336) # Raleigh, NC
prayer_times = PrayerTimes(
coordinates,
datetime.now(),
CalculationMethod.NORTH_AMERICA,
)
print(f"Fajr: {prayer_times.fajr.strftime('%H:%M')}")
print(f"Dhuhr: {prayer_times.dhuhr.strftime('%H:%M')}")
print(f"Maghrib: {prayer_times.maghrib.strftime('%H:%M')}")
I want to… Go to
Install and run my first calculation Getting Started
Compare calculation methods Calculation Methods
Handle polar regions Polar Regions
Use the CLI CLI Usage
See all public APIs API Reference
Migrate from adhanpy Migration
  • Python >= 3.11

MIT