A Python package for dealing with Hebrew (Jewish) calendar dates.


Keywords
hebrew, calendar, jewish, luach, gregorian, julian, days, dates, date, conversion, parsha, holiday, hebrew-calendar, hebrew-date, jewish-calendar, jewish-holidays
License
MIT
Install
pip install pyluach==1.0.0

Documentation

pyluach

Documentation Status https://github.com/simlist/pyluach/actions/workflows/testing-and-coverage.yml/badge.svg?branch=master https://coveralls.io/repos/github/simlist/pyluach/badge.svg?branch=master

Pyluach is a Python package for dealing with Hebrew (Jewish) calendar dates.

Features

  • Conversion between Hebrew and Gregorian dates
  • Finding the difference between two dates
  • Finding a date at a given duration from the given date
  • Rich comparisons between dates
  • Finding the weekday of a given date
  • Finding the weekly Parsha reading of a given date
  • Getting the holiday occuring on a given date
  • Generating html and text Hebrew calendars

Installation

Use pip install pyluach.

Documentation

Documentation for pyluach can be found at https://readthedocs.org/projects/pyluach/.

Examples

>>> from pyluach import dates, hebrewcal, parshios

>>> today = dates.HebrewDate.today()
>>> lastweek_gregorian = (today - 7).to_greg()
>>> lastweek_gregorian < today
    True
>>> today - lastweek_gregorian
7
>>> greg = dates.GregorianDate(1986, 3, 21)
>>> heb = dates.HebrewDate(5746, 13, 10)
>>> greg == heb
True

>>> purim = dates.HebrewDate(5781, 12, 14)
>>> purim.hebrew_day()
'讬状讚'
>>> purim.hebrew_date_string()
'讬状讚 讗讚专 转砖驻状讗'
>>> purim.hebrew_date_string(True)
'讬状讚 讗讚专 讛壮转砖驻状讗'

>>> rosh_hashana = dates.HebrewDate(5782, 7, 1)
>>> rosh_hashana.holiday()
'Rosh Hashana'
>>> rosh_hashana.holiday(hebrew=True)
'专讗砖 讛砖谞讛'
>>> (rosh_hashana + 3).holiday()
None

>>> month = hebrewcal.Month(5781, 10)
>>> month.month_name()
'Teves'
>>> month.month_name(True)
'讟讘转'
>>> month + 3
Month(5781, 1)
>>> for month in hebrewcal.Year(5774).itermonths():
...     print(month.month_name())
Tishrei Cheshvan ...

>>> date = dates.GregorianDate(2010, 10, 6)
>>> parshios.getparsha(date)
[0]
>>> parshios.getparsha_string(date, israel=True)
'Beraishis'
>>> parshios.getparsha_string(date, hebrew=True)
'讘专讗砖讬转'
>>> new_date = dates.GregorianDate(2021, 3, 10)
>>> parshios.getparsha_string(new_date)
'Vayakhel, Pekudei'
>>> parshios.getparsha_string(new_date, hebrew=True)
'讜讬拽讛诇, 驻拽讜讚讬'

Contact

For questions and comments please raise an issue in github or contact me at simlist@gmail.com.

License

Pyluach is licensed under the MIT license.