Skip to content

Commit

Permalink
Merge pull request #1997 from vacanza/dev
Browse files Browse the repository at this point in the history
v0.57
  • Loading branch information
arkid15r committed Sep 16, 2024
2 parents 6626646 + 1e77643 commit 228cc45
Show file tree
Hide file tree
Showing 92 changed files with 3,141 additions and 2,119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
pre-commit autoupdate
pre-commit run --all-files
- uses: peter-evans/create-pull-request@v6.1.0
- uses: peter-evans/create-pull-request@v7.0.1
with:
base: dev
body: Update pre-commit hooks to their latest versions.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: |
make snapshot
- uses: peter-evans/create-pull-request@v6.1.0
- uses: peter-evans/create-pull-request@v7.0.1
with:
base: dev
body: Automatically generated snapshots update.
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- rst

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.6.5
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -38,6 +38,8 @@ repos:
rev: 1.7.9
hooks:
- id: bandit
additional_dependencies:
- bandit[toml]
args:
- --configfile=pyproject.toml

Expand Down Expand Up @@ -74,7 +76,7 @@ repos:
- id: rst-backticks

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: '1.3.1'
rev: '1.4.0'
hooks:
- id: tox-ini-fmt

Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Alexei Mikhailov
Anders Wenhaug
Andrei Klimenko
Andres Marrugo
Anon Kangpanich
Anthony Rose
Anton Daitche
Arjun Anandkumar
Expand Down
16 changes: 16 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
Version 0.57
============

Released September 16, 2024

