al-falak
This content is for v1.0.0. Switch to the latest version for up-to-date documentation.
al-falak
Section titled “al-falak”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).
Who is this for?
Section titled “Who is this for?”| 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 |
What al-falak does and does not do
Section titled “What al-falak does and does not do”| 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 |
At a glance
Section titled “At a glance”from datetime import datetimefrom alfalak import PrayerTimes, CalculationMethod
coordinates = (35.7750, -78.6336) # Raleigh, NCprayer_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')}")Where to go next
Section titled “Where to go next”| 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 |
Requirements
Section titled “Requirements”- Python >= 3.11
License
Section titled “License”MIT