Skip to main content

shamy-hijri (Python)

Umm al-Qura (Hijri) calendar conversion with no dependencies. By Omar Elshamy. MIT. A matching JavaScript package lives in ../js and gives identical results.

تحويل التاريخ الهجري (أم القرى) والميلادي بدون أي مكتبات خارجية. من تطوير عمر الشامي. رخصة MIT. توجد نسخة JavaScript مطابقة في المجلد ../js.

Install / التثبيت

pip install .

Use / الاستخدام

import datetime as dt
from shamy_hijri import to_hijri, to_gregorian, HijriDate

h = to_hijri(dt.date(2024, 3, 11))
print(h)                                  # 1445-09-01
print(h.format())                         # 1 Ramadan 1445 AH
print(h.format("ar", arabic_digits=True)) # ١ رمضان ١٤٤٥ هـ
print(h.weekday_name_ar)                  # الاثنين
print(to_gregorian(1446, 1, 1))           # 2024-07-07

Also: month_length, year_length, is_valid, today, SUPPORTED_RANGE.

Range and accuracy / المدى والدقة

  • Supported: 1 Muharram 1343 AH (1924-08-01) to the end of 1500 AH (2077-11-16). Outside it, ValueError.
  • The month table follows the published Umm al-Qura calendar. Years before 1365 AH are historical and contain a few 28 or 31 day months. Official Umm al-Qura starts at 1356 AH.
  • Tested: round trip of every day in range, known reference dates (1 Ramadan 1445 = 2024-03-11, 1 Muharram 1446 = 2024-07-07, ...), and a cross-check against the independent hijri-converter package.
  • Umm al-Qura is an administrative calendar. Actual moon sighting in your country may differ by a day.

Month data credit: the table was cross-checked against the MIT licensed hijri-converter project.

Test

pip install pytest hijri-converter
pytest

Metadata

Release files for shamy-hijri 0.1.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 shamy-hijri 0.1.0
File Size Uploaded Provenance Actions
shamy_hijri-0.1.0.tar.gz 6.1 kB Without provenance Details for shamy_hijri-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shamy-hijri 0.1.0
File Interpreter ABI Platform Actions
shamy_hijri-0.1.0-py3-none-any.whl Python 3 none any Details for shamy_hijri-0.1.0-py3-none-any.whl

Total release size: 12.1 kB

Release files / shamy_hijri-0.1.0.tar.gz

Download URL shamy_hijri-0.1.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1eacb61a2f9e4298a86f455de6da9018ad62205868b93337699fee7ef6d218e1
BLAKE2b-256 checksum
How to use checksums
78c11d8f898d789d40a2f415b7c6f3951965bce10a0e0d3c042977f4e9fe087c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / shamy_hijri-0.1.0-py3-none-any.whl

Download URL shamy_hijri-0.1.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bbd9029594cd354db4f617a1c9c764d36b330006a38cbcd78a85fba3fbeb80c
BLAKE2b-256 checksum
How to use checksums
16bcbc05fbc128ad90844e2ef7267a9f7191ae6df08820c444238fbea7f2274e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for shamy-hijri 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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