- Update Australia holidays: add `en_AU`, `en_US`, `th` localization (#1977 by @PPsyrius)
- Fix some docstrings (#1994 by @KJhellico)
- Update Australia holidays: fix Christmas Day in ACT (#1986 by @KJhellico)
- Update Germany holidays: add `th` localization, deprecated non-standard ISO code, add subdivision aliases (#1979 by @PPsyrius, @arkid15r)
- Update Jersey holidays (#1971 by @PPsyrius)
- Update South Korea holidays: add Armed Forces Day in 2024 (#1973 by @KJhellico)
- Update examples to reflect recent holidays changes (#1978 by @KJhellico)
- Add Frances Xavier Cabrini Day for United States, Colorado (#1995 by @e2thenegpii, @arkid15r)
- Extend `_ThaiLunisolar` calendar support to 2157 (#1981 by @PPsyrius)
- Unify en_US Islamic holidays name translation (#1984 by @KJhellico)

Version 0.56
============

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ package:
pre-commit:
pre-commit run --all-files

release-notes:
@scripts/generate_release_notes.py

sbom:
@python -m cyclonedx_py requirements requirements/runtime.txt

Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ All other default values are highlighted with bold:
* - 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
Expand Down Expand Up @@ -447,9 +447,9 @@ All other default values are highlighted with bold:
- GOVERNMENT
* - Germany
- DE
- States: BB, BE, BW, BY, BYP, HB, HE, HH, MV, NI, NW, RP, SH, SL, SN, ST, TH
- **de**, en_US, uk
-
- States: BB (Brandenburg), BE (Berlin), BW (Baden-Württemberg), BY (Bayern), HB (Bremen), HE (Hessen), HH (Hamburg), MV (Mecklenburg-Vorpommern), NI (Niedersachsen), NW (Nordrhein-Westfalen), RP (Rheinland-Pfalz), SH (Schleswig-Holstein), SL (Saarland), SN (Sachsen), ST (Sachsen-Anhalt), TH (Thüringen)
- **de**, en_US, th, uk
- CATHOLIC
* - Ghana
- GH
-
Expand Down
5 changes: 2 additions & 3 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ How to release a new version of Python Holidays

- switch to ``dev`` branch and pull the most recent changes
from https://github.com/vacanza/python-holidays remote ``dev`` branch.
- generate release notes by running the following script
``scripts/generate_release_notes.py``
- insert the script's output into the top of ``CHANGES`` file
- generate release notes by running ``make release-notes``
- insert the command's output into the top of ``CHANGES`` file
(see previous release notes for consistent formatting)
- commit the updated ``CHANGES`` file to ``dev`` branch with the following
commit message 'Finalize v<version>', e.g. 'Finalize v0.39'
Expand Down
29 changes: 11 additions & 18 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Let's print out the holidays in 2014 specific to California, USA:
2014-01-20 Martin Luther King Jr. Day
2014-02-15 Susan B. Anthony Day
2014-02-17 Washington's Birthday
2014-03-31 César Chávez Day
2014-03-31 Cesar Chavez Day
2014-05-26 Memorial Day
2014-07-04 Independence Day
2014-09-01 Labor Day
2014-10-13 Columbus Day
2014-11-11 Veterans Day
2014-11-27 Thanksgiving
2014-11-28 Day After Thanksgiving
2014-12-25 Christmas Day
So far we've only checked holidays in 2014 so that's the only year the Holidays
Expand Down Expand Up @@ -139,15 +139,14 @@ To change the language translation, you can set the language explicitly.
>>> for dt, name in sorted(holidays.ES(years=2023, language="es").items()):
>>> print(dt, name)
2023-01-06 Epifanía del Señor
2023-04-06 Jueves Santo
2023-04-07 Viernes Santo
2023-05-01 Día del Trabajador
2023-05-01 Fiesta del Trabajo
2023-08-15 Asunción de la Virgen
2023-10-12 Día de la Hispanidad
2023-10-12 Fiesta Nacional de España
2023-11-01 Todos los Santos
2023-12-06 Día de la Constitución Española
2023-12-08 La Inmaculada Concepción
2023-12-25 Navidad
2023-12-08 Inmaculada Concepción
2023-12-25 Natividad del Señor
Holiday categories support
--------------------------
Expand All @@ -165,21 +164,20 @@ To get a list of other categories holidays (for countries that support them):
>>> print(dt, name)
2023-01-01 New Year's Day
2023-04-07 Good Friday
2023-04-09 Easter
2023-04-09 Easter Sunday
2023-04-10 Easter Monday
2023-05-01 Labor Day
2023-05-18 Ascension Day
2023-05-19 Friday after Ascension Day
2023-05-28 Whit Sunday
2023-05-29 Whit Monday
2023-07-21 National Day
2023-08-15 Assumption of Mary
2023-08-15 Assumption Day
2023-11-01 All Saints' Day
2023-11-11 Armistice Day
2023-12-25 Christmas Day
2023-12-26 Bank Holiday
Date from holiday name
----------------------

Expand All @@ -190,10 +188,10 @@ with case insensitive check):
.. code-block:: python
>>> us_holidays = holidays.UnitedStates(years=2020)
>>> us_holidays.get_named('day')
>>> sorted(us_holidays.get_named('day'))
[datetime.date(2020, 1, 1), datetime.date(2020, 1, 20),
datetime.date(2020, 2, 17), datetime.date(2020, 5, 25),
datetime.date(2020, 7, 4), datetime.date(2020, 7, 3),
datetime.date(2020, 7, 3), datetime.date(2020, 7, 4),
datetime.date(2020, 9, 7), datetime.date(2020, 10, 12),
datetime.date(2020, 11, 11), datetime.date(2020, 12, 25)]
Expand Down Expand Up @@ -229,9 +227,7 @@ holidays using the built-in :py:func:`sum` function:
>>> a = sum([holidays.CA(subdiv=x) for x in holidays.CA.subdivisions])
>>> a.subdiv
['AB', 'BC', 'MB', 'NB', 'NL', 'NS', 'NT', 'NU', 'ON', 'PE', 'QC', 'SK',
'YU']
['AB', 'BC', 'MB', 'NB', 'NL', 'NS', 'NT', 'NU', 'ON', 'PE', 'QC', 'SK', 'YT']
Creating custom holidays (or augmenting existing ones with private ones)
------------------------------------------------------------------------
Expand Down Expand Up @@ -308,7 +304,6 @@ pairs, a list of dates, or even singular date/string/timestamp objects:
>>> custom_holidays.append(['2015-01-01', '07/04/2015'])
>>> custom_holidays.append(date(2015, 12, 25))
Add years to an existing Holiday object
---------------------------------------

Expand All @@ -323,8 +318,6 @@ holiday object:
# to add new years of holidays to the object:
>>> us_holidays.update(country_holidays('US', years=2021))
Other ways to specify the country
---------------------------------

Expand Down
2 changes: 1 addition & 1 deletion holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from holidays.registry import EntityLoader
from holidays.utils import *

__version__ = "0.56"
__version__ = "0.57"


EntityLoader.load("countries", globals())
Expand Down
83 changes: 67 additions & 16 deletions holidays/calendars/thai.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class _ThaiLunisolar:
"""
** Thai Lunar Calendar Holidays only work from 1941 (B.E. 2484) onwards
until 2057 (B.E. 2600) as we only have Thai year-type data for
until 2157 (B.E. 2700) as we only have Thai year-type data for
cross-checking until then.
So here are the basics of the Thai Lunar Calendar
Expand Down Expand Up @@ -94,14 +94,14 @@ class _ThaiLunisolar:
Usage example:
>>> from holidays.utils import _ThaiLunisolar
>>> from holidays.calendars.thai import _ThaiLunisolar
>>> thls = _ThaiLunisolar()
>>> print(thls.visakha_bucha_date(2010))
2010-05-28
"""

# Athikawan (Extra-Day Year) list goes from 1941-2057 C.E.
# Copied off from 1757-2057 (B.E. 2300-2600) Thai Lunar Calendar
# Athikawan (Extra-Day Year) list goes from 1941-2157 C.E.
# Copied off from 1757-2157 (B.E. 2300-2700) Thai Lunar Calendar
ATHIKAWAN_YEARS_GREGORIAN = {
1945,
1949,
Expand All @@ -125,10 +125,30 @@ class _ThaiLunisolar:
2043,
2046,
2052,
2055,
2058,
2067,
2071,
2076,
2083,
2086,
2092,
2097,
2103,
2109,
2111,
2117,
2121,
2126,
2133,
2136,
2142,
2147,
2153,
}

# Athikamat (Extra-Month Year) list goes from 1941-2057 C.E.:
# Copied off from 1757-2057 (B.E. 2300-2600) Thai Lunar Calendar
# Athikamat (Extra-Month Year) list goes from 1941-2157 C.E.:
# Copied off from 1757-2157 (B.E. 2300-2700) Thai Lunar Calendar
# Approx formula as follows: (common_era-78)-0.45222)%2.7118886 < 1
ATHIKAMAT_YEARS_GREGORIAN = {
1942,
Expand Down Expand Up @@ -174,16 +194,53 @@ class _ThaiLunisolar:
2050,
2053,
2056,
2059,
2062,
2064,
2066,
2069,
2072,
2074,
2077,
2080,
2082,
2085,
2088,
2091,
2094,
2096,
2099,
2101,
2104,
2107,
2112,
2114,
2116,
2119,
2122,
2124,
2127,
2130,
2132,
2135,
2138,
2141,
2144,
2146,
2149,
2151,
2154,
2157,
}

# While Buddhist Holy Days have been observed since the 1900s
# Due to the calendar changes in 1941 (B.E. 2484) and that
# our array only goes up to B.E. 2600; We'll thus only populate
# the data for 1941-2057 (B.E. 2484-2600).
# our array only goes up to B.E. 2700; We'll thus only populate
# the data for 1941-2157 (B.E. 2484-2700).
# Sources: หนังสือเวียนกรมการปกครอง กระทรวงมหาดไทย มท 0310.1/ว4 5 ก.พ. 2539
START_DATE = date(1940, 11, 30)
START_YEAR = 1941
END_YEAR = 2057
END_YEAR = 2157

def __init__(self, calendar=THAI_CALENDAR) -> None:
self.__verify_calendar(calendar)
Expand Down Expand Up @@ -213,7 +270,7 @@ def _get_start_date(self, year: int) -> Optional[date]:
Calculate the start date of that particular Thai Lunar Calendar Year.
This usually falls in November or December of the previous Gregorian
year in question. Should the year be outside of working scope
(1941-2057: B.E 2484-2600), this will returns None instead.
(1941-2157: B.E 2484-2700), this will returns None instead.
:param year:
The Gregorian year.
Expand Down Expand Up @@ -418,9 +475,6 @@ def asarnha_bucha_date(self, year: int) -> Optional[date]:
:param year:
The Gregorian year.
:param calendar:
Calendar type, this defaults to THAI_CALENDAR.
:return:
Estimated Gregorian date of Asarnha Bucha.
"""
Expand Down Expand Up @@ -457,9 +511,6 @@ def khao_phansa_date(self, year: int) -> Optional[date]:
:param year:
The Gregorian year.
:param calendar:
Calendar type, this defaults to THAI_CALENDAR.
:return:
Estimated Gregorian date of Khao Phansa.
"""
Expand Down
1 change: 1 addition & 0 deletions holidays/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
UNOFFICIAL = "unofficial"
WORKDAY = "workday"

CATHOLIC = "catholic"
CHINESE = "chinese"
CHRISTIAN = "christian"
HEBREW = "hebrew"
Expand Down
Loading

0 comments on commit 228cc45

Please sign in to comment.