hijri-datetime 0.1.1__tar.gz → 0.2.3.post0__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.
- hijri_datetime-0.2.3.post0/.github/workflows/release.yml +45 -0
- hijri_datetime-0.2.3.post0/.gitignore +207 -0
- hijri_datetime-0.2.3.post0/MANIFEST.in +8 -0
- {hijri_datetime-0.1.1/src/hijri_datetime.egg-info → hijri_datetime-0.2.3.post0}/PKG-INFO +70 -7
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/README.md +2 -0
- hijri_datetime-0.2.3.post0/clean_build_dirs.py +76 -0
- hijri_datetime-0.2.3.post0/pyproject.toml +230 -0
- hijri_datetime-0.2.3.post0/src/hijri_datetime/__init__.py +97 -0
- hijri_datetime-0.2.3.post0/src/hijri_datetime/_version.py +34 -0
- hijri_datetime-0.2.3.post0/src/hijri_datetime/constants.py +64 -0
- hijri_datetime-0.2.3.post0/src/hijri_datetime/date.py +135 -0
- hijri_datetime-0.2.3.post0/src/hijri_datetime/exceptions.py +26 -0
- hijri_datetime-0.2.3.post0/src/hijri_datetime/utils.py +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0/src/hijri_datetime.egg-info}/PKG-INFO +70 -7
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime.egg-info/SOURCES.txt +11 -1
- hijri_datetime-0.2.3.post0/src/hijri_datetime.egg-info/requires.txt +55 -0
- hijri_datetime-0.2.3.post0/tests/conftest.py +23 -0
- hijri_datetime-0.1.1/pyproject.toml +0 -45
- hijri_datetime-0.1.1/src/hijri_datetime/__init__.py +0 -3
- hijri_datetime-0.1.1/tests/test_hello.py +0 -4
- /hijri_datetime-0.1.1/LICENSE → /hijri_datetime-0.2.3.post0/CHANGELOG.md +0 -0
- /hijri_datetime-0.1.1/src/hijri_datetime/calendar.py → /hijri_datetime-0.2.3.post0/LICENSE +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/setup.cfg +0 -0
- /hijri_datetime-0.1.1/src/hijri_datetime/conversion.py → /hijri_datetime-0.2.3.post0/src/hijri_datetime/calendar.py +0 -0
- /hijri_datetime-0.1.1/src/hijri_datetime/date.py → /hijri_datetime-0.2.3.post0/src/hijri_datetime/conversion.py +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime/datetime.py +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime/hello.py +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime/range.py +0 -0
- /hijri_datetime-0.1.1/src/hijri_datetime/utils.py → /hijri_datetime-0.2.3.post0/src/hijri_datetime/time.py +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime.egg-info/dependency_links.txt +0 -0
- {hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime.egg-info/top_level.txt +0 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*.*.*' # Matches tags like v1.2.3
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
name: Build and Release
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- name: Checkout code
|
15
|
+
uses: actions/checkout@v4
|
16
|
+
|
17
|
+
- name: Set up Python
|
18
|
+
uses: actions/setup-python@v5
|
19
|
+
with:
|
20
|
+
python-version: '3.10'
|
21
|
+
|
22
|
+
- name: Install dependencies
|
23
|
+
run: |
|
24
|
+
python -m pip install --upgrade pip
|
25
|
+
pip install setuptools wheel twine
|
26
|
+
|
27
|
+
- run: python -m build
|
28
|
+
|
29
|
+
- name: Publish to PyPI
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
31
|
+
with:
|
32
|
+
user: m_lotfi
|
33
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
34
|
+
|
35
|
+
- name: Build package
|
36
|
+
run: |
|
37
|
+
python setup.py sdist bdist_wheel
|
38
|
+
|
39
|
+
- name: Create GitHub Release
|
40
|
+
uses: softprops/action-gh-release@v2
|
41
|
+
with:
|
42
|
+
generate_release_notes: true
|
43
|
+
env:
|
44
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
45
|
+
|
@@ -0,0 +1,207 @@
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
2
|
+
__pycache__/
|
3
|
+
*.py[codz]
|
4
|
+
*$py.class
|
5
|
+
|
6
|
+
# C extensions
|
7
|
+
*.so
|
8
|
+
|
9
|
+
# Distribution / packaging
|
10
|
+
.Python
|
11
|
+
build/
|
12
|
+
develop-eggs/
|
13
|
+
dist/
|
14
|
+
downloads/
|
15
|
+
eggs/
|
16
|
+
.eggs/
|
17
|
+
lib/
|
18
|
+
lib64/
|
19
|
+
parts/
|
20
|
+
sdist/
|
21
|
+
var/
|
22
|
+
wheels/
|
23
|
+
share/python-wheels/
|
24
|
+
*.egg-info/
|
25
|
+
.installed.cfg
|
26
|
+
*.egg
|
27
|
+
MANIFEST
|
28
|
+
|
29
|
+
# PyInstaller
|
30
|
+
# Usually these files are written by a python script from a template
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32
|
+
*.manifest
|
33
|
+
*.spec
|
34
|
+
|
35
|
+
# Installer logs
|
36
|
+
pip-log.txt
|
37
|
+
pip-delete-this-directory.txt
|
38
|
+
|
39
|
+
# Unit test / coverage reports
|
40
|
+
htmlcov/
|
41
|
+
.tox/
|
42
|
+
.nox/
|
43
|
+
.coverage
|
44
|
+
.coverage.*
|
45
|
+
.cache
|
46
|
+
nosetests.xml
|
47
|
+
coverage.xml
|
48
|
+
*.cover
|
49
|
+
*.py.cover
|
50
|
+
.hypothesis/
|
51
|
+
.pytest_cache/
|
52
|
+
cover/
|
53
|
+
|
54
|
+
# Translations
|
55
|
+
*.mo
|
56
|
+
*.pot
|
57
|
+
|
58
|
+
# Django stuff:
|
59
|
+
*.log
|
60
|
+
local_settings.py
|
61
|
+
db.sqlite3
|
62
|
+
db.sqlite3-journal
|
63
|
+
|
64
|
+
# Flask stuff:
|
65
|
+
instance/
|
66
|
+
.webassets-cache
|
67
|
+
|
68
|
+
# Scrapy stuff:
|
69
|
+
.scrapy
|
70
|
+
|
71
|
+
# Sphinx documentation
|
72
|
+
docs/_build/
|
73
|
+
|
74
|
+
# PyBuilder
|
75
|
+
.pybuilder/
|
76
|
+
target/
|
77
|
+
|
78
|
+
# Jupyter Notebook
|
79
|
+
.ipynb_checkpoints
|
80
|
+
|
81
|
+
# IPython
|
82
|
+
profile_default/
|
83
|
+
ipython_config.py
|
84
|
+
|
85
|
+
# pyenv
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
88
|
+
# .python-version
|
89
|
+
|
90
|
+
# pipenv
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94
|
+
# install all needed dependencies.
|
95
|
+
#Pipfile.lock
|
96
|
+
|
97
|
+
# UV
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100
|
+
# commonly ignored for libraries.
|
101
|
+
#uv.lock
|
102
|
+
|
103
|
+
# poetry
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
106
|
+
# commonly ignored for libraries.
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
108
|
+
#poetry.lock
|
109
|
+
#poetry.toml
|
110
|
+
|
111
|
+
# pdm
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
115
|
+
#pdm.lock
|
116
|
+
#pdm.toml
|
117
|
+
.pdm-python
|
118
|
+
.pdm-build/
|
119
|
+
|
120
|
+
# pixi
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
122
|
+
#pixi.lock
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
125
|
+
.pixi
|
126
|
+
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
128
|
+
__pypackages__/
|
129
|
+
|
130
|
+
# Celery stuff
|
131
|
+
celerybeat-schedule
|
132
|
+
celerybeat.pid
|
133
|
+
|
134
|
+
# SageMath parsed files
|
135
|
+
*.sage.py
|
136
|
+
|
137
|
+
# Environments
|
138
|
+
.env
|
139
|
+
.envrc
|
140
|
+
.venv
|
141
|
+
env/
|
142
|
+
venv/
|
143
|
+
ENV/
|
144
|
+
env.bak/
|
145
|
+
venv.bak/
|
146
|
+
|
147
|
+
# Spyder project settings
|
148
|
+
.spyderproject
|
149
|
+
.spyproject
|
150
|
+
|
151
|
+
# Rope project settings
|
152
|
+
.ropeproject
|
153
|
+
|
154
|
+
# mkdocs documentation
|
155
|
+
/site
|
156
|
+
|
157
|
+
# mypy
|
158
|
+
.mypy_cache/
|
159
|
+
.dmypy.json
|
160
|
+
dmypy.json
|
161
|
+
|
162
|
+
# Pyre type checker
|
163
|
+
.pyre/
|
164
|
+
|
165
|
+
# pytype static type analyzer
|
166
|
+
.pytype/
|
167
|
+
|
168
|
+
# Cython debug symbols
|
169
|
+
cython_debug/
|
170
|
+
|
171
|
+
# PyCharm
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
176
|
+
#.idea/
|
177
|
+
|
178
|
+
# Abstra
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
181
|
+
# Learn more at https://abstra.io/docs
|
182
|
+
.abstra/
|
183
|
+
|
184
|
+
# Visual Studio Code
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
189
|
+
# .vscode/
|
190
|
+
|
191
|
+
# Ruff stuff:
|
192
|
+
.ruff_cache/
|
193
|
+
|
194
|
+
# PyPI configuration file
|
195
|
+
.pypirc
|
196
|
+
|
197
|
+
# Cursor
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
201
|
+
.cursorignore
|
202
|
+
.cursorindexingignore
|
203
|
+
|
204
|
+
# Marimo
|
205
|
+
marimo/_static/
|
206
|
+
marimo/_lsp/
|
207
|
+
__marimo__/
|
@@ -1,13 +1,23 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: hijri-datetime
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.3.post0
|
4
|
+
Summary: Pythonic Hijri datetime — handle full & partial dates, ranges, and seamless Gregorian & Jalali conversion.
|
4
5
|
Author-email: "m.lotfi" <m.lotfi@email.com>
|
5
6
|
Maintainer-email: "m.lotfi" <m.lotfi@email.com>
|
6
|
-
License:
|
7
|
-
|
8
|
-
|
9
|
-
|
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.git
|
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
|
+
Project-URL: Source Code, https://github.com/mlotfic/hijri-datetime
|
14
|
+
Project-URL: Download, https://pypi.org/project/hijri-datetime/
|
15
|
+
Keywords: python,package,modules,portable,hijri,islamic,calendar,datetime,gregorian,jalali,conversion
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
17
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
10
18
|
Classifier: Intended Audience :: Developers
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
11
21
|
Classifier: Programming Language :: Python :: 3
|
12
22
|
Classifier: Programming Language :: Python :: 3.8
|
13
23
|
Classifier: Programming Language :: Python :: 3.9
|
@@ -15,14 +25,67 @@ Classifier: Programming Language :: Python :: 3.10
|
|
15
25
|
Classifier: Programming Language :: Python :: 3.11
|
16
26
|
Classifier: Programming Language :: Python :: 3.12
|
17
27
|
Classifier: Operating System :: OS Independent
|
18
|
-
Classifier: Topic ::
|
19
|
-
Classifier: Topic :: Software Development ::
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
29
|
+
Classifier: Topic :: Software Development :: Internationalization
|
30
|
+
Classifier: Topic :: Utilities
|
20
31
|
Requires-Python: >=3.8
|
21
32
|
Description-Content-Type: text/markdown
|
22
33
|
License-File: LICENSE
|
34
|
+
Requires-Dist: jdatetime>=3.0.0
|
35
|
+
Requires-Dist: requests>=2.20.0
|
36
|
+
Requires-Dist: numpy>=1.18.0
|
37
|
+
Requires-Dist: pandas>=1.0.0
|
38
|
+
Provides-Extra: dev
|
39
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
40
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
41
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
42
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
43
|
+
Requires-Dist: mypy>=0.900; extra == "dev"
|
44
|
+
Requires-Dist: pre-commit>=2.0; extra == "dev"
|
45
|
+
Requires-Dist: tox>=3.0; extra == "dev"
|
46
|
+
Requires-Dist: build>=0.10; extra == "dev"
|
47
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
48
|
+
Requires-Dist: setuptools_scm>=6.2; extra == "dev"
|
49
|
+
Requires-Dist: setuptools>=45; extra == "dev"
|
50
|
+
Requires-Dist: wheel; extra == "dev"
|
51
|
+
Requires-Dist: sphinx>=4.0; extra == "dev"
|
52
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "dev"
|
53
|
+
Provides-Extra: test
|
54
|
+
Requires-Dist: pytest>=6.0; extra == "test"
|
55
|
+
Requires-Dist: pytest-cov>=2.0; extra == "test"
|
56
|
+
Requires-Dist: pytest-mock>=3.0; extra == "test"
|
57
|
+
Provides-Extra: docs
|
58
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
59
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
|
60
|
+
Requires-Dist: myst-parser>=0.17.0; extra == "docs"
|
61
|
+
Provides-Extra: lint
|
62
|
+
Requires-Dist: black>=22.0; extra == "lint"
|
63
|
+
Requires-Dist: flake8>=4.0; extra == "lint"
|
64
|
+
Requires-Dist: mypy>=0.900; extra == "lint"
|
65
|
+
Requires-Dist: isort>=5.0; extra == "lint"
|
66
|
+
Provides-Extra: all
|
67
|
+
Requires-Dist: pytest>=6.0; extra == "all"
|
68
|
+
Requires-Dist: pytest-cov>=2.0; extra == "all"
|
69
|
+
Requires-Dist: pytest-mock>=3.0; extra == "all"
|
70
|
+
Requires-Dist: black>=22.0; extra == "all"
|
71
|
+
Requires-Dist: flake8>=4.0; extra == "all"
|
72
|
+
Requires-Dist: mypy>=0.900; extra == "all"
|
73
|
+
Requires-Dist: isort>=5.0; extra == "all"
|
74
|
+
Requires-Dist: pre-commit>=2.0; extra == "all"
|
75
|
+
Requires-Dist: tox>=3.0; extra == "all"
|
76
|
+
Requires-Dist: build>=0.10; extra == "all"
|
77
|
+
Requires-Dist: twine>=4.0; extra == "all"
|
78
|
+
Requires-Dist: setuptools_scm>=6.2; extra == "all"
|
79
|
+
Requires-Dist: setuptools>=45; extra == "all"
|
80
|
+
Requires-Dist: wheel; extra == "all"
|
81
|
+
Requires-Dist: sphinx>=4.0; extra == "all"
|
82
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "all"
|
83
|
+
Requires-Dist: myst-parser>=0.17.0; extra == "all"
|
23
84
|
|
24
85
|
# hijri-datetime
|
25
86
|
|
87
|
+
# 💡💡💡💡💡💡 **this not working yet** 💡💡💡💡
|
88
|
+
|
26
89
|
📅 **Hijri (Islamic) calendar datetime library for Python**
|
27
90
|
A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
|
28
91
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# hijri-datetime
|
2
2
|
|
3
|
+
# 💡💡💡💡💡💡 **this not working yet** 💡💡💡💡
|
4
|
+
|
3
5
|
📅 **Hijri (Islamic) calendar datetime library for Python**
|
4
6
|
A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
|
5
7
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import os
|
2
|
+
import shutil
|
3
|
+
|
4
|
+
def remove_egg_info_recursively(root="."):
|
5
|
+
"""
|
6
|
+
Recursively remove all directories ending with `.egg-info` starting from `root`.
|
7
|
+
"""
|
8
|
+
for dirpath, dirnames, _ in os.walk(root):
|
9
|
+
# Make a copy of dirnames because we may modify it while iterating
|
10
|
+
for dirname in dirnames[:]:
|
11
|
+
if dirname.endswith(".egg-info"):
|
12
|
+
full_path = os.path.join(dirpath, dirname)
|
13
|
+
print(f"Removing {full_path}/ ...")
|
14
|
+
shutil.rmtree(full_path)
|
15
|
+
# remove from dirnames so os.walk doesn't descend into it
|
16
|
+
dirnames.remove(dirname)
|
17
|
+
|
18
|
+
|
19
|
+
def clean_build_dirs():
|
20
|
+
"""
|
21
|
+
Remove build artifact directories if they exist:
|
22
|
+
- dist/
|
23
|
+
- any *.egg-info directory
|
24
|
+
"""
|
25
|
+
# Always check 'dist'
|
26
|
+
if os.path.exists("dist"):
|
27
|
+
print("Removing dist/ ...")
|
28
|
+
shutil.rmtree("dist")
|
29
|
+
else:
|
30
|
+
print("dist/ not found, skipping.")
|
31
|
+
|
32
|
+
remove_egg_info_recursively()
|
33
|
+
|
34
|
+
|
35
|
+
if __name__ == "__main__":
|
36
|
+
clean_build_dirs()
|
37
|
+
|
38
|
+
|
39
|
+
'''
|
40
|
+
# python -m build
|
41
|
+
|
42
|
+
# twine upload --repository testpypi dist/*
|
43
|
+
|
44
|
+
|
45
|
+
# Make a small commit (even just updating a comment)
|
46
|
+
git add .
|
47
|
+
git config --global --add safe.directory E:/GitHub/hijri-datetime
|
48
|
+
git add .
|
49
|
+
git commit -m "Bump version for new release"
|
50
|
+
|
51
|
+
# Rebuild - this will create a version like 0.0.1.dev1+g1234567
|
52
|
+
python -m build
|
53
|
+
|
54
|
+
git tag v0.2.0
|
55
|
+
git push origin v0.2.0
|
56
|
+
python -m build
|
57
|
+
twine upload dist/*
|
58
|
+
|
59
|
+
# 5. Install development dependencies
|
60
|
+
pip install -e ".[dev]"
|
61
|
+
|
62
|
+
# 6. Set up pre-commit hooks
|
63
|
+
pre-commit install
|
64
|
+
|
65
|
+
# 7. Run initial tests
|
66
|
+
pytest
|
67
|
+
|
68
|
+
# 8. Build the package
|
69
|
+
python -m build
|
70
|
+
|
71
|
+
# 9. Check the package
|
72
|
+
twine check dist/*
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
'''
|
@@ -0,0 +1,230 @@
|
|
1
|
+
# -----------------------------
|
2
|
+
# Build System (required)
|
3
|
+
# -----------------------------
|
4
|
+
[build-system]
|
5
|
+
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
|
6
|
+
build-backend = "setuptools.build_meta"
|
7
|
+
|
8
|
+
# -----------------------------
|
9
|
+
# Project Metadata
|
10
|
+
# -----------------------------
|
11
|
+
[project]
|
12
|
+
name = "hijri-datetime"
|
13
|
+
dynamic = ["version"]
|
14
|
+
requires-python = ">=3.8"
|
15
|
+
authors = [
|
16
|
+
{ name = "m.lotfi", email = "m.lotfi@email.com" },
|
17
|
+
]
|
18
|
+
maintainers = [
|
19
|
+
{ name = "m.lotfi", email = "m.lotfi@email.com" },
|
20
|
+
]
|
21
|
+
description = "Pythonic Hijri datetime — handle full & partial dates, ranges, and seamless Gregorian & Jalali conversion."
|
22
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
23
|
+
license = { text = "GPL version 3" }
|
24
|
+
|
25
|
+
keywords = [
|
26
|
+
"python", "package", "modules", "portable",
|
27
|
+
"hijri", "islamic", "calendar", "datetime",
|
28
|
+
"gregorian", "jalali", "conversion"
|
29
|
+
]
|
30
|
+
|
31
|
+
classifiers = [
|
32
|
+
"Development Status :: 4 - Beta",
|
33
|
+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
34
|
+
"Intended Audience :: Developers",
|
35
|
+
"Topic :: Software Development :: Libraries",
|
36
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
37
|
+
"Programming Language :: Python :: 3",
|
38
|
+
"Programming Language :: Python :: 3.8",
|
39
|
+
"Programming Language :: Python :: 3.9",
|
40
|
+
"Programming Language :: Python :: 3.10",
|
41
|
+
"Programming Language :: Python :: 3.11",
|
42
|
+
"Programming Language :: Python :: 3.12",
|
43
|
+
"Operating System :: OS Independent",
|
44
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
45
|
+
"Topic :: Software Development :: Internationalization",
|
46
|
+
"Topic :: Utilities",
|
47
|
+
]
|
48
|
+
|
49
|
+
# -----------------------------
|
50
|
+
# Runtime dependencies
|
51
|
+
# -----------------------------
|
52
|
+
dependencies = [
|
53
|
+
"jdatetime>=3.0.0",
|
54
|
+
"requests>=2.20.0",
|
55
|
+
"numpy>=1.18.0",
|
56
|
+
"pandas>=1.0.0"
|
57
|
+
]
|
58
|
+
|
59
|
+
# -----------------------------
|
60
|
+
# Optional dependencies
|
61
|
+
# -----------------------------
|
62
|
+
[project.optional-dependencies]
|
63
|
+
dev = [
|
64
|
+
"pytest>=6.0",
|
65
|
+
"pytest-cov>=2.0",
|
66
|
+
"black>=22.0",
|
67
|
+
"flake8>=4.0",
|
68
|
+
"mypy>=0.900",
|
69
|
+
"pre-commit>=2.0",
|
70
|
+
"tox>=3.0",
|
71
|
+
"build>=0.10",
|
72
|
+
"twine>=4.0",
|
73
|
+
"setuptools_scm>=6.2",
|
74
|
+
"setuptools>=45",
|
75
|
+
"wheel",
|
76
|
+
"sphinx>=4.0",
|
77
|
+
"sphinx-rtd-theme>=1.0",
|
78
|
+
]
|
79
|
+
|
80
|
+
test = [
|
81
|
+
"pytest>=6.0",
|
82
|
+
"pytest-cov>=2.0",
|
83
|
+
"pytest-mock>=3.0",
|
84
|
+
]
|
85
|
+
|
86
|
+
docs = [
|
87
|
+
"sphinx>=4.0",
|
88
|
+
"sphinx-rtd-theme>=1.0",
|
89
|
+
"myst-parser>=0.17.0",
|
90
|
+
]
|
91
|
+
|
92
|
+
lint = [
|
93
|
+
"black>=22.0",
|
94
|
+
"flake8>=4.0",
|
95
|
+
"mypy>=0.900",
|
96
|
+
"isort>=5.0",
|
97
|
+
]
|
98
|
+
|
99
|
+
all = [
|
100
|
+
"pytest>=6.0",
|
101
|
+
"pytest-cov>=2.0",
|
102
|
+
"pytest-mock>=3.0",
|
103
|
+
"black>=22.0",
|
104
|
+
"flake8>=4.0",
|
105
|
+
"mypy>=0.900",
|
106
|
+
"isort>=5.0",
|
107
|
+
"pre-commit>=2.0",
|
108
|
+
"tox>=3.0",
|
109
|
+
"build>=0.10",
|
110
|
+
"twine>=4.0",
|
111
|
+
"setuptools_scm>=6.2",
|
112
|
+
"setuptools>=45",
|
113
|
+
"wheel",
|
114
|
+
"sphinx>=4.0",
|
115
|
+
"sphinx-rtd-theme>=1.0",
|
116
|
+
"myst-parser>=0.17.0",
|
117
|
+
]
|
118
|
+
|
119
|
+
# -----------------------------
|
120
|
+
# Project URLs
|
121
|
+
# -----------------------------
|
122
|
+
[project.urls]
|
123
|
+
Homepage = "https://github.com/mlotfic/hijri-datetime"
|
124
|
+
Documentation = "https://github.com/mlotfic/hijri-datetime#readme"
|
125
|
+
Repository = "https://github.com/mlotfic/hijri-datetime.git"
|
126
|
+
"Bug Tracker" = "https://github.com/mlotfic/hijri-datetime/issues"
|
127
|
+
Changelog = "https://github.com/mlotfic/hijri-datetime/blob/main/CHANGELOG.md"
|
128
|
+
"Source Code" = "https://github.com/mlotfic/hijri-datetime"
|
129
|
+
"Download" = "https://pypi.org/project/hijri-datetime/"
|
130
|
+
|
131
|
+
# -----------------------------
|
132
|
+
# setuptools configuration
|
133
|
+
# -----------------------------
|
134
|
+
[tool.setuptools.packages.find]
|
135
|
+
where = ["src"]
|
136
|
+
include = ["hijri_datetime*"]
|
137
|
+
exclude = ["tests*"]
|
138
|
+
|
139
|
+
# -----------------------------
|
140
|
+
# setuptools_scm configuration
|
141
|
+
# -----------------------------
|
142
|
+
[tool.setuptools_scm]
|
143
|
+
write_to = "src/hijri_datetime/_version.py"
|
144
|
+
version_scheme = "post-release"
|
145
|
+
local_scheme = "no-local-version"
|
146
|
+
|
147
|
+
# -----------------------------
|
148
|
+
# Tool configurations
|
149
|
+
# -----------------------------
|
150
|
+
|
151
|
+
[tool.black]
|
152
|
+
line-length = 88
|
153
|
+
target-version = ['py38']
|
154
|
+
include = '\.pyi?$'
|
155
|
+
extend-exclude = '''
|
156
|
+
/(
|
157
|
+
\.eggs
|
158
|
+
| \.git
|
159
|
+
| \.hg
|
160
|
+
| \.mypy_cache
|
161
|
+
| \.tox
|
162
|
+
| \.venv
|
163
|
+
| build
|
164
|
+
| dist
|
165
|
+
)/
|
166
|
+
'''
|
167
|
+
|
168
|
+
[tool.isort]
|
169
|
+
profile = "black"
|
170
|
+
multi_line_output = 3
|
171
|
+
line_length = 88
|
172
|
+
known_first_party = ["hijri_datetime"]
|
173
|
+
|
174
|
+
[tool.pytest.ini_options]
|
175
|
+
minversion = "6.0"
|
176
|
+
addopts = [
|
177
|
+
"-ra",
|
178
|
+
"--strict-markers",
|
179
|
+
"--strict-config",
|
180
|
+
"--cov=hijri_datetime",
|
181
|
+
"--cov-report=term-missing",
|
182
|
+
"--cov-report=html",
|
183
|
+
"--cov-report=xml",
|
184
|
+
]
|
185
|
+
testpaths = ["tests"]
|
186
|
+
python_files = ["test_*.py", "*_test.py"]
|
187
|
+
python_classes = ["Test*"]
|
188
|
+
python_functions = ["test_*"]
|
189
|
+
|
190
|
+
[tool.coverage.run]
|
191
|
+
source = ["src"]
|
192
|
+
branch = true
|
193
|
+
|
194
|
+
[tool.coverage.report]
|
195
|
+
exclude_lines = [
|
196
|
+
"pragma: no cover",
|
197
|
+
"def __repr__",
|
198
|
+
"if self.debug:",
|
199
|
+
"if settings.DEBUG",
|
200
|
+
"raise AssertionError",
|
201
|
+
"raise NotImplementedError",
|
202
|
+
"if 0:",
|
203
|
+
"if __name__ == .__main__.:",
|
204
|
+
"class .*\bProtocol\\):",
|
205
|
+
"@(abc\\.)?abstractmethod",
|
206
|
+
]
|
207
|
+
|
208
|
+
[tool.mypy]
|
209
|
+
python_version = "3.8"
|
210
|
+
warn_return_any = true
|
211
|
+
warn_unused_configs = true
|
212
|
+
disallow_untyped_defs = true
|
213
|
+
disallow_incomplete_defs = true
|
214
|
+
check_untyped_defs = true
|
215
|
+
disallow_untyped_decorators = true
|
216
|
+
no_implicit_optional = true
|
217
|
+
warn_redundant_casts = true
|
218
|
+
warn_unused_ignores = true
|
219
|
+
warn_no_return = true
|
220
|
+
warn_unreachable = true
|
221
|
+
strict_equality = true
|
222
|
+
show_error_codes = true
|
223
|
+
|
224
|
+
[[tool.mypy.overrides]]
|
225
|
+
module = [
|
226
|
+
"jdatetime.*",
|
227
|
+
"numpy.*",
|
228
|
+
"pandas.*",
|
229
|
+
]
|
230
|
+
ignore_missing_imports = true
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"""
|
2
|
+
hijri-datetime: Pythonic Hijri datetime operations.
|
3
|
+
|
4
|
+
A comprehensive library for working with Hijri (Islamic) calendar dates,
|
5
|
+
providing seamless conversion between Hijri, Gregorian, and Jalali calendars.
|
6
|
+
"""
|
7
|
+
"""
|
8
|
+
hijri-datetime: Pythonic Hijri datetime operations.
|
9
|
+
"""
|
10
|
+
|
11
|
+
# Version management with fallback
|
12
|
+
try:
|
13
|
+
from _version import __version__
|
14
|
+
except ImportError:
|
15
|
+
# Fallback version when setuptools_scm hasn't run yet
|
16
|
+
try:
|
17
|
+
from importlib.metadata import version
|
18
|
+
__version__ = version("hijri-datetime")
|
19
|
+
except ImportError:
|
20
|
+
# Ultimate fallback
|
21
|
+
__version__ = "unknown"
|
22
|
+
|
23
|
+
# Main exports
|
24
|
+
from .date import (
|
25
|
+
HijriDate,
|
26
|
+
)
|
27
|
+
|
28
|
+
from .datetime import (
|
29
|
+
HijriDateTime,
|
30
|
+
)
|
31
|
+
|
32
|
+
|
33
|
+
from .time import (
|
34
|
+
HijriTime,
|
35
|
+
)
|
36
|
+
|
37
|
+
|
38
|
+
from .range import (
|
39
|
+
HijriDateRange,
|
40
|
+
)
|
41
|
+
|
42
|
+
from .conversion import (
|
43
|
+
hijri_to_gregorian,
|
44
|
+
gregorian_to_hijri,
|
45
|
+
hijri_to_jalali,
|
46
|
+
jalali_to_hijri,
|
47
|
+
)
|
48
|
+
|
49
|
+
from .exceptions import (
|
50
|
+
HijriError,
|
51
|
+
InvalidHijriDate,
|
52
|
+
ConversionError,
|
53
|
+
)
|
54
|
+
|
55
|
+
from .utils import (
|
56
|
+
is_valid_hijri_date,
|
57
|
+
get_hijri_month_name,
|
58
|
+
get_hijri_weekday_name,
|
59
|
+
)
|
60
|
+
|
61
|
+
# Convenience imports
|
62
|
+
from .constants import (
|
63
|
+
HIJRI_MONTHS,
|
64
|
+
HIJRI_WEEKDAYS,
|
65
|
+
ISLAMIC_EPOCH,
|
66
|
+
)
|
67
|
+
|
68
|
+
__all__ = [
|
69
|
+
"__version__",
|
70
|
+
# Core classes
|
71
|
+
"HijriDate",
|
72
|
+
"HijriDateTime",
|
73
|
+
"HijriTime",
|
74
|
+
"HijriDateRange",
|
75
|
+
# Conversion functions
|
76
|
+
"hijri_to_gregorian",
|
77
|
+
"gregorian_to_hijri",
|
78
|
+
"hijri_to_jalali",
|
79
|
+
"jalali_to_hijri",
|
80
|
+
# Exceptions
|
81
|
+
"HijriError",
|
82
|
+
"InvalidHijriDate",
|
83
|
+
"ConversionError",
|
84
|
+
# Utilities
|
85
|
+
"is_valid_hijri_date",
|
86
|
+
"get_hijri_month_name",
|
87
|
+
"get_hijri_weekday_name",
|
88
|
+
# Constants
|
89
|
+
"HIJRI_MONTHS",
|
90
|
+
"HIJRI_WEEKDAYS",
|
91
|
+
"ISLAMIC_EPOCH",
|
92
|
+
]
|
93
|
+
|
94
|
+
# Package metadata
|
95
|
+
__author__ = "m.lotfi"
|
96
|
+
__email__ = "m.lotfi@email.com"
|
97
|
+
__description__ = "Pythonic Hijri datetime — handle full & partial dates, ranges, and seamless Gregorian & Jalali conversion."
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# file generated by setuptools-scm
|
2
|
+
# don't change, don't track in version control
|
3
|
+
|
4
|
+
__all__ = [
|
5
|
+
"__version__",
|
6
|
+
"__version_tuple__",
|
7
|
+
"version",
|
8
|
+
"version_tuple",
|
9
|
+
"__commit_id__",
|
10
|
+
"commit_id",
|
11
|
+
]
|
12
|
+
|
13
|
+
TYPE_CHECKING = False
|
14
|
+
if TYPE_CHECKING:
|
15
|
+
from typing import Tuple
|
16
|
+
from typing import Union
|
17
|
+
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
19
|
+
COMMIT_ID = Union[str, None]
|
20
|
+
else:
|
21
|
+
VERSION_TUPLE = object
|
22
|
+
COMMIT_ID = object
|
23
|
+
|
24
|
+
version: str
|
25
|
+
__version__: str
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
27
|
+
version_tuple: VERSION_TUPLE
|
28
|
+
commit_id: COMMIT_ID
|
29
|
+
__commit_id__: COMMIT_ID
|
30
|
+
|
31
|
+
__version__ = version = '0.2.3.post0'
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 3, 'post0')
|
33
|
+
|
34
|
+
__commit_id__ = commit_id = 'ga003af89c'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
"""Constants for Hijri calendar."""
|
2
|
+
|
3
|
+
from datetime import date
|
4
|
+
|
5
|
+
# Hijri month names in Arabic and English
|
6
|
+
HIJRI_MONTHS = [
|
7
|
+
"Muharram",
|
8
|
+
"Safar",
|
9
|
+
"Rabi' al-awwal",
|
10
|
+
"Rabi' al-thani",
|
11
|
+
"Jumada al-awwal",
|
12
|
+
"Jumada al-thani",
|
13
|
+
"Rajab",
|
14
|
+
"Sha'ban",
|
15
|
+
"Ramadan",
|
16
|
+
"Shawwal",
|
17
|
+
"Dhu al-Qi'dah",
|
18
|
+
"Dhu al-Hijjah"
|
19
|
+
]
|
20
|
+
|
21
|
+
HIJRI_MONTHS_ARABIC = [
|
22
|
+
"محرم",
|
23
|
+
"صفر",
|
24
|
+
"ربيع الأول",
|
25
|
+
"ربيع الثاني",
|
26
|
+
"جمادى الأولى",
|
27
|
+
"جمادى الثانية",
|
28
|
+
"رجب",
|
29
|
+
"شعبان",
|
30
|
+
"رمضان",
|
31
|
+
"شوال",
|
32
|
+
"ذو القعدة",
|
33
|
+
"ذو الحجة"
|
34
|
+
]
|
35
|
+
|
36
|
+
# Weekday names
|
37
|
+
HIJRI_WEEKDAYS = [
|
38
|
+
"Saturday", # Sabt
|
39
|
+
"Sunday", # Ahad
|
40
|
+
"Monday", # Ithnayn
|
41
|
+
"Tuesday", # Thulatha
|
42
|
+
"Wednesday", # Arbi'a
|
43
|
+
"Thursday", # Khamis
|
44
|
+
"Friday" # Jumu'ah
|
45
|
+
]
|
46
|
+
|
47
|
+
HIJRI_WEEKDAYS_ARABIC = [
|
48
|
+
"السبت",
|
49
|
+
"الأحد",
|
50
|
+
"الإثنين",
|
51
|
+
"الثلاثاء",
|
52
|
+
"الأربعاء",
|
53
|
+
"الخميس",
|
54
|
+
"الجمعة"
|
55
|
+
]
|
56
|
+
|
57
|
+
# Islamic epoch (July 16, 622 CE in Gregorian calendar)
|
58
|
+
ISLAMIC_EPOCH = date(622, 7, 16)
|
59
|
+
|
60
|
+
# Days in each Hijri month (simplified - actual lengths vary)
|
61
|
+
HIJRI_MONTH_DAYS = [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29]
|
62
|
+
|
63
|
+
# Leap year pattern for Hijri calendar (30-year cycle)
|
64
|
+
HIJRI_LEAP_YEARS = [2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29]
|
@@ -0,0 +1,135 @@
|
|
1
|
+
"""Core Hijri date and time classes."""
|
2
|
+
|
3
|
+
from datetime import date, datetime, time
|
4
|
+
from typing import Optional, Union, Tuple
|
5
|
+
import calendar
|
6
|
+
|
7
|
+
from exceptions import InvalidHijriDate
|
8
|
+
from constants import HIJRI_MONTHS, HIJRI_WEEKDAYS
|
9
|
+
|
10
|
+
|
11
|
+
class HijriDate:
|
12
|
+
"""Represents a Hijri calendar date."""
|
13
|
+
|
14
|
+
def __init__(self, year: int, month: int, day: int):
|
15
|
+
"""Initialize a Hijri date.
|
16
|
+
|
17
|
+
Args:
|
18
|
+
year: Hijri year
|
19
|
+
month: Hijri month (1-12)
|
20
|
+
day: Hijri day (1-30)
|
21
|
+
|
22
|
+
Raises:
|
23
|
+
InvalidHijriDate: If the date is invalid
|
24
|
+
"""
|
25
|
+
if not self._is_valid_date(year, month, day):
|
26
|
+
raise InvalidHijriDate(f"Invalid Hijri date: {year}-{month}-{day}")
|
27
|
+
|
28
|
+
self.year = year
|
29
|
+
self.month = month
|
30
|
+
self.day = day
|
31
|
+
|
32
|
+
def _is_valid_date(self, year: int, month: int, day: int) -> bool:
|
33
|
+
"""Check if the given Hijri date is valid."""
|
34
|
+
if not (1 <= month <= 12):
|
35
|
+
return False
|
36
|
+
if not (1 <= day <= 30):
|
37
|
+
return False
|
38
|
+
# Add more sophisticated validation here
|
39
|
+
return True
|
40
|
+
|
41
|
+
def __repr__(self) -> str:
|
42
|
+
return f"HijriDate({self.year}, {self.month}, {self.day})"
|
43
|
+
|
44
|
+
def __str__(self) -> str:
|
45
|
+
return f"{self.year:04d}-{self.month:02d}-{self.day:02d}"
|
46
|
+
|
47
|
+
@property
|
48
|
+
def month_name(self) -> str:
|
49
|
+
"""Get the name of the Hijri month."""
|
50
|
+
return HIJRI_MONTHS[self.month - 1]
|
51
|
+
|
52
|
+
def to_gregorian(self) -> date:
|
53
|
+
"""Convert to Gregorian date."""
|
54
|
+
from .converter import hijri_to_gregorian
|
55
|
+
return hijri_to_gregorian(self)
|
56
|
+
|
57
|
+
def to_jalali(self):
|
58
|
+
"""Convert to Jalali date."""
|
59
|
+
from .converter import hijri_to_jalali
|
60
|
+
return hijri_to_jalali(self)
|
61
|
+
|
62
|
+
|
63
|
+
class HijriDateTime:
|
64
|
+
"""Represents a Hijri calendar datetime."""
|
65
|
+
|
66
|
+
def __init__(self, year: int, month: int, day: int,
|
67
|
+
hour: int = 0, minute: int = 0, second: int = 0):
|
68
|
+
"""Initialize a Hijri datetime."""
|
69
|
+
self.date = HijriDate(year, month, day)
|
70
|
+
self.time = HijriTime(hour, minute, second)
|
71
|
+
|
72
|
+
@property
|
73
|
+
def year(self) -> int:
|
74
|
+
return self.date.year
|
75
|
+
|
76
|
+
@property
|
77
|
+
def month(self) -> int:
|
78
|
+
return self.date.month
|
79
|
+
|
80
|
+
@property
|
81
|
+
def day(self) -> int:
|
82
|
+
return self.date.day
|
83
|
+
|
84
|
+
def __repr__(self) -> str:
|
85
|
+
return f"HijriDateTime({self.year}, {self.month}, {self.day}, {self.time.hour}, {self.time.minute}, {self.time.second})"
|
86
|
+
|
87
|
+
|
88
|
+
class HijriTime:
|
89
|
+
"""Represents a time in the Hijri calendar context."""
|
90
|
+
|
91
|
+
def __init__(self, hour: int = 0, minute: int = 0, second: int = 0):
|
92
|
+
"""Initialize a Hijri time."""
|
93
|
+
if not (0 <= hour <= 23):
|
94
|
+
raise ValueError("Hour must be between 0 and 23")
|
95
|
+
if not (0 <= minute <= 59):
|
96
|
+
raise ValueError("Minute must be between 0 and 59")
|
97
|
+
if not (0 <= second <= 59):
|
98
|
+
raise ValueError("Second must be between 0 and 59")
|
99
|
+
|
100
|
+
self.hour = hour
|
101
|
+
self.minute = minute
|
102
|
+
self.second = second
|
103
|
+
|
104
|
+
|
105
|
+
class HijriDateRange:
|
106
|
+
"""Represents a range of Hijri dates."""
|
107
|
+
|
108
|
+
def __init__(self, start: HijriDate, end: HijriDate):
|
109
|
+
"""Initialize a Hijri date range."""
|
110
|
+
if start > end:
|
111
|
+
raise ValueError("Start date must be before or equal to end date")
|
112
|
+
self.start = start
|
113
|
+
self.end = end
|
114
|
+
|
115
|
+
def __contains__(self, date: HijriDate) -> bool:
|
116
|
+
"""Check if a date is within the range."""
|
117
|
+
return self.start <= date <= self.end
|
118
|
+
|
119
|
+
def __iter__(self):
|
120
|
+
"""Iterate over dates in the range."""
|
121
|
+
current = self.start
|
122
|
+
while current <= self.end:
|
123
|
+
yield current
|
124
|
+
# Add one day (simplified)
|
125
|
+
current = self._add_one_day(current)
|
126
|
+
|
127
|
+
def _add_one_day(self, date: HijriDate) -> HijriDate:
|
128
|
+
"""Add one day to a Hijri date (simplified implementation)."""
|
129
|
+
# This is a simplified version - you'd need proper calendar logic
|
130
|
+
if date.day < 30: # Assuming max 30 days per month for simplicity
|
131
|
+
return HijriDate(date.year, date.month, date.day + 1)
|
132
|
+
elif date.month < 12:
|
133
|
+
return HijriDate(date.year, date.month + 1, 1)
|
134
|
+
else:
|
135
|
+
return HijriDate(date.year + 1, 1, 1)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"""Custom exceptions for hijri-datetime package."""
|
2
|
+
|
3
|
+
|
4
|
+
class HijriError(Exception):
|
5
|
+
"""Base exception for hijri-datetime package."""
|
6
|
+
pass
|
7
|
+
|
8
|
+
|
9
|
+
class InvalidHijriDate(HijriError):
|
10
|
+
"""Raised when an invalid Hijri date is provided."""
|
11
|
+
pass
|
12
|
+
|
13
|
+
|
14
|
+
class ConversionError(HijriError):
|
15
|
+
"""Raised when calendar conversion fails."""
|
16
|
+
pass
|
17
|
+
|
18
|
+
|
19
|
+
class InvalidHijriTime(HijriError):
|
20
|
+
"""Raised when an invalid Hijri time is provided."""
|
21
|
+
pass
|
22
|
+
|
23
|
+
|
24
|
+
class DateRangeError(HijriError):
|
25
|
+
"""Raised when there's an error with date ranges."""
|
26
|
+
pass
|
File without changes
|
@@ -1,13 +1,23 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: hijri-datetime
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.3.post0
|
4
|
+
Summary: Pythonic Hijri datetime — handle full & partial dates, ranges, and seamless Gregorian & Jalali conversion.
|
4
5
|
Author-email: "m.lotfi" <m.lotfi@email.com>
|
5
6
|
Maintainer-email: "m.lotfi" <m.lotfi@email.com>
|
6
|
-
License:
|
7
|
-
|
8
|
-
|
9
|
-
|
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.git
|
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
|
+
Project-URL: Source Code, https://github.com/mlotfic/hijri-datetime
|
14
|
+
Project-URL: Download, https://pypi.org/project/hijri-datetime/
|
15
|
+
Keywords: python,package,modules,portable,hijri,islamic,calendar,datetime,gregorian,jalali,conversion
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
17
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
10
18
|
Classifier: Intended Audience :: Developers
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
11
21
|
Classifier: Programming Language :: Python :: 3
|
12
22
|
Classifier: Programming Language :: Python :: 3.8
|
13
23
|
Classifier: Programming Language :: Python :: 3.9
|
@@ -15,14 +25,67 @@ Classifier: Programming Language :: Python :: 3.10
|
|
15
25
|
Classifier: Programming Language :: Python :: 3.11
|
16
26
|
Classifier: Programming Language :: Python :: 3.12
|
17
27
|
Classifier: Operating System :: OS Independent
|
18
|
-
Classifier: Topic ::
|
19
|
-
Classifier: Topic :: Software Development ::
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
29
|
+
Classifier: Topic :: Software Development :: Internationalization
|
30
|
+
Classifier: Topic :: Utilities
|
20
31
|
Requires-Python: >=3.8
|
21
32
|
Description-Content-Type: text/markdown
|
22
33
|
License-File: LICENSE
|
34
|
+
Requires-Dist: jdatetime>=3.0.0
|
35
|
+
Requires-Dist: requests>=2.20.0
|
36
|
+
Requires-Dist: numpy>=1.18.0
|
37
|
+
Requires-Dist: pandas>=1.0.0
|
38
|
+
Provides-Extra: dev
|
39
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
40
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
41
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
42
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
43
|
+
Requires-Dist: mypy>=0.900; extra == "dev"
|
44
|
+
Requires-Dist: pre-commit>=2.0; extra == "dev"
|
45
|
+
Requires-Dist: tox>=3.0; extra == "dev"
|
46
|
+
Requires-Dist: build>=0.10; extra == "dev"
|
47
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
48
|
+
Requires-Dist: setuptools_scm>=6.2; extra == "dev"
|
49
|
+
Requires-Dist: setuptools>=45; extra == "dev"
|
50
|
+
Requires-Dist: wheel; extra == "dev"
|
51
|
+
Requires-Dist: sphinx>=4.0; extra == "dev"
|
52
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "dev"
|
53
|
+
Provides-Extra: test
|
54
|
+
Requires-Dist: pytest>=6.0; extra == "test"
|
55
|
+
Requires-Dist: pytest-cov>=2.0; extra == "test"
|
56
|
+
Requires-Dist: pytest-mock>=3.0; extra == "test"
|
57
|
+
Provides-Extra: docs
|
58
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
59
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
|
60
|
+
Requires-Dist: myst-parser>=0.17.0; extra == "docs"
|
61
|
+
Provides-Extra: lint
|
62
|
+
Requires-Dist: black>=22.0; extra == "lint"
|
63
|
+
Requires-Dist: flake8>=4.0; extra == "lint"
|
64
|
+
Requires-Dist: mypy>=0.900; extra == "lint"
|
65
|
+
Requires-Dist: isort>=5.0; extra == "lint"
|
66
|
+
Provides-Extra: all
|
67
|
+
Requires-Dist: pytest>=6.0; extra == "all"
|
68
|
+
Requires-Dist: pytest-cov>=2.0; extra == "all"
|
69
|
+
Requires-Dist: pytest-mock>=3.0; extra == "all"
|
70
|
+
Requires-Dist: black>=22.0; extra == "all"
|
71
|
+
Requires-Dist: flake8>=4.0; extra == "all"
|
72
|
+
Requires-Dist: mypy>=0.900; extra == "all"
|
73
|
+
Requires-Dist: isort>=5.0; extra == "all"
|
74
|
+
Requires-Dist: pre-commit>=2.0; extra == "all"
|
75
|
+
Requires-Dist: tox>=3.0; extra == "all"
|
76
|
+
Requires-Dist: build>=0.10; extra == "all"
|
77
|
+
Requires-Dist: twine>=4.0; extra == "all"
|
78
|
+
Requires-Dist: setuptools_scm>=6.2; extra == "all"
|
79
|
+
Requires-Dist: setuptools>=45; extra == "all"
|
80
|
+
Requires-Dist: wheel; extra == "all"
|
81
|
+
Requires-Dist: sphinx>=4.0; extra == "all"
|
82
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "all"
|
83
|
+
Requires-Dist: myst-parser>=0.17.0; extra == "all"
|
23
84
|
|
24
85
|
# hijri-datetime
|
25
86
|
|
87
|
+
# 💡💡💡💡💡💡 **this not working yet** 💡💡💡💡
|
88
|
+
|
26
89
|
📅 **Hijri (Islamic) calendar datetime library for Python**
|
27
90
|
A drop-in replacement for Python's built-in `datetime` module, supporting Hijri date arithmetic, formatting, conversion, partial dates, and integration with `jdatetime`.
|
28
91
|
|
@@ -1,16 +1,26 @@
|
|
1
|
+
.gitignore
|
2
|
+
CHANGELOG.md
|
1
3
|
LICENSE
|
4
|
+
MANIFEST.in
|
2
5
|
README.md
|
6
|
+
clean_build_dirs.py
|
3
7
|
pyproject.toml
|
8
|
+
.github/workflows/release.yml
|
4
9
|
src/hijri_datetime/__init__.py
|
10
|
+
src/hijri_datetime/_version.py
|
5
11
|
src/hijri_datetime/calendar.py
|
12
|
+
src/hijri_datetime/constants.py
|
6
13
|
src/hijri_datetime/conversion.py
|
7
14
|
src/hijri_datetime/date.py
|
8
15
|
src/hijri_datetime/datetime.py
|
16
|
+
src/hijri_datetime/exceptions.py
|
9
17
|
src/hijri_datetime/hello.py
|
10
18
|
src/hijri_datetime/range.py
|
19
|
+
src/hijri_datetime/time.py
|
11
20
|
src/hijri_datetime/utils.py
|
12
21
|
src/hijri_datetime.egg-info/PKG-INFO
|
13
22
|
src/hijri_datetime.egg-info/SOURCES.txt
|
14
23
|
src/hijri_datetime.egg-info/dependency_links.txt
|
24
|
+
src/hijri_datetime.egg-info/requires.txt
|
15
25
|
src/hijri_datetime.egg-info/top_level.txt
|
16
|
-
tests/
|
26
|
+
tests/conftest.py
|
@@ -0,0 +1,55 @@
|
|
1
|
+
jdatetime>=3.0.0
|
2
|
+
requests>=2.20.0
|
3
|
+
numpy>=1.18.0
|
4
|
+
pandas>=1.0.0
|
5
|
+
|
6
|
+
[all]
|
7
|
+
pytest>=6.0
|
8
|
+
pytest-cov>=2.0
|
9
|
+
pytest-mock>=3.0
|
10
|
+
black>=22.0
|
11
|
+
flake8>=4.0
|
12
|
+
mypy>=0.900
|
13
|
+
isort>=5.0
|
14
|
+
pre-commit>=2.0
|
15
|
+
tox>=3.0
|
16
|
+
build>=0.10
|
17
|
+
twine>=4.0
|
18
|
+
setuptools_scm>=6.2
|
19
|
+
setuptools>=45
|
20
|
+
wheel
|
21
|
+
sphinx>=4.0
|
22
|
+
sphinx-rtd-theme>=1.0
|
23
|
+
myst-parser>=0.17.0
|
24
|
+
|
25
|
+
[dev]
|
26
|
+
pytest>=6.0
|
27
|
+
pytest-cov>=2.0
|
28
|
+
black>=22.0
|
29
|
+
flake8>=4.0
|
30
|
+
mypy>=0.900
|
31
|
+
pre-commit>=2.0
|
32
|
+
tox>=3.0
|
33
|
+
build>=0.10
|
34
|
+
twine>=4.0
|
35
|
+
setuptools_scm>=6.2
|
36
|
+
setuptools>=45
|
37
|
+
wheel
|
38
|
+
sphinx>=4.0
|
39
|
+
sphinx-rtd-theme>=1.0
|
40
|
+
|
41
|
+
[docs]
|
42
|
+
sphinx>=4.0
|
43
|
+
sphinx-rtd-theme>=1.0
|
44
|
+
myst-parser>=0.17.0
|
45
|
+
|
46
|
+
[lint]
|
47
|
+
black>=22.0
|
48
|
+
flake8>=4.0
|
49
|
+
mypy>=0.900
|
50
|
+
isort>=5.0
|
51
|
+
|
52
|
+
[test]
|
53
|
+
pytest>=6.0
|
54
|
+
pytest-cov>=2.0
|
55
|
+
pytest-mock>=3.0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""Pytest configuration and fixtures."""
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
from datetime import date
|
5
|
+
from hijri_datetime import HijriDate, HijriDateTime
|
6
|
+
|
7
|
+
|
8
|
+
@pytest.fixture
|
9
|
+
def sample_hijri_date():
|
10
|
+
"""Sample Hijri date for testing."""
|
11
|
+
return HijriDate(1445, 5, 15)
|
12
|
+
|
13
|
+
|
14
|
+
@pytest.fixture
|
15
|
+
def sample_hijri_datetime():
|
16
|
+
"""Sample Hijri datetime for testing."""
|
17
|
+
return HijriDateTime(1445, 5, 15, 14, 30, 0)
|
18
|
+
|
19
|
+
|
20
|
+
@pytest.fixture
|
21
|
+
def sample_gregorian_date():
|
22
|
+
"""Sample Gregorian date for testing."""
|
23
|
+
return date(2023, 11, 28)
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# -----------------------------
|
2
|
-
# Build System (required)
|
3
|
-
# -----------------------------
|
4
|
-
[build-system]
|
5
|
-
requires = ["setuptools<77", "wheel", "setuptools_scm[toml]>=6.2"]
|
6
|
-
build-backend = "setuptools.build_meta"
|
7
|
-
|
8
|
-
[project]
|
9
|
-
name = "hijri-datetime"
|
10
|
-
version = "0.1.1"
|
11
|
-
license = { text = "MIT" } # old-style, accepted
|
12
|
-
classifiers = [
|
13
|
-
"License :: OSI Approved :: MIT License",
|
14
|
-
"Development Status :: 3 - Alpha",
|
15
|
-
"Intended Audience :: Developers",
|
16
|
-
"Programming Language :: Python :: 3",
|
17
|
-
"Programming Language :: Python :: 3.8",
|
18
|
-
"Programming Language :: Python :: 3.9",
|
19
|
-
"Programming Language :: Python :: 3.10",
|
20
|
-
"Programming Language :: Python :: 3.11",
|
21
|
-
"Programming Language :: Python :: 3.12",
|
22
|
-
"Operating System :: OS Independent",
|
23
|
-
"Topic :: Software Development :: Libraries",
|
24
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
25
|
-
]
|
26
|
-
|
27
|
-
authors = [
|
28
|
-
{ name = "m.lotfi", email = "m.lotfi@email.com" },
|
29
|
-
]
|
30
|
-
maintainers = [
|
31
|
-
{ name = "m.lotfi", email = "m.lotfi@email.com" },
|
32
|
-
]
|
33
|
-
|
34
|
-
keywords = [
|
35
|
-
"python", "package", "modules", "portable",
|
36
|
-
"hijri", "islamic", "calendar", "datetime"
|
37
|
-
]
|
38
|
-
readme = { file = "README.md", content-type = "text/markdown" }
|
39
|
-
requires-python = ">=3.8"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
[tool.setuptools.packages.find]
|
45
|
-
where = ["src"]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime.egg-info/dependency_links.txt
RENAMED
File without changes
|
{hijri_datetime-0.1.1 → hijri_datetime-0.2.3.post0}/src/hijri_datetime.egg-info/top_level.txt
RENAMED
File without changes
|