Skip to main content

A comprehensive Python library for the Ethiopian calendar, handling conversions, holidays (Bahire Hasab), and date arithmetic.

Project description

Kenat / ቀናት PyPI Version

banner

GitHub issues GitHub Repo stars GitHub forks GitHub commit activity

A complete Ethiopian Calendar & Bahire Hasab toolkit for Python


📌 Overview

Kenat (Amharic: ቀናት) is a powerful and authentic Ethiopian calendar library for Python. It offers full support for date conversion, holiday computation (including Bahire Hasab), localized formatting, Geez numerals, and more — all without external dependencies.

🚀 Ported from the original kenat JS library.


✨ Features

  • 🔄 Bidirectional Conversion: Ethiopian ↔ Gregorian calendars
  • 📅 Full Holiday System: Christian, Muslim, cultural, and public holidays
  • Bahire Hasab: Accurate movable feast calculations (e.g. Fasika, Tsome Nebiyat)
  • 🏷️ Holiday Filtering: Filter holidays by type (public, christian, muslim, etc.)
  • 📆 Date Arithmetic: Add/subtract days, months, years (13-month calendar support)
  • 🔠 Localized Formatting: Amharic and English support
  • 🔢 Geez Numerals: Convert integers to ግዕዝ numeral strings
  • Ethiopian Time Support: 12-hour Ethiopian ↔ 24-hour Gregorian
  • 🗓️ Calendar Grids: Monthly/yearly calendar generation

🚀 Installation

Install the library from source:

pip install kenat

For development/testing:

pip install -e ".[test]"

🟢 Quick Start

from kenat import Kenat

today = Kenat.now()

print(today.get_ethiopian())
# → {'year': 2017, 'month': 9, 'day': 26}

print(today.format({'lang': 'english', 'show_weekday': True}))
# → "Tuesday, Ginbot 26 2017"

⛪ Bahire Hasab & Holiday System

Get All Holidays in a Year

from kenat import get_holidays_for_year

holidays = get_holidays_for_year(2017)

# Example: Find Fasika (Easter)
fasika = next(h for h in holidays if h['key'] == 'fasika')
print(fasika['ethiopian'])  # → {'year': 2017, 'month': 8, 'day': 21}

Filter Holidays by Type

from kenat import get_holidays_for_year, HolidayTags

# Public only
get_holidays_for_year(2017, filter_by=HolidayTags.PUBLIC)

# Christian and Muslim holidays
get_holidays_for_year(2017, filter_by=[HolidayTags.CHRISTIAN, HolidayTags.MUSLIM])

Check if a Date is a Holiday

from kenat import Kenat

meskel = Kenat("2017/1/17")
print(meskel.is_holiday())  # → [Holiday object]

non_holiday = Kenat("2017/1/18")
print(non_holiday.is_holiday())  # → []

Access Bahire Hasab Calculations

from kenat import Kenat

bh = Kenat("2017/1/1").get_bahire_hasab()

print(bh['evangelist'])  # → {'name': 'ማቴዎስ', 'remainder': 1}
print(bh['movableFeasts']['fasika']['ethiopian'])
# → {'year': 2017, 'month': 8, 'day': 21}

➕ More API Examples

Date Arithmetic

from kenat import Kenat

date = Kenat("2017/2/10")
print(date.add(days=10))     # → Add days
print(date.add(months=-1))   # → Subtract a month

Date Difference

from kenat import Kenat

a = Kenat("2015/5/15")
b = Kenat("2012/5/15")

print((a - b).days)         # → 1095 days
print(a.diff_in_days(b))    # → 1095

Geez Numerals

from kenat import to_geez

print(to_geez(2017))  # → ፳፻፲፯

🧱 Contributing

  1. Fork & clone the repo
  2. Create a new branch: git checkout -b feature/your-feature
  3. Make your changes, add tests in /tests/
  4. Run pytest to ensure everything passes
  5. Submit a pull request 🚀

👨‍💻 Author

Melaku Demeke GitHub: @melakud


📄 License

MIT License — see LICENSE for details.


Let me know if you want to:

  • add badges (PyPI, license, tests)
  • include an animated GIF demo (e.g. calendar grid or console output)
  • or generate this as a README.md file automatically.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kenat-1.0.2.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kenat-1.0.2-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file kenat-1.0.2.tar.gz.

File metadata

  • Download URL: kenat-1.0.2.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for kenat-1.0.2.tar.gz
Algorithm Hash digest
SHA256 248c447ac7fdba0237c2f0ca1ad3bde7dbca86bf0e26957f22e274addc43e60b
MD5 d6d762bebcf5eda45b9126899c93bdba
BLAKE2b-256 05cb6006633f5df22e2c18217f6ba8a0bb5cffb493e515d85f39847e319e69cb

See more details on using hashes here.

File details

Details for the file kenat-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: kenat-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for kenat-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81a3cc75e6c9665706950ec2c8683534bbada4f603b41c6041ca35a439f64ad6
MD5 a02e41c47254b1a3fafe05105c288b45
BLAKE2b-256 86b897675142dcf0b98708ca35f50cd8d0a7b5a7d3cd7ecafea6c3d0d9f4b824

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page