hijri-datetime 0.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ from .hello import say_hello
2
+
3
+ __all__ = ["say_hello"]
File without changes
File without changes
hijri_datetime/date.py ADDED
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ def say_hello(name: str) -> str:
2
+ return f"Hello, {name}!"
File without changes
File without changes
File without changes
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.1
2
+ Name: hijri-datetime
3
+ Version: 0.0.0
4
+ Summary: Pythonic Hijri datetime — handle full & partial dates, ranges, and seamless Gregorian & Jalali conversion.
5
+ Author-email: "m.lotfi" <m.lotfi@email.com>
6
+ Maintainer-email: "m.lotfi" <m.lotfi@email.com>
7
+ License: GPL version 3
8
+ Project-URL: Homepage, https://github.com/mlotfic/hijri_datetime
9
+ Project-URL: Documentation, https://github.com/mlotfic/hijri_datetime#readme
10
+ Project-URL: Repository, https://github.com/mlotfic/hijri_datetime
11
+ Project-URL: Bug Tracker, https://github.com/mlotfic/hijri_datetime/issues
12
+ Project-URL: Changelog, https://github.com/mlotfic/hijri_datetime/blob/main/CHANGELOG.md
13
+ Keywords: python,package,modules,portable,hijri,islamic,calendar,datetime
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.6
20
+ Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Topic :: Software Development :: Libraries
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Requires-Python: >=3.8
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: jdatetime
33
+ Requires-Dist: requests
34
+ Requires-Dist: numpy
35
+ Requires-Dist: pandas
36
+
37
+ # hijri-datetime
38
+
39
+ 📅 **Hijri (Islamic) calendar datetime library for Python**
40
+ A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
41
+
42
+ ---
43
+
44
+ ## Features
45
+
46
+ - **HijriDate / HijriDateTime classes**
47
+ Drop-in replacement for `datetime.date` and `datetime.datetime`.
48
+
49
+ - **Partial Dates & Ranges**
50
+ Handle missing months or days gracefully:
51
+ - `HijriDate(1446)` → represents the full year.
52
+ - `HijriDate(1446, 2)` → represents all days of month 2.
53
+ - Arithmetic supports ranges and comparisons.
54
+
55
+ - **Gregorian ↔ Hijri Conversion**
56
+ - Vectorized conversion using preloaded dataset (from [Aladhan API](https://aladhan.com/islamic-calendar-api)).
57
+ - Accurate conversion for historical and future dates.
58
+
59
+ - **Integration with jdatetime**
60
+ Convert Hijri dates to Jalali calendar easily:
61
+ ```python
62
+ import jdatetime
63
+ jd = hijri_date.to_jdatetime()
64
+ ````
65
+
66
+ * **Full datetime API support**
67
+ Methods like `.year`, `.month`, `.day`, `.weekday()`, `.isoweekday()`, `.strftime()`, `.fromisoformat()`, `.today()`, `.now()`.
68
+
69
+ * **Calendar module compatibility**
70
+ Leap year checks, month lengths, weekdays, etc.
71
+
72
+ * **Vectorized / Bulk Conversion Support**
73
+ Efficient for millions of rows with pandas/numpy.
74
+
75
+ ---
76
+
77
+ ## Installation
78
+
79
+ ```bash
80
+ pip install hijri-datetime
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Quick Start
86
+
87
+ ```python
88
+ from hijri_datetime import HijriDate, HijriDateTime
89
+
90
+ # Create Hijri dates
91
+ d1 = HijriDate(1446, 2, 15) # Full date
92
+ d2 = HijriDate(1446, 2) # Day missing → treat as range
93
+ d3 = HijriDate(1446) # Month & day missing → full year range
94
+
95
+ # Convert to Gregorian
96
+ print(d1.to_gregorian()) # datetime.date(2025, 9, 9)
97
+ print(d2.to_gregorian_range()) # [datetime.date(2025,9,1), datetime.date(2025,9,30)]
98
+ print(d3.to_gregorian_range()) # full year range
99
+
100
+ # Date arithmetic
101
+ print(d1 + 10) # Add 10 days
102
+ print(d1 - 5) # Subtract 5 days
103
+
104
+ # jdatetime conversion
105
+ import jdatetime
106
+ jd = d1.to_jdatetime()
107
+ print(jd) # jdatetime.date(...)
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Partial Dates & Ranges
113
+
114
+ - `HijriDate(1446)` → represents the whole year.
115
+ - `HijriDate(1446, 2)` → represents all days of month 2.
116
+ - Conversion to Gregorian returns ranges:
117
+
118
+ * **Year only**
119
+
120
+ ```python
121
+ d = HijriDate(1446)
122
+ start, end = d.to_gregorian_range()
123
+ print(start, end) # 2024-07-18 2025-07-06 (example)
124
+ ```
125
+
126
+ * **Year and Month only**
127
+
128
+ ```python
129
+ d = HijriDate(1446, 2)
130
+ start, end = d.to_gregorian_range()
131
+ print(start, end) # 2025-09-01 2025-09-30 (example)
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Gregorian ↔ Hijri Conversion
137
+
138
+ ```python
139
+ from hijri_datetime import HijriConverter
140
+
141
+ converter = HijriConverter()
142
+
143
+ # Hijri → Gregorian
144
+ greg = converter.hijri_to_gregorian(1446, 2, 15)
145
+ print(greg) # datetime.date(2025, 9, 9)
146
+
147
+ # Gregorian → Hijri
148
+ hijri = converter.gregorian_to_hijri(greg)
149
+ print(hijri) # HijriDate(1446, 2, 15)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## jdatetime Integration
155
+
156
+ ```python
157
+ from hijri_datetime import HijriDate
158
+
159
+ d = HijriDate(1446, 2, 15)
160
+ jd = d.to_jdatetime()
161
+ print(jd) # jdatetime.date(2025, 6, 16) example
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Pandas / Vectorized Example
167
+
168
+ ```python
169
+ import pandas as pd
170
+ from hijri_datetime import HijriDate
171
+
172
+ dates = pd.Series([HijriDate(1446, 1, 1), HijriDate(1446, 2, 10)])
173
+ greg_dates = dates.apply(lambda x: x.to_gregorian())
174
+ print(greg_dates)
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Roadmap
180
+
181
+ * [ ] Full `calendar` module API compatibility
182
+ * [ ] Timezone-aware Hijri datetime
183
+ * [ ] Support for Umm al-Qura, tabular, and other Hijri variants
184
+ * [ ] Improved bulk conversion performance
185
+ * [ ] PyPI release with automated dataset update from Aladhan API
186
+
187
+ ---
188
+
189
+ ## Contributing
190
+
191
+ Pull requests are welcome! Please open an issue first to discuss major changes.
192
+ Could you make sure tests pass before submitting PRs?
193
+
194
+ ---
195
+
196
+ ## License
197
+
198
+ GNU License © 2025
@@ -0,0 +1,13 @@
1
+ hijri_datetime/__init__.py,sha256=i2SM-vSV4sCVWyVki7bQpsJSEAw-RPLMMEXV3-MCWGM,57
2
+ hijri_datetime/calendar.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ hijri_datetime/conversion.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ hijri_datetime/date.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ hijri_datetime/datetime.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ hijri_datetime/hello.py,sha256=PcWMF-H8OoHLsK4OW9QWYyMGnRsPz-hqLh916OLetPo,64
7
+ hijri_datetime/range.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ hijri_datetime/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ hijri_datetime-0.0.0.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ hijri_datetime-0.0.0.dist-info/METADATA,sha256=_owOHolrAL8btnyhETm11_91L-iuyOOCuonecoPdlyo,5770
11
+ hijri_datetime-0.0.0.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
12
+ hijri_datetime-0.0.0.dist-info/top_level.txt,sha256=3-byeAhSA03hoaPXanoyL76rRo5_FTCD9DIwk81fdck,15
13
+ hijri_datetime-0.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.3.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ hijri_datetime