Skip to main content

Zero external dependency Athan calculator

A simple Athan calculator with no external dependencies. Calculates prayer times using latitude, longitude, and elevation.

Installation

pip install athantime

Usage

Run it as a CLI tool, see, getathan --help , example:

getathan -e 100 -l 30 -L -100

Use it in a script:

from athantimes import Athan, print_prayer_times

# create Athan object based on user params
prayer = Athan(
    elev=100,  # Elevation
    lat=30,  # Latitude
    lon=-100  # Longitude
    # asr_method=1,  # jumhoor = 1. hanafi = 2
    # fajr_angle=15,
    # isha_angle=15,
)

# calculate athan times
m_times = prayer.calc_times()

# print prayer table
print_prayer_times(m_times)

# figure out next salah time
athan_time, next_salah = prayer.get_next_salah(m_times)
print(f"Next Athan ({next_salah}) will be called @ {athan_time}")

Output:

Fajr: 4:22:55.791533
Shuruq: 5:27:00.491693
Dhur: 11:31:53.542215
Asr: 14:58:52.500350
Maghrib: 17:36:46.592737
Isha: 18:40:51.292898

Next Athan (fajr) will be called @ 2024-09-24 04:23:30
  • See examples directory for additional usage.
  • sched_athan.py is an example running the library as a background process which execute a command every time an Athan is called. This is useful if you want to play an audio file.

Example Athan Schedule

Assuming there is a shell script which plays audios, a user can play all 5 Athans using this command

python3 examples/sched_athan.py -e 100 -l 30 -L -100

where -e is elevation, -l is longitude, and -L is longitude

This will execute a shell script @ /home/pi/sounds/many.sh whenever it is time for athan.

Metadata

Release files for athantime 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for athantime 1.0.0
File Size Uploaded
athantime-1.0.0.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for athantime 1.0.0
File Interpreter ABI Platform
athantime-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / athantime-1.0.0.tar.gz

Download URL athantime-1.0.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f972aec44d320e95072e7d4c076bc7ee69f1f56aeeb2038bbd25deb54a808ba9
BLAKE2b-256 checksum
How to use checksums
0f76a5b66e4bcfe27f276dbb476192696d703127701d1a74b1c04e423efbae45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / athantime-1.0.0-py3-none-any.whl

Download URL athantime-1.0.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f67e41dc89aa3861d92e9c5f6bcba01507048ee0315861c36b6e80c93d50edd
BLAKE2b-256 checksum
How to use checksums
858e695d053b10013debfd551b8fca12f446ccf08ab1e9c7a1f5811b24f2ba11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page