Skip to main content

sefirat-haomer

A library for calculating the days of Sefirat HaOmer.

Installation

You can install this package with pip or conda.

$ pip install sefirat-haomer
$ conda install -c abrahammurciano sefirat-haomer

Links

Documentation

Source Code - GitHub

PyPI - sefirat-haomer

Anaconda - sefirat-haomer

Usage

This library provides three main classes. OmerDay which represents a single day (1 to 49) of Sefirat HaOmer (not bound to any particular year), OmerDate which represents a day of Sefirat HaOmer in a particular year, and OmerCalendar which is a collection of OmerDate objects for a particular year.

For an actual example of how this library was used to generate Google Calendar events for the next 100 years, see this example. (Interestingly, this is why I wrote this library in the first place, and you can import the resulting calendar by clicking this link).

OmerDay

Here are some examples of how to use the OmerDay class.

>>> from sefirat_haomer import OmerDay
>>> day = OmerDay(33)

OmerDay objects have the following attributes:

>>> day.day
33
>>> day.weeks
4
>>> day.days
5

You can also get the day of the week for a given OmerDay by unpacking it:

>>> weeks, days = day
>>> weeks
4
>>> days
5

OmerDay objects can be converted to integers:

>>> int(day)
33

OmerDay objects can also be compared to other OmerDay objects:

>>> day == OmerDay(33)
True
>>> day != OmerDay(33)
False
>>> day < OmerDay(45)
True
>>> day > OmerDay(45)
False
>>> day <= OmerDay(20)
False
>>> day >= OmerDay(20)
True

OmerDate

Here are some examples of how to use the OmerDate class.

OmerDate objects can be created in any of the following ways. (All the following examples are equivalent.)

>>> from sefirat_haomer import OmerDate
>>> from pyluach.dates import HebrewDate
>>> from datetime import date
>>> date = OmerDate(8, hebrew_year=5783)
>>> date = OmerDate(8, gregorian_year=2023)
>>> date = OmerDate.from_hebrew(HebrewDate(5783, 1, 23))
>>> date = OmerDate.from_gregorian(date(2023, 4, 14))

OmerDate objects have the following attributes (in addition to those inherited from OmerDay):

>>> date.hebrew
HebrewDate(5783, 1, 23)
>>> date.gregorian
datetime.date(2023, 4, 14)

OmerDate objects can be compared to other OmerDate objects:

>>> date == OmerDate(8, hebrew_year=5783)
True
>>> date != OmerDate(8, hebrew_year=5784)
True
>>> date != OmerDate(33, gregorian_year=5783)
True
>>> date < OmerDate(33, gregorian_year=5782)
True
>>> date > OmerDate(33, gregorian_year=5784)
True
>>> date <= OmerDate(33, gregorian_year=5782)
False
>>> date >= OmerDate(33, gregorian_year=5784)
False

OmerCalendar

Here are some examples of how to use the OmerCalendar class.

OmerCalendar objects can be created in any of the following ways. (All the following examples are equivalent.)

>>> from sefirat_haomer import OmerCalendar
>>> calendar = OmerCalendar(hebrew_year=5783)
>>> calendar = OmerCalendar(gregorian_year=2023)

OmerCalendar objects have the following attributes:

>>> calendar.hebrew_year
5783
>>> calendar.gregorian_year
2023

OmerCalendar objects can be indexed just like a list:

>>> calendar[0]
OmerDate(1, hebrew_year=5783)
>>> calendar[48]
OmerDate(49, hebrew_year=5783)
>>> calendar[-1]
OmerDate(49, hebrew_year=5783)
>>> calendar[:2]
[OmerDate(1, hebrew_year=5783), OmerDate(2, hebrew_year=5783)]
>>> calendar[2:5]
[OmerDate(3, hebrew_year=5783), OmerDate(4, hebrew_year=5783), OmerDate(5, hebrew_year=5783)]
>>> calendar[46:]
[OmerDate(47, hebrew_year=5783), OmerDate(48, hebrew_year=5783), OmerDate(49, hebrew_year=5783)]
>>> calendar[5:10:2]
[OmerDate(6, hebrew_year=5783), OmerDate(8, hebrew_year=5783), OmerDate(10, hebrew_year=5783)]

OmerCalendar objects can be iterated over:

>>> for day in calendar:
...     print(day)

OmerCalendar objects can also tell you if a given OmerDate is in the calendar:

>>> OmerDate(1, hebrew_year=5783) in calendar
True
>>> OmerDate(1, hebrew_year=5784) in calendar
False

Metadata

Release files for sefirat-haomer 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sefirat-haomer 1.0.0
File Size Uploaded
sefirat_haomer-1.0.0.tar.gz 20.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sefirat-haomer 1.0.0
File Interpreter ABI Platform
sefirat_haomer-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / sefirat_haomer-1.0.0.tar.gz

Download URL sefirat_haomer-1.0.0.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8cbced3afaed248f39c816a2da0d9f12ab7f39f2e9b94372768a3438bab06001
BLAKE2b-256 checksum
How to use checksums
224960b7c1b3a8c9f63354f490ce6b79739b13051c757b4936ac582475802fbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1035-azure

Release files / sefirat_haomer-1.0.0-py3-none-any.whl

Download URL sefirat_haomer-1.0.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15a218caeb7e81fc1adcc64bdec30832a4ab7fef126d971621d2dec7f531d794
BLAKE2b-256 checksum
How to use checksums
81dcee88036291adcacfdec9a36bb3879c12aa16953766f0bc494169915135f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1035-azure

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page