Holidays

0.93 · active · verified Sun Mar 29

The Python `holidays` library (currently v0.93) is an Open World Holidays Framework that provides a fast and efficient way to determine if a specific date is a public holiday in various countries and subdivisions. It is actively maintained with frequent, approximately bi-weekly, releases adding new countries, regions, and localization support. It is commonly used in scheduling, automation systems, and applications requiring holiday awareness.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to instantiate the holidays object for a specific country (United States) and subdivision (California), check if a date is a holiday, and retrieve its name. It also shows how to get holiday names in a specific language (German for Germany).

from datetime import date
import holidays

# Get all US federal holidays for a specific year
us_holidays_2026 = holidays.UnitedStates(years=[2026])

print(f"Is New Year's Day (Jan 1, 2026) a holiday? {date(2026, 1, 1) in us_holidays_2026}")
print(f"Holiday name for Jan 1, 2026: {us_holidays_2026.get(date(2026, 1, 1))}")

# Get California state holidays for a year
ca_holidays_2026 = holidays.UnitedStates(years=[2026], state='CA')

# Check a specific date (e.g., California's observed Juneteenth, if applicable)
example_date = date(2026, 6, 19) # Juneteenth National Independence Day
print(f"Is {example_date} a holiday in California? {example_date in ca_holidays_2026}")
if example_date in ca_holidays_2026:
    print(f"Holiday name: {ca_holidays_2026.get(example_date)}")

# Get holidays in German for Germany
de_holidays_2026_de = holidays.Germany(years=[2026], language='de')
print(f"German holiday name for Jan 1, 2026: {de_holidays_2026_de.get(date(2026, 1, 1))}")

view raw JSON →