# sahil3028/holidays architecture

> Architecture diagram of the GitHub repository sahil3028/holidays, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahil3028/holidays
- Repository: https://github.com/sahil3028/holidays

## Overview

Holidays is a Python library that builds dict-like holiday calendars for countries, subdivisions, and financial markets. Users select an entity and years, then query dates; the library populates holiday entries using entity rules, calendar calculations, and optional observed-date handling. It also supports calendar exports to ICS. The graph preserves documented country and market coverage and the major calendar modules. Some subsystem links are shown only where the README or source index establishes them; unsampled implementations are represented at their existing directory paths.

Main entry points: [`holidays/holiday_base.py`](https://github.com/sahil3028/holidays/blob/dev/holidays/holiday_base.py) (HolidayBase), [`holidays/calendars/gregorian.py`](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/gregorian.py) (Gregorian calendar), [`holidays/generate_ics.py`](https://github.com/sahil3028/holidays/blob/dev/holidays/generate_ics.py) (ICS export), [`holidays/registry.py`](https://github.com/sahil3028/holidays/blob/dev/holidays/registry.py) (Entity registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Calendar runtime"]
  node_registry["Entity registry<br/>[registry.py]"]
  node_holiday_base["HolidayBase<br/>[holiday_base.py]"]
  node_observed["Observed dates"]
end

subgraph group_entities["Holiday entities"]
  node_country_rules["Country rules"]
  node_us_rules["US rules<br/>[united_states.py]"]
  node_financial_rules["Market rules"]
  node_nyse_rules["NYSE rules"]
end

subgraph group_calendars["Calendar rules"]
  node_gregorian["Gregorian calendar<br/>[gregorian.py]"]
  node_custom_calendar["Custom calendar<br/>[custom.py]"]
  node_ethiopian["Ethiopian calendar<br/>[ethiopian.py]"]
  node_hindu_calendar["Hindu calendar<br/>[hindu.py]"]
  node_islamic_calendar["Islamic calendar<br/>[islamic.py]"]
  node_tibetan_calendar["Tibetan calendar<br/>[tibetan.py]"]
  node_julian_calendar["Julian calendars<br/>[julian.py]"]
  node_christian_groups["Christian holidays<br/>[christian.py]"]
  node_hindu_groups["Hindu holidays<br/>[hindu.py]"]
  node_eastern_groups["Eastern holidays<br/>[eastern.py]"]
end

subgraph group_exports["Markets and exports"]
  node_ics_generator["ICS export<br/>[generate_ics.py]"]
  node_ical_format["iCalendar formatting<br/>[ical.py]"]
end

node_user(("Library user"))
node_holiday_calendar["Holiday calendar"]

node_user -->|"selects entity"| node_registry
node_registry -->|"loads country"| node_country_rules
node_registry -->|"loads market"| node_financial_rules
node_user -->|"queries dates"| node_holiday_base
node_country_rules -->|"builds calendar"| node_holiday_base
node_us_rules -->|"configures rules"| node_observed
node_us_rules -->|"populates holidays"| node_holiday_base
node_financial_rules -->|"builds calendar"| node_holiday_base
node_nyse_rules -->|"uses date shifting"| node_observed
node_holiday_base -->|"uses date helpers"| node_gregorian
node_christian_groups -->|"uses dates"| node_gregorian
node_christian_groups -->|"uses calendar"| node_ethiopian
node_christian_groups -->|"uses calendar"| node_julian_calendar
node_hindu_groups -->|"calculates dates"| node_hindu_calendar
node_hindu_groups -->|"uses holidays"| node_eastern_groups
node_hindu_calendar -->|"extends calendar"| node_custom_calendar
node_hindu_calendar -->|"uses date helpers"| node_gregorian
node_islamic_calendar -->|"extends calendar"| node_custom_calendar
node_islamic_calendar -->|"uses date helpers"| node_gregorian
node_tibetan_calendar -->|"extends calendar"| node_custom_calendar
node_tibetan_calendar -->|"uses date helpers"| node_gregorian
node_user -->|"exports calendar"| node_ics_generator
node_ics_generator -->|"resolves entities"| node_registry
node_ics_generator -->|"reads holidays"| node_holiday_base
node_ics_generator -->|"formats output"| node_ical_format
node_holiday_base -->|"returns dates"| node_holiday_calendar

click node_registry "https://github.com/sahil3028/holidays/blob/dev/holidays/registry.py"
click node_holiday_base "https://github.com/sahil3028/holidays/blob/dev/holidays/holiday_base.py"
click node_observed "https://github.com/sahil3028/holidays/blob/dev/holidays/observed_holiday_base.py"
click node_country_rules "https://github.com/sahil3028/holidays/tree/dev/holidays/countries"
click node_us_rules "https://github.com/sahil3028/holidays/blob/dev/holidays/countries/united_states.py"
click node_financial_rules "https://github.com/sahil3028/holidays/tree/dev/holidays/financial"
click node_nyse_rules "https://github.com/sahil3028/holidays/blob/dev/holidays/financial/ny_stock_exchange.py"
click node_gregorian "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/gregorian.py"
click node_custom_calendar "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/custom.py"
click node_ethiopian "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/ethiopian.py"
click node_hindu_calendar "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/hindu.py"
click node_islamic_calendar "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/islamic.py"
click node_tibetan_calendar "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/tibetan.py"
click node_julian_calendar "https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/julian.py"
click node_christian_groups "https://github.com/sahil3028/holidays/blob/dev/holidays/groups/christian.py"
click node_hindu_groups "https://github.com/sahil3028/holidays/blob/dev/holidays/groups/hindu.py"
click node_eastern_groups "https://github.com/sahil3028/holidays/blob/dev/holidays/groups/eastern.py"
click node_ics_generator "https://github.com/sahil3028/holidays/blob/dev/holidays/generate_ics.py"
click node_ical_format "https://github.com/sahil3028/holidays/blob/dev/holidays/ical.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registry,node_holiday_base,node_observed,node_user toneBlue
class node_country_rules,node_us_rules,node_financial_rules,node_nyse_rules toneAmber
class node_gregorian,node_custom_calendar,node_ethiopian,node_hindu_calendar,node_islamic_calendar,node_tibetan_calendar,node_julian_calendar,node_christian_groups,node_hindu_groups,node_eastern_groups toneMint
class node_ics_generator,node_ical_format toneRose
class node_holiday_calendar toneIndigo
```

## Components

### Calendar runtime

- [Entity registry](https://github.com/sahil3028/holidays/blob/dev/holidays/registry.py): `holidays/registry.py`
- [HolidayBase](https://github.com/sahil3028/holidays/blob/dev/holidays/holiday_base.py): `holidays/holiday_base.py`
- [Observed dates](https://github.com/sahil3028/holidays/blob/dev/holidays/observed_holiday_base.py): `holidays/observed_holiday_base.py`

### Holiday entities

- [Country rules](https://github.com/sahil3028/holidays/tree/dev/holidays/countries): `holidays/countries`
- [US rules](https://github.com/sahil3028/holidays/blob/dev/holidays/countries/united_states.py): `holidays/countries/united_states.py`
- [Market rules](https://github.com/sahil3028/holidays/tree/dev/holidays/financial): `holidays/financial`
- [NYSE rules](https://github.com/sahil3028/holidays/blob/dev/holidays/financial/ny_stock_exchange.py): `holidays/financial/ny_stock_exchange.py`

### Calendar rules

- [Gregorian calendar](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/gregorian.py): `holidays/calendars/gregorian.py`
- [Custom calendar](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/custom.py): `holidays/calendars/custom.py`
- [Ethiopian calendar](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/ethiopian.py): `holidays/calendars/ethiopian.py`
- [Hindu calendar](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/hindu.py): `holidays/calendars/hindu.py`
- [Islamic calendar](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/islamic.py): `holidays/calendars/islamic.py`
- [Tibetan calendar](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/tibetan.py): `holidays/calendars/tibetan.py`
- [Julian calendars](https://github.com/sahil3028/holidays/blob/dev/holidays/calendars/julian.py): `holidays/calendars/julian.py`
- [Christian holidays](https://github.com/sahil3028/holidays/blob/dev/holidays/groups/christian.py): `holidays/groups/christian.py`
- [Hindu holidays](https://github.com/sahil3028/holidays/blob/dev/holidays/groups/hindu.py): `holidays/groups/hindu.py`
- [Eastern holidays](https://github.com/sahil3028/holidays/blob/dev/holidays/groups/eastern.py): `holidays/groups/eastern.py`

### Markets and exports

- [ICS export](https://github.com/sahil3028/holidays/blob/dev/holidays/generate_ics.py): `holidays/generate_ics.py`
- [iCalendar formatting](https://github.com/sahil3028/holidays/blob/dev/holidays/ical.py): `holidays/ical.py`

### Other components

- **Library user**
- **Holiday calendar**

## Connections

- Library user → Entity registry: selects entity
- Entity registry → Country rules: loads country (evidence: `holidays/registry.py`)
- Entity registry → Market rules: loads market (evidence: `holidays/registry.py`)
- Library user → HolidayBase: queries dates
- Country rules → HolidayBase: builds calendar (evidence: `holidays/countries/nicaragua.py`)
- US rules → Observed dates: configures rules (evidence: `holidays/countries/united_states.py`)
- US rules → HolidayBase: populates holidays (evidence: `holidays/countries/united_states.py`)
- Market rules → HolidayBase: builds calendar (evidence: `holidays/financial/ny_stock_exchange.py`)
- NYSE rules → Observed dates: uses date shifting (evidence: `holidays/financial/ny_stock_exchange.py`)
- HolidayBase → Gregorian calendar: uses date helpers (evidence: `holidays/holiday_base.py`)
- Christian holidays → Gregorian calendar: uses dates (evidence: `holidays/groups/christian.py`)
- Christian holidays → Ethiopian calendar: uses calendar (evidence: `holidays/groups/christian.py`)
- Christian holidays → Julian calendars: uses calendar (evidence: `holidays/groups/christian.py`)
- Hindu holidays → Hindu calendar: calculates dates (evidence: `holidays/groups/hindu.py`)
- Hindu holidays → Eastern holidays: uses holidays (evidence: `holidays/groups/hindu.py`)
- Hindu calendar → Custom calendar: extends calendar (evidence: `holidays/calendars/hindu.py`)
- Hindu calendar → Gregorian calendar: uses date helpers (evidence: `holidays/calendars/hindu.py`)
- Islamic calendar → Custom calendar: extends calendar (evidence: `holidays/calendars/islamic.py`)
- Islamic calendar → Gregorian calendar: uses date helpers (evidence: `holidays/calendars/islamic.py`)
- Tibetan calendar → Custom calendar: extends calendar (evidence: `holidays/calendars/tibetan.py`)
- Tibetan calendar → Gregorian calendar: uses date helpers (evidence: `holidays/calendars/tibetan.py`)
- Library user → ICS export: exports calendar
- ICS export → Entity registry: resolves entities (evidence: `holidays/generate_ics.py`)
- ICS export → HolidayBase: reads holidays (evidence: `holidays/generate_ics.py`)
- ICS export → iCalendar formatting: formats output (evidence: `holidays/generate_ics.py`)
- HolidayBase → Holiday calendar: returns dates
