Git Product home page Git Product logo

pyislam's Introduction

pyIslam

Build Status

pyIslam is a python islamic library, it can calculates prayer times, qibla direction, convert between gregorian and hijri, calculate zakat and mirath.

Actually, this is what the library can do:

  • Pray times calculation
  • Hijri/Gregorian date conversion
  • Qibla direction
  • Zakat calculation (need checking)
  • Mirath calculation (need checking)

Installing

From PyPi

Simply run:

pip install islam

Note that the pip package name is islam and not pyIslam, pyIslam is taken by another project on PyPi.

Author

Contributors

Ports

Rust


pyIslam

هي مكتبة إسلامية للغة البرمجة بايثون، توفر امكانية حساب أوقات الصلاة، اتجاه القبلة، التقويم الهجري، الزكاة والمواريث.

حاليا، المكتبة تستطيع أن تقوم بـ:

  • حساب مواقيت الصلاة
  • التحويل بين التاريخ الهجري والميلادي
  • تحديد اتجاه القبلة
  • حساب الزكاة
  • حساب الميراث

pyislam's People

Contributors

abougouffa avatar azzamsa avatar dani312 avatar hamza5 avatar mohsenuss91 avatar monsef-alahem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyislam's Issues

Prayer times calculation algoritm

Hi

Previously I am using API to fetch prayer times, because I thought they are always changing. But, after trying your module, the result is accurate.

Would you like to point the article/source of your prayer times algorithm calculation? In short, aren't they always changing every year?

Thank you.

Project restructure

Hi.

I used to use pyIslam before. Nowadays I am working with Rust. Having used Rust Islamic library, I got some errors and less precision. So I thought it's better to have pyIslam ported to Rust.

Upon porting. I find some difficulties, namely finding its return type and parameters type. Also, some class parameters in pyislam accept different types, such as MethodInfo or integer. This leads me to change the API but keep the logic intact.

To make porting easier, I made some changes to pyIslam:

  • add unit-test for Hijri, salah, qiblah, etc
  • add Github action for CI

Also, I had some questions:

If you accept the changes, I would also like to add release to PyPi step in the release.yml


This is my Rust port islam. It has the exact same result in its unit-test

ValueError: math domain error

The following inputs:

def test_praytimes_amsterdam():
    # Tested against
    # http://api.aladhan.com/v1/calendarByCity?city=Amsterdam&country=Netherlands&method=3&school=0&month=05&year=2022
    latitude = 52.3745403
    longitude = 4.89797551
    timezone = 2  # GMT+2

    fajr_isha_method = 2  # Muslim World League
    asr_fiqh = 1  # Shafii
    prayer_conf = PrayerConf(longitude, latitude, timezone, fajr_isha_method, asr_fiqh)
    prayer_time = Prayer(prayer_conf, date(2022, 5, 19))

    assert str(prayer_time.fajr_time()) == "03:14:00"
    assert str(prayer_time.sherook_time()) == "05:39:00"
    assert str(prayer_time.dohr_time()) == "13:37:00"
    assert str(prayer_time.asr_time()) == "17:52:00"
    assert str(prayer_time.maghreb_time()) == "21:35:00"
    assert str(prayer_time.ishaa_time()) == "23:52:00"

will result in a ValueError: math domain error inside praytimes@_get_time_for_angle when trying to evaluate sqrt(-s * s + 1) because the value of -s * s + 1 is negative.

I wanted to submit a patch instead of reporting the issue but I have no idea what all the variables represent :(

PyPi Package

Hi

I find this module is really helpful. I've checked the prayer time is accurate (compared to other website).

Would you like to put this in PyPi?

Thank you for pyislam.

سؤال حول المساعدة في إضافة ميزات أخرى

السلام عليكم،
خطرت ببالي فكرة إضافة إمكانية استخدام هذه المكتبة في البحث عن الأحاديث النبوية و درجتها من الصحة و الضعف، وربما بعض الأمور الأخرى المتعلقة بهذا المجال، يمكن سحب المعلومات من موقع الدرر السنية والذي يحوي معلومات موثقة بالمراجع في شتى العلوم الشرعية.
إذا أعجبتك الفكرة فيمكنني المساهمة فيها متى وجدت وقتا لذلك.
شكرا.

cannot import name

In the examples folder, praytimes.py is trying to import a variable named "LIST_FAJR_ISHA_METHODS" from pyIslam.praytimes, that variable does not exist in that file.

Avoid using single char name

Hi, Abdelhak.

I plan to refactor my Rust port. Primarily the baselib.
I am having a hard time understanding the equation because of single variable names such:

Are you able to rename those single-char names to a more descriptive name?

def equation_of_time(jd):
    '''Get equation of time'''
    n = jd - 2451544.5
    g = 357.528 + 0.9856003 * n
    c = 1.9148 * dsin(g) + 0.02 * dsin(2 * g) + 0.0003 * dsin(3 * g)
    lamda = 280.47 + 0.9856003 * n + c
    r = (-2.468 * dsin(2 * lamda)
         + 0.053 * dsin(4 * lamda)
         + 0.0014 * dsin(6 * lamda))
    return (c + r) * 4

jd would be julian_day, but I have no clue about n, g, c, etc.
Is the source also using a single char name?

Add more unit test

Hi, abougouffa.

I love this library, and I plan to port it to Rust.
Unfortunately, two things that make me slower are the type and unit test.
The most important one is the latter, I can confidently port each function and assess its correctness if pyislam had more unit tests.

Is it okay if I add the unit test and Github action CI to the repo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.