A very lightweight package that provides functions to convert between Gregorian and Solar Hijri calendars. Solar Hijri is the official calendar being used in Iran.
Installation
Requires Python 3.12+
pip install gshconverter
Usage
The main functions are:
solar_hijri_to_gregorian(sh_year: int, sh_month: int, sh_day: int) -> tuple[int, int, int]
gregorian_to_solar_hijri(g_year: int, g_month: int, g_day: int) -> tuple[int, int, int]
is_g_leap(year: int) -> bool
is_sh_leap(year: int) -> bool
Example:
>>> from gshconverter import *
>>> is_sh_leap(1403)
True
>>> solar_hijri_to_gregorian(1403, 12, 30)
(2025, 3, 20)
>>> gregorian_to_solar_hijri(2025, 3, 20)
(1403, 12, 30)
Notes
This library currently assumes 33-year cycles which means it will get inaccurate for dates too far in the future (the first known incorrect year is 1502 SH) or too far in the past (the results are known to be correct at least until 1210 SH according to University of Tehran astronomical calculation).
The output of converter functions are the same as the ones in FarsiWeb’s jalali.c , but gshconverter uses a different algorithm and is written from scratch. It also is faster than the current Python implementation used in jdatetime library .
Metadata
Release files for gshconverter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gshconverter-0.1.0.tar.gz | 14.9 kB | Without provenance | Details for gshconverter-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gshconverter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gshconverter-0.1.0-py3-none-any.whl |
Total release size: 17.7 kB
Release files / gshconverter-0.1.0.tar.gz
| Download URL | gshconverter-0.1.0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c210e91b3fc3a9e54a077059bbf2b5c639e6d453a84c35a8022c2884b98cdba
|
|
BLAKE2b-256 checksum How to use checksums |
b21f07871d9c9b6dba9c952f2dfa8a597bc30f2a8debd324c9ce102a78d02cfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / gshconverter-0.1.0-py3-none-any.whl
| Download URL | gshconverter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1749b8c1bf6b6669030d6ff8e6e8292cb83a534f58728f8ea38b54b7321b45cf
|
|
BLAKE2b-256 checksum How to use checksums |
0a122478fda71debbd58b2d95d52bc8ee1b5bf48b72bd37bf4cce26062e59252
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for gshconverter 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.