Skip to main content

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

Project description

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.

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

pyluach-2.2.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

pyluach-2.2.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file pyluach-2.2.0.tar.gz.

File metadata

  • Download URL: pyluach-2.2.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for pyluach-2.2.0.tar.gz
Algorithm Hash digest
SHA256 9063a25387cd7624276fd0656508bada08aa8a6f22e8db352844cd858e69012b
MD5 769f1b1986fcd8dde090af903079457f
BLAKE2b-256 ebfc4567068be2c78ac09339201f4a1adfd9e95f6f873f6f37f6fafb5648363e

See more details on using hashes here.

File details

Details for the file pyluach-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyluach-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for pyluach-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1eb49d6292087e9290f4661ae01b60c8c933704ec8c9cef82673b349ff96adf
MD5 e2b1ce0dcbd263a645b98deec26e0225
BLAKE2b-256 4f832e585d06d49e0320050b3d7d8ae0dfbd1459e976ff9f4b4d8bcca983d474

See more details on using hashes here.

Supported by

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