File: README.rst

package info (click to toggle)
python-pyluach 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 336 kB
  • sloc: python: 2,300; makefile: 20; sh: 6
file content (90 lines) | stat: -rw-r--r-- 2,407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
pyluach
=======

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
<https://github.com/simlist/pyluach/issues>`_ or contact me at
simlist@gmail.com.

License
--------
Pyluach is licensed under the MIT license.