No project description provided
Project description
prayerpy
prayerpy is a Python library designed to compute prayer times for Muslims based on the date and various configuration parameters such as latitude, longitude, altitude, and timezone. This library provides accurate prayer times according to Islamic conventions.
Features
- Calculate prayer times for Fajr, Sunrise, Dhuhr, Asr, Maghrib, and Isha.
- Configurable parameters for latitude, longitude, altitude, timezone, and sun angles.
- Easy-to-use API for integration into other applications.
- Built with math and science, no external APIs are used.
Installation
You can install prayerpy using pip:
pip install prayerpy
Usage
Here is a simple example of how to use prayerpy to compute prayer times:
from datetime import date
from prayerpy import compute
# Define the configuration parameters
config = {
'latitude': 12.345,
'longitude': 67.890,
'altitude': 120
}
# Compute prayer times for today
prayer_times = compute(date.today(), **config)
# Print all the prayer times
print(prayer_times)
Here is a another example using all configured parameters:
from datetime import date
from prayerpy import compute
# Define the configuration parameters
config = {
'latitude': 12.345,
'longitude': 67.890,
'altitude': 120,
'tz': 1,
'fajr_angle': 18.0,
'isha_angle': 17.0,
'asr_ratio': 1.0
}
# Compute prayer times for today
prayer_times = compute(date.today(), **config)
# Print all the prayer times
print(prayer_times)
Here is a another example to display time of a single prayer:
from datetime import date
from prayerpy import compute
# Define the configuration parameters
config = {
'latitude': 12.345,
'longitude': 67.890,
'altitude': 120
}
# Compute prayer times for today
prayer_times = compute(date.today(), **config)
# Get prayer time of a single prayer
fajr = prayer_times.fajr
# Print the time in HH:MM:SS format
print(fajr.pretty())
# Print the time as number of milliseconds since midnight
print(fajr.milliseconds())
Configuration Parameters
| Parameter | Type | Description | Default Value |
|---|---|---|---|
latitude |
float | Latitude of the location in degrees. | 0.0 |
longitude |
float | Longitude of the location in degrees. | 0.0 |
altitude |
float | Altitude of the location in meters. | 0.0 |
tz |
float | Timezone offset in hours (e.g., UTC+1 is 1). | 0.0 |
fajr_angle |
float | The Fajr convention angle of the sun in degrees. | 18.0 |
isha_angle |
float | The Isha convention angle of the sun in degrees. | 17.0 |
asr_ratio |
float | The ratio for Asr prayer time calculation. | 1.0 |
License
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub
Contact
For any questions or inquiries, please contact the author at khalil.galalem@gmail.com
Useful Wiki Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prayerpy-0.1.tar.gz.
File metadata
- Download URL: prayerpy-0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
220347b88af946962af6bd9375b6a2527b7e8573c2c0a3f40523a33c7c0dbe20
|
|
| MD5 |
3a75bdde24d21842eb8b3629cc3604c7
|
|
| BLAKE2b-256 |
1b990e767e025b762bfbc276e44e72990af6bdb21bbb2621fc43dee07ce0788d
|
File details
Details for the file prayerpy-0.1-py3-none-any.whl.
File metadata
- Download URL: prayerpy-0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90278a7e1277dc18a36ba86427aa033ad4fdd9c5aea669eb906722f1fbc23f64
|
|
| MD5 |
26e17e6d97e706e7cf527b75ce1efa4d
|
|
| BLAKE2b-256 |
eab64435eefa3da14003d8a87c14c0d9e7e4bc125fd834258e8dc1cad68218e6
|