A fast, efficient Python library for generating country- and subdivision- (e.g. state or province) specific sets of government-designated holidays on the fly. It aims to make determining whether a specific date is a holiday as fast and flexible as possible.
| PyPI |
|
| CI/CD |
|
| Code |
|
| Docs |
|
| GitHub |
|
| Citation |
|
The latest stable version can always be installed or updated via pip:
pip install --upgrade holidays
The latest development (dev) version can be installed directly from GitHub:
pip install --upgrade https://github.com/vacanza/holidays/tarball/dev
All new features are always first pushed to dev branch, then released on main branch upon official version upgrades.
The documentation is hosted on Read the Docs.
Holiday calendars can be exported as .ics files via the download page.
from datetime import date
import holidays
us_holidays = holidays.US() # this is a dict-like object
# the below is the same, but takes a string:
us_holidays = holidays.country_holidays('US') # this is a dict-like object
nyse_holidays = holidays.NYSE() # this is a dict-like object
# the below is the same, but takes a string:
nyse_holidays = holidays.financial_holidays('NYSE') # this is a dict-like object
date(2015, 1, 1) in us_holidays # True
date(2015, 1, 2) in us_holidays # False
us_holidays.get('2014-01-01') # "New Year's Day"
The HolidayBase dict-like class will also recognize date strings and Unix timestamps:
'2014-01-01' in us_holidays # True
'1/1/2014' in us_holidays # True
1388597445 in us_holidays # True
Some holidays may be only present in parts of a country:
us_pr_holidays = holidays.country_holidays('US', subdiv='PR')
'2018-01-06' in us_holidays # False
'2018-01-06' in us_pr_holidays # True
Please see the holidays documentation for additional examples and detailed information.
We currently support 250 country codes, which primarily follow ISO 3166-1, with a small number of widely used user-assigned or reserved codes (for example, XK for Kosovo).
In general, the standard way to refer to a country is by using its ISO 3166-1 alpha-2 code,
the same used for domain names, and for a subdivision its ISO 3166-2
code. Some countries have common or foreign names or
abbreviations as aliases for their subdivisions. These are defined in the (optional)
subdivisions_aliases attribute.
[!note] Subdivisions aliases
Aliases are optional. When present,
subdivisions_aliasescover only a subset of subdivisions - commonly used or officially recognized alternative names. Supported subdivisions and their aliases (where available) are listed in theSubdivisionscolumn of the table below.
Some of the countries support more than one language for holiday names output. A default language is defined by default_language (optional) attribute for each
entity and is used as a fallback when neither user specified language nor user locale language
available. The default language code is a ISO 639-1
code. A list of all languages supported by
country is defined by supported_languages (optional) attribute. If there is no designated ISO
639-1 code then ISO 639-2
code can be used.
Many countries have other categories of holidays in addition to common (national-wide) holidays:
bank holidays, school holidays, additional (paid or non-paid) holidays, holidays of state or public
employees, religious holidays (valid only for these religions followers). A list of all categories
supported by country is defined by supported_categories (optional) attribute.
The following is a list of supported countries, their subdivisions followed by their aliases (if any) in brackets, available languages and additional holiday categories. All countries support PUBLIC holidays category by default. All other default values are highlighted with bold:
| Country | Code | Subdivisions | Supported Languages | Supported Categories |
|---|---|---|---|---|
| Afghanistan | AF | en_US, fa_AF, ps_AF | ||
| Åland Islands | AX | Can also be loaded as country FI, subdivision 01 | en_US, fi, sv_FI, th, uk | UNOFFICIAL, WORKDAY |
| Albania | AL | en_US, sq, uk | ||
| Algeria | DZ | ar, en_US, fr, kab | CHRISTIAN, HEBREW | |
| American Samoa | AS | Can also be loaded as country US, subdivision AS | en_US, th | UNOFFICIAL |
| Andorra | AD | Parishes: 02 (Canillo), 03 (Encamp), 04 (La Massana), 05 (Ordino), 06 (Sant Julià de Lòria), 07 (Andorra la Vella), 08 (Escaldes-Engordany) | ca, en_US, uk | GOVERNMENT |
| Angola | AO | en_US, pt_AO, uk | ||
| Anguilla | AI | en_AI, en_US | ||
| Antarctica | AQ | |||
| Antigua and Barbuda | AG | |||
| Argentina | AR | Provinces: A (Salta), B (Buenos Aires), C (Ciudad Autónoma de Buenos Aires), D (San Luis), E (Entre Ríos), F (La Rioja), G (Santiago del Estero), H (Chaco), J (San Juan), K (Catamarca), L (La Pampa), M (Mendoza), N (Misiones), P (Formosa), Q (Neuquén), R (Río Negro), S (Santa Fe), T (Tucumán), U (Chubut), V (Tierra del Fuego), W (Corrientes), X (Córdoba), Y (Jujuy), Z (Santa Cruz) | en_US, es, uk | ARMENIAN, BANK, GOVERNMENT, HEBREW, ISLAMIC |
| Armenia | AM | Regions: AG (Aragac̣otn, Aragatsotn), AR (Ararat), AV (Armavir), ER (Erevan), GR (Geġark'unik', Gegharkunik), KT (Kotayk', Kotayk), LO (Loṙi, Lori), SH (Širak, Shirak), SU (Syunik', Syunik), TV (Tavuš, Tavush), VD (Vayoć Jor, Vayots Dzor) | en_US, hy | WORKDAY |
| Aruba | AW | en_US, nl, pap_AW, uk | ||
| Australia | AU | States and territories: ACT (Australian Capital Territory), NSW (New South Wales), NT (Northern Territory), QLD (Queensland), SA (South Australia), TAS (Tasmania), VIC (Victoria), WA (Western Australia) | en_AU, en_US, th | BANK, HALF_DAY |
| Austria | AT | States: 1 (Burgenland, Bgld, B), 2 (Kärnten, Ktn, K), 3 (Niederösterreich, NÖ, N), 4 (Oberösterreich, OÖ, O), 5 (Salzburg, Sbg, S), 6 (Steiermark, Stmk, St), 7 (Tirol, T), 8 (Vorarlberg, Vbg, V), 9 (Wien, W) | de, en_US, th, uk | BANK, PROTESTANT |
| Azerbaijan | AZ | az, en_US, uk | WORKDAY | |
| Bahamas | BS | |||
| Bahrain | BH | ar, en_US | ||
| Bangladesh | BD | ar, bn, en_BD, en_US | ||
| Barbados | BB | |||
| Belarus | BY | be, en_US, ru, th | WORKDAY | |
| Belgium | BE | de, en_US, fr, nl, uk | BANK | |
| Belize | BZ | |||
| Benin | BJ | en_US, fr_BJ | WORKDAY | |
| Bermuda | BM | en_BM, en_US | ||
| Bhutan | BT | Administrative Subdivisions: 11 (Paro), 12 (Chhukha), 13 (Haa), 14 (Samtse), 15 (Thimphu), 21 (Tsirang), 22 (Dagana), 23 (Punakha), 24 (Wangdue Phodrang), 31 (Sarpang), 32 (Trongsa), 33 (Bumthang), 34 (Zhemgang), 41 (Trashigang), 42 (Monggar), 43 (Pema Gatshel), 44 (Lhuentse), 45 (Samdrup Jongkhar), GA (Gasa), TY (Trashi Yangtse) | dz, en_US | |
| Bolivia | BO | Departments: B (El Beni), C (Cochabamba), H (Chuquisaca), L (La Paz), N (Pando), O (Oruro), P (Potosí), S (Santa Cruz), T (Tarija) | en_US, es, uk | |
| Bonaire, Sint Eustatius and Saba | BQ | Subdivisions: BON (Bonaire), SAB (Saba), STA (Sint Eustatius) | en_BQ, en_US, nl, pap_BQ | |
| Bosnia and Herzegovina | BA | Entities and district: BIH (Federacija Bosne i Hercegovine, FBiH), BRC (Brčko distrikt, BD), SRP (Republika Srpska, RS) | bs, en_US, sr, uk | |
| Botswana | BW | |||
| Bouvet Island | BV | |||
| Brazil | BR | States: AC (Acre), AL (Alagoas), AM (Amazonas), AP (Amapá), BA (Bahia), CE (Ceará), DF (Distrito Federal), ES (Espírito Santo), GO (Goiás), MA (Maranhão), MG (Minas Gerais), MS ( |
$ claude mcp add holidays \
-- python -m otcore.mcp_server <graph>