Skip to main content

A pure-Python library for the Hebrew calendar: conversion, astronomy, holidays and religious times, computed entirely locally.

Project description

hebrewcal

CI Documentation Status PyPI version Python versions License: MIT

A pure-Python library for the Hebrew calendar.

hebrewcal makes the Hebrew calendar usable programmatically and converts it bidirectionally against the Gregorian and Julian calendars. Every computation is performed locally — the library never issues network calls to any external service.

It is built for two audiences:

  • Religious use — holidays (Israel and the Diaspora, including minority feasts and Shushan Purim), Shabbat candle lighting and Havdalah, zmanim, Torah readings, the Omer count, yahrzeit, and the sabbatical and jubilee cycle.
  • Academic use — historical, medieval and ancient dates, Babylonian and biblical month names, proleptic calendars, the Julian/Gregorian reform, and the documented "missing years" of the Anno Mundi count.

Project status. Early development. The calendar core, conversion and date handling (Phase 1) are implemented. Astronomy, holidays and religious times follow on the roadmap.

Installation

pip install hebrewcal

hebrewcal requires Python 3.11+ and has no runtime dependencies (standard library only).

Quick start

from hebrewcal import GregorianDate, HebrewDate, to_hebrew, to_gregorian, weekday

# What Hebrew date and weekday corresponds to 31 October 1867?
g = GregorianDate(1867, 10, 31)
h = to_hebrew(g)
print(h)            # HebrewDate(year=5628, month=8, day=2)  -> 2 Marheshvan 5628
print(weekday(g).name)   # THURSDAY

# Convert a Hebrew date back to Gregorian.
print(to_gregorian(HebrewDate(5785, 7, 1)))   # GregorianDate(year=2024, month=10, day=3)

Every calendar reduces a date to an integer Rata Die (RD) day count and rebuilds a date from it, so any two calendars are interconvertible through RD:

from hebrewcal import GregorianDate, to_julian

GregorianDate(2026, 6, 26).to_rd()     # 739793
to_julian(GregorianDate(2026, 6, 26))  # JulianDate(year=2026, month=6, day=13)

Features

  • Proleptic Gregorian and Julian calendars, with an explicit, configurable Julian/Gregorian reform helper.
  • A complete Hebrew calendar: molad and halakim, the dechiyot ("four gates"), year typing (deficient / regular / complete), the keviah signature, and the Metonic cycle.
  • Bidirectional conversion between any supported calendars through Rata Die.
  • Parsing of Gregorian input (ISO 8601, DIN 5008 and slash form) and formatting in numeric and named styles.
  • A gematria converter between integers and Hebrew numerals.
  • Month and weekday name tables (transliteration, Babylonian, biblical).
  • The Anno Mundi era with a documented "missing years" notice.

Documentation

Full documentation, including a user guide with many examples, lives at hebrewcal.readthedocs.io.

Development

git clone https://github.com/bsesic/hebrewcal.git
cd hebrewcal
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install

Run the lint gate and the test suite:

flake8
ruff check .
mypy
pytest

See CONTRIBUTING.md for the branching strategy and conventions.

License

MIT © Benjamin Schnabel

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

hebrewcal-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

hebrewcal-0.1.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file hebrewcal-0.1.0.tar.gz.

File metadata

  • Download URL: hebrewcal-0.1.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hebrewcal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea74894c6eea038036678a4a25376fde28b4c6b015d11dd3f2714542ed6ae22a
MD5 f5f3d24698df80c439ef73ab357888a8
BLAKE2b-256 e17bd5dcebabc5f5e2d6b20fea746a4f66c99a6ff5e2ac325976e2ba75ed2a66

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebrewcal-0.1.0.tar.gz:

Publisher: release.yml on bsesic/hebrewcal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hebrewcal-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hebrewcal-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hebrewcal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de7cba9b68d28e7a75de71ab5bd9d015bd78774955d3e65485e7f1896e147f29
MD5 56bb31c8927e8f62529992e1b02efb7b
BLAKE2b-256 e5c94d0c6bdd5232fb6cc4c807460498df6acc71115f90d24139d19c544d2960

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebrewcal-0.1.0-py3-none-any.whl:

Publisher: release.yml on bsesic/hebrewcal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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