hijri-datetime 0.1.0__tar.gz

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,180 @@
1
+ Metadata-Version: 2.2
2
+ Name: hijri-datetime
3
+ Version: 0.1.0
4
+ Author-email: "m.lotfi" <m.lotfi@email.com>
5
+ Maintainer-email: "m.lotfi" <m.lotfi@email.com>
6
+ License: MIT
7
+ Keywords: python,package,modules,portable,hijri,islamic,calendar,datetime
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+
23
+ # hijri-datetime
24
+
25
+ 📅 **Hijri (Islamic) calendar datetime library for Python**
26
+ A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
27
+
28
+ ---
29
+
30
+ ## Features
31
+
32
+ - **HijriDate / HijriDateTime classes**
33
+ Drop-in replacement for `datetime.date` and `datetime.datetime`.
34
+
35
+ - **Partial Dates & Ranges**
36
+ Handle missing months or days gracefully:
37
+ - `HijriDate(1446)` → represents the full year.
38
+ - `HijriDate(1446, 2)` → represents all days of month 2.
39
+ - Arithmetic supports ranges and comparisons.
40
+
41
+ - **Gregorian ↔ Hijri Conversion**
42
+ - Vectorized conversion using preloaded dataset (from [Aladhan API](https://aladhan.com/islamic-calendar-api)).
43
+ - Accurate conversion for historical and future dates.
44
+
45
+ - **Integration with jdatetime**
46
+ Convert Hijri dates to Jalali calendar easily:
47
+ ```python
48
+ import jdatetime
49
+ jd = hijri_date.to_jdatetime()
50
+ ````
51
+
52
+ * **Full datetime API support**
53
+ Methods like `.year`, `.month`, `.day`, `.weekday()`, `.isoweekday()`, `.strftime()`, `.fromisoformat()`, `.today()`, `.now()`.
54
+
55
+ * **Calendar module compatibility**
56
+ Leap year checks, month lengths, weekdays, etc.
57
+
58
+ * **Vectorized / Bulk Conversion Support**
59
+ Efficient for millions of rows with pandas/numpy.
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install hijri-datetime
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from hijri_datetime import HijriDate, HijriDateTime
75
+
76
+ # Create Hijri dates
77
+ d1 = HijriDate(1446, 2, 15) # Full date
78
+ d2 = HijriDate(1446, 2) # Day missing → treat as range
79
+ d3 = HijriDate(1446) # Month & day missing → full year range
80
+
81
+ # Convert to Gregorian
82
+ print(d1.to_gregorian()) # datetime.date(2025, 9, 9)
83
+ print(d2.to_gregorian_range()) # [datetime.date(2025,9,1), datetime.date(2025,9,30)]
84
+ print(d3.to_gregorian_range()) # full year range
85
+
86
+ # Date arithmetic
87
+ print(d1 + 10) # Add 10 days
88
+ print(d1 - 5) # Subtract 5 days
89
+
90
+ # jdatetime conversion
91
+ import jdatetime
92
+ jd = d1.to_jdatetime()
93
+ print(jd) # jdatetime.date(...)
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Partial Dates & Ranges
99
+
100
+ * **Year only**
101
+
102
+ ```python
103
+ d = HijriDate(1446)
104
+ start, end = d.to_gregorian_range()
105
+ print(start, end) # 2024-07-18 2025-07-06 (example)
106
+ ```
107
+
108
+ * **Month only**
109
+
110
+ ```python
111
+ d = HijriDate(1446, 2)
112
+ start, end = d.to_gregorian_range()
113
+ print(start, end) # 2025-09-01 2025-09-30 (example)
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Gregorian ↔ Hijri Conversion
119
+
120
+ ```python
121
+ from hijri_datetime import HijriConverter
122
+
123
+ converter = HijriConverter()
124
+
125
+ # Hijri → Gregorian
126
+ greg = converter.hijri_to_gregorian(1446, 2, 15)
127
+ print(greg) # datetime.date(2025, 9, 9)
128
+
129
+ # Gregorian → Hijri
130
+ hijri = converter.gregorian_to_hijri(greg)
131
+ print(hijri) # HijriDate(1446, 2, 15)
132
+ ```
133
+
134
+ ---
135
+
136
+ ## jdatetime Integration
137
+
138
+ ```python
139
+ from hijri_datetime import HijriDate
140
+
141
+ d = HijriDate(1446, 2, 15)
142
+ jd = d.to_jdatetime()
143
+ print(jd) # jdatetime.date(2025, 6, 16) example
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Pandas / Vectorized Example
149
+
150
+ ```python
151
+ import pandas as pd
152
+ from hijri_datetime import HijriDate
153
+
154
+ dates = pd.Series([HijriDate(1446, 1, 1), HijriDate(1446, 2, 10)])
155
+ greg_dates = dates.apply(lambda x: x.to_gregorian())
156
+ print(greg_dates)
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Roadmap
162
+
163
+ * [ ] Full `calendar` module API compatibility
164
+ * [ ] Timezone-aware Hijri datetime
165
+ * [ ] Support for Umm al-Qura, tabular, and other Hijri variants
166
+ * [ ] Improved bulk conversion performance
167
+ * [ ] PyPI release with automated dataset update from Aladhan API
168
+
169
+ ---
170
+
171
+ ## Contributing
172
+
173
+ Pull requests are welcome! Please open an issue first to discuss major changes.
174
+ Could you make sure tests pass before submitting PRs?
175
+
176
+ ---
177
+
178
+ ## License
179
+
180
+ GNU License © 2025
@@ -0,0 +1,158 @@
1
+ # hijri-datetime
2
+
3
+ 📅 **Hijri (Islamic) calendar datetime library for Python**
4
+ A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
5
+
6
+ ---
7
+
8
+ ## Features
9
+
10
+ - **HijriDate / HijriDateTime classes**
11
+ Drop-in replacement for `datetime.date` and `datetime.datetime`.
12
+
13
+ - **Partial Dates & Ranges**
14
+ Handle missing months or days gracefully:
15
+ - `HijriDate(1446)` → represents the full year.
16
+ - `HijriDate(1446, 2)` → represents all days of month 2.
17
+ - Arithmetic supports ranges and comparisons.
18
+
19
+ - **Gregorian ↔ Hijri Conversion**
20
+ - Vectorized conversion using preloaded dataset (from [Aladhan API](https://aladhan.com/islamic-calendar-api)).
21
+ - Accurate conversion for historical and future dates.
22
+
23
+ - **Integration with jdatetime**
24
+ Convert Hijri dates to Jalali calendar easily:
25
+ ```python
26
+ import jdatetime
27
+ jd = hijri_date.to_jdatetime()
28
+ ````
29
+
30
+ * **Full datetime API support**
31
+ Methods like `.year`, `.month`, `.day`, `.weekday()`, `.isoweekday()`, `.strftime()`, `.fromisoformat()`, `.today()`, `.now()`.
32
+
33
+ * **Calendar module compatibility**
34
+ Leap year checks, month lengths, weekdays, etc.
35
+
36
+ * **Vectorized / Bulk Conversion Support**
37
+ Efficient for millions of rows with pandas/numpy.
38
+
39
+ ---
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install hijri-datetime
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Quick Start
50
+
51
+ ```python
52
+ from hijri_datetime import HijriDate, HijriDateTime
53
+
54
+ # Create Hijri dates
55
+ d1 = HijriDate(1446, 2, 15) # Full date
56
+ d2 = HijriDate(1446, 2) # Day missing → treat as range
57
+ d3 = HijriDate(1446) # Month & day missing → full year range
58
+
59
+ # Convert to Gregorian
60
+ print(d1.to_gregorian()) # datetime.date(2025, 9, 9)
61
+ print(d2.to_gregorian_range()) # [datetime.date(2025,9,1), datetime.date(2025,9,30)]
62
+ print(d3.to_gregorian_range()) # full year range
63
+
64
+ # Date arithmetic
65
+ print(d1 + 10) # Add 10 days
66
+ print(d1 - 5) # Subtract 5 days
67
+
68
+ # jdatetime conversion
69
+ import jdatetime
70
+ jd = d1.to_jdatetime()
71
+ print(jd) # jdatetime.date(...)
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Partial Dates & Ranges
77
+
78
+ * **Year only**
79
+
80
+ ```python
81
+ d = HijriDate(1446)
82
+ start, end = d.to_gregorian_range()
83
+ print(start, end) # 2024-07-18 2025-07-06 (example)
84
+ ```
85
+
86
+ * **Month only**
87
+
88
+ ```python
89
+ d = HijriDate(1446, 2)
90
+ start, end = d.to_gregorian_range()
91
+ print(start, end) # 2025-09-01 2025-09-30 (example)
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Gregorian ↔ Hijri Conversion
97
+
98
+ ```python
99
+ from hijri_datetime import HijriConverter
100
+
101
+ converter = HijriConverter()
102
+
103
+ # Hijri → Gregorian
104
+ greg = converter.hijri_to_gregorian(1446, 2, 15)
105
+ print(greg) # datetime.date(2025, 9, 9)
106
+
107
+ # Gregorian → Hijri
108
+ hijri = converter.gregorian_to_hijri(greg)
109
+ print(hijri) # HijriDate(1446, 2, 15)
110
+ ```
111
+
112
+ ---
113
+
114
+ ## jdatetime Integration
115
+
116
+ ```python
117
+ from hijri_datetime import HijriDate
118
+
119
+ d = HijriDate(1446, 2, 15)
120
+ jd = d.to_jdatetime()
121
+ print(jd) # jdatetime.date(2025, 6, 16) example
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Pandas / Vectorized Example
127
+
128
+ ```python
129
+ import pandas as pd
130
+ from hijri_datetime import HijriDate
131
+
132
+ dates = pd.Series([HijriDate(1446, 1, 1), HijriDate(1446, 2, 10)])
133
+ greg_dates = dates.apply(lambda x: x.to_gregorian())
134
+ print(greg_dates)
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Roadmap
140
+
141
+ * [ ] Full `calendar` module API compatibility
142
+ * [ ] Timezone-aware Hijri datetime
143
+ * [ ] Support for Umm al-Qura, tabular, and other Hijri variants
144
+ * [ ] Improved bulk conversion performance
145
+ * [ ] PyPI release with automated dataset update from Aladhan API
146
+
147
+ ---
148
+
149
+ ## Contributing
150
+
151
+ Pull requests are welcome! Please open an issue first to discuss major changes.
152
+ Could you make sure tests pass before submitting PRs?
153
+
154
+ ---
155
+
156
+ ## License
157
+
158
+ GNU License © 2025
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools<77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "hijri-datetime"
7
+ version = "0.1.0"
8
+ license = { text = "MIT" } # old-style, accepted
9
+ classifiers = [
10
+ "License :: OSI Approved :: MIT License",
11
+ "Development Status :: 3 - Alpha",
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.8",
15
+ "Programming Language :: Python :: 3.9",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Operating System :: OS Independent",
20
+ "Topic :: Software Development :: Libraries",
21
+ "Topic :: Software Development :: Libraries :: Python Modules",
22
+ ]
23
+
24
+ authors = [
25
+ { name = "m.lotfi", email = "m.lotfi@email.com" },
26
+ ]
27
+ maintainers = [
28
+ { name = "m.lotfi", email = "m.lotfi@email.com" },
29
+ ]
30
+
31
+ keywords = [
32
+ "python", "package", "modules", "portable",
33
+ "hijri", "islamic", "calendar", "datetime"
34
+ ]
35
+ readme = { file = "README.md", content-type = "text/markdown" }
36
+ requires-python = ">=3.8"
37
+
38
+
39
+
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .hello import say_hello
2
+
3
+ __all__ = ["say_hello"]
@@ -0,0 +1,2 @@
1
+ def say_hello(name: str) -> str:
2
+ return f"Hello, {name}!"
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.2
2
+ Name: hijri-datetime
3
+ Version: 0.1.0
4
+ Author-email: "m.lotfi" <m.lotfi@email.com>
5
+ Maintainer-email: "m.lotfi" <m.lotfi@email.com>
6
+ License: MIT
7
+ Keywords: python,package,modules,portable,hijri,islamic,calendar,datetime
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+
23
+ # hijri-datetime
24
+
25
+ 📅 **Hijri (Islamic) calendar datetime library for Python**
26
+ A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
27
+
28
+ ---
29
+
30
+ ## Features
31
+
32
+ - **HijriDate / HijriDateTime classes**
33
+ Drop-in replacement for `datetime.date` and `datetime.datetime`.
34
+
35
+ - **Partial Dates & Ranges**
36
+ Handle missing months or days gracefully:
37
+ - `HijriDate(1446)` → represents the full year.
38
+ - `HijriDate(1446, 2)` → represents all days of month 2.
39
+ - Arithmetic supports ranges and comparisons.
40
+
41
+ - **Gregorian ↔ Hijri Conversion**
42
+ - Vectorized conversion using preloaded dataset (from [Aladhan API](https://aladhan.com/islamic-calendar-api)).
43
+ - Accurate conversion for historical and future dates.
44
+
45
+ - **Integration with jdatetime**
46
+ Convert Hijri dates to Jalali calendar easily:
47
+ ```python
48
+ import jdatetime
49
+ jd = hijri_date.to_jdatetime()
50
+ ````
51
+
52
+ * **Full datetime API support**
53
+ Methods like `.year`, `.month`, `.day`, `.weekday()`, `.isoweekday()`, `.strftime()`, `.fromisoformat()`, `.today()`, `.now()`.
54
+
55
+ * **Calendar module compatibility**
56
+ Leap year checks, month lengths, weekdays, etc.
57
+
58
+ * **Vectorized / Bulk Conversion Support**
59
+ Efficient for millions of rows with pandas/numpy.
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install hijri-datetime
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from hijri_datetime import HijriDate, HijriDateTime
75
+
76
+ # Create Hijri dates
77
+ d1 = HijriDate(1446, 2, 15) # Full date
78
+ d2 = HijriDate(1446, 2) # Day missing → treat as range
79
+ d3 = HijriDate(1446) # Month & day missing → full year range
80
+
81
+ # Convert to Gregorian
82
+ print(d1.to_gregorian()) # datetime.date(2025, 9, 9)
83
+ print(d2.to_gregorian_range()) # [datetime.date(2025,9,1), datetime.date(2025,9,30)]
84
+ print(d3.to_gregorian_range()) # full year range
85
+
86
+ # Date arithmetic
87
+ print(d1 + 10) # Add 10 days
88
+ print(d1 - 5) # Subtract 5 days
89
+
90
+ # jdatetime conversion
91
+ import jdatetime
92
+ jd = d1.to_jdatetime()
93
+ print(jd) # jdatetime.date(...)
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Partial Dates & Ranges
99
+
100
+ * **Year only**
101
+
102
+ ```python
103
+ d = HijriDate(1446)
104
+ start, end = d.to_gregorian_range()
105
+ print(start, end) # 2024-07-18 2025-07-06 (example)
106
+ ```
107
+
108
+ * **Month only**
109
+
110
+ ```python
111
+ d = HijriDate(1446, 2)
112
+ start, end = d.to_gregorian_range()
113
+ print(start, end) # 2025-09-01 2025-09-30 (example)
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Gregorian ↔ Hijri Conversion
119
+
120
+ ```python
121
+ from hijri_datetime import HijriConverter
122
+
123
+ converter = HijriConverter()
124
+
125
+ # Hijri → Gregorian
126
+ greg = converter.hijri_to_gregorian(1446, 2, 15)
127
+ print(greg) # datetime.date(2025, 9, 9)
128
+
129
+ # Gregorian → Hijri
130
+ hijri = converter.gregorian_to_hijri(greg)
131
+ print(hijri) # HijriDate(1446, 2, 15)
132
+ ```
133
+
134
+ ---
135
+
136
+ ## jdatetime Integration
137
+
138
+ ```python
139
+ from hijri_datetime import HijriDate
140
+
141
+ d = HijriDate(1446, 2, 15)
142
+ jd = d.to_jdatetime()
143
+ print(jd) # jdatetime.date(2025, 6, 16) example
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Pandas / Vectorized Example
149
+
150
+ ```python
151
+ import pandas as pd
152
+ from hijri_datetime import HijriDate
153
+
154
+ dates = pd.Series([HijriDate(1446, 1, 1), HijriDate(1446, 2, 10)])
155
+ greg_dates = dates.apply(lambda x: x.to_gregorian())
156
+ print(greg_dates)
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Roadmap
162
+
163
+ * [ ] Full `calendar` module API compatibility
164
+ * [ ] Timezone-aware Hijri datetime
165
+ * [ ] Support for Umm al-Qura, tabular, and other Hijri variants
166
+ * [ ] Improved bulk conversion performance
167
+ * [ ] PyPI release with automated dataset update from Aladhan API
168
+
169
+ ---
170
+
171
+ ## Contributing
172
+
173
+ Pull requests are welcome! Please open an issue first to discuss major changes.
174
+ Could you make sure tests pass before submitting PRs?
175
+
176
+ ---
177
+
178
+ ## License
179
+
180
+ GNU License © 2025
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/hijri_datetime/__init__.py
4
+ src/hijri_datetime/hello.py
5
+ src/hijri_datetime.egg-info/PKG-INFO
6
+ src/hijri_datetime.egg-info/SOURCES.txt
7
+ src/hijri_datetime.egg-info/dependency_links.txt
8
+ src/hijri_datetime.egg-info/top_level.txt
9
+ tests/test_hello.py
@@ -0,0 +1 @@
1
+ hijri_datetime
@@ -0,0 +1,4 @@
1
+ from hijri_datetime import say_hello
2
+
3
+ def test_say_hello():
4
+ assert say_hello("World") == "Hello, World!"