Skip to content

Commit

Permalink
v.0.18 (#876)
Browse files Browse the repository at this point in the history
* Refactor weekdays/weekends logic.

  - Deprecate MON-SUN constants in favor of dateutil MO-SA.
  - Deprecate and move `WEEKENDS` from utils to HolidayBase
    (on per country basis as some countries have not usual SAT, SUN weekends).
  - Add `_is_weekend` method into `HolidayBase`.
  - Change isort multi-line import behavior to bracket-less.
  - Update flake8 settings in order to make it stricter.
  - Remove unused imports.
  - Remove unused/commented out code.

* Migrate special holidays for all countries.

Move logic from `_populate` to `special_holidays` for:
  - Botswana
  - Eswatini
  - Hongkong
  - Ireland
  - Japan
  - South Korea
  - Lesotho
  - Namibia
  - Poland
  - Singapore
  - Slovakia
  - South Africa
  - Zambia

* Rename Korea to South Korea.

Update tests and documentation.

* Fix pre-commit.

* Fix pre-comit and sphinx.

* Address review comments.

* Hong Kong:
- holidays establishing years specified
- historical holidays added
- Lunar New Year and Christmas calculation fix
- Ching Ming Festival and Easter Monday overlapping fix
- optimizations
- tests added

* Optimize `if var in iterable:` statements.

Replace a tuple/list with a set in order to achieve
O(n) -> ~O(1) complexity improvement.

* Change `weekend` data type to set.

* Fix pre-commit config.

* Update holidays/countries/israel.py

Co-authored-by: ~Jhellico <[email protected]>

* Fix Israel holidays.

* Migrate Singapore polling days.

* v.0.18 beta init

* Added Indonesian holidays (#787)

* CHANGES sync

* Korea: fixed holidays relevance period (#791)

* CHANGES sync

* Korea quicker tests

* CHANGES sync

* Clean up unused imports. (#792)

* Implement flake8 suggested fixes.
  - Fine tune flake8 setup.cfg config.
  - Remove unused imports.
  - Add __init__.py to test/financial
    Reconfigure flake8 to use per file ignores.
* Fix pre-commit.
* Add flake8-print.

* flake8 settings review

* flake8 settings, print removal

* Clean up .pre-commit-config.yaml. (#795)

* Clean up .pre-commit-config.yaml.
Re-enable rstcheck hook.
* Change flake8 source URL.
Co-authored-by: dr-prodigy <[email protected]>

* CHANGES sync

* Hong Kong fix

* CHANGES sync

* Zambia: optimizations, added special holidays (#798)

Co-authored-by: dr-prodigy <[email protected]>

* CHANGES sync

* Vietnam: optimizations, observed holidays calculation (#799)

* CHANGES sync

* CHANGES sync

* Uruguay: update holiday names (#809)

* Easter related holidays refactoring and unification (#803)

* Canada: make observed New Year's Day fall on or after the holiday (#811)

* CHANGES sync

* Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.5.2 (#816)

* Address comments (use `self._is_weekend()`).

* Refactor tests. Introduce `common.TestCase`. (#800)

* Refactor tests. Introduce `common.TestCase`.

The `TestCase` class simplifies country holiday tests by providing
ready to use testing methods. It also reduces code clutter, improves
tests readability.

* Add instance eq. assertion.

Merged by: dr-prodigy <[email protected]>

* CHANGES sync

* Malaysia: (#802)

- fixed dates of some islamic and lunisolar calendar holidays
- rewritten observed calculation (by states)
- huge refactoring
- rewritten tests

* CHANGES sync

* Nigeria holiday updates (#823)

* Financial holiday - Day of Mourning for President George H.W. Bush (#817)

* Madagascar: added holidays with tests (#818)

* Paraguay updates (#819)

- added special holidays
- fixed observance calculation

* South Africa: optimizations (#820)

* Switzerland: optimizations, Näfelser Fahrt fix (#821)

* Angola: optimizations, observance calculation fix (#822)

* India: Diwali and Holi holidays update (#825)

* Hungary: removed double holiday Dec 31 (#826)

* Observed holidays calc optimizations (#824)

* Address review comments.
Add isort first-parties.

* Remove deprecation warnings.
Fix minor issues.

* Bump actions/setup-python from 4.3.0 to 4.3.1 (#831)

* Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.6.4 (#832)

Co-authored-by: dr-prodigy <[email protected]>

* chile: Día Nacional de los Pueblos Indígenas (#828)

Fix the holiday day when year > 2021 according to the calculated
solstice datetime adjusted to Chile timezone UTC-3
Added necessary util Class _AstroMeeusAlgorithms

Issue: 666

* Kazakhstan: (#829)

- observed holidays
- holidays relevance period

* Improve `common.TestCase` (#830)

* Adding financial holidays - Hurricane Gloria and Sandy (#833)

Co-authored-by: Arkadii Yakovets <[email protected]>

* Angola small refactoring (#835)

* New Zealand: optimizations (#836)

* UK King’s Coronation holiday in 2023 (#840)

* CHANGES sync

* Revert "Kazakhstan: (#829)" (#842)

This reverts commit bfde36d.

* Fix `TestCase::parse_arguments` instance determining logic. (#844)

* Chile:
- holidays relevance period fixes
- historical holidays added
- special holidays added
- tests for all holidays

* Revert "Revert "Kazakhstan: (#829)" (#842)" (#845)

This reverts commit 4008a7e.

* CHANGES sync

* Fix conflict solving errors

* South Africa: added 27 Dec 2002 public holiday (#848)

* CHANGES sync

* Add Pakistan holidays (#847)

* CHANGES

* Added tests for _AstroMeeusAlgorithms (#851)

* Pin `coverage` version. (#862)

Add a temporary version pin in order to fix GH CI/CD.

* japan: refactor japanese equinox holidays

Refactored japanese holidays to make use of Meeus algorithms
Include pymeeus in requirements_dev.txt which was already a
transitive dependency associated with convertdate
Sort dependencies alphabetically in requirements_dev.txt

* NYSE: fix Election Day holiday (#853)

* Fix South Korea deprecation warnings. (#854)

* United States: (#857)

* Malaysia multi-day Islamic holidays fixed (#858)

* Bump actions/setup-python from 4.3.0 to 4.4.0 (#871)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v4.3.0...v4.4.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maurizio Montel <[email protected]>

* Kazakhstan: (#867)

- update holidays relevance period
- update holidays names

* New Zealand: observed holidays calc optimizations (#872)

* Refactor imports (#870)

* Reconfigure holidays imports.
  * Unify top level imports style
  * Limit imports for holiday_base and utils
  * Reorder country imports
  * Add Moldova alpha-3 code
  * Add tests

* Redesign holidays imports tests.

* Added Armenia holidays (#875)

* Added Armenia holidays

* Update test/countries/test_armenia.py

Co-authored-by: Arkadii Yakovets <[email protected]>

Co-authored-by: Maurizio Montel <[email protected]>
Co-authored-by: Arkadii Yakovets <[email protected]>

* Azerbaijan: full refactoring #859

* CHANGES sync

* Chile: refactor equinox holiday to use pymeeus (#863)

* Add PyMeeus explicit dependency #863

* setup-cfg-fmt update

* v.0.18

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Arkadii Yakovets <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: Maurizio Montel <[email protected]>
Co-authored-by: Jason Jensen <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: SnowX65 <[email protected]>
Co-authored-by: Pedro Baptista <[email protected]>
Co-authored-by: Nalguedo <[email protected]>
  • Loading branch information
9 people authored Dec 27, 2022
1 parent 8ca8167 commit 39f3538
Show file tree
Hide file tree
Showing 158 changed files with 6,945 additions and 4,236 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v4.4.0
- name: Run pre-commit
uses: pre-commit/[email protected]

Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v4.4.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v4.4.0
with:
python-version: "3.10"
- name: Install dependencies
Expand All @@ -80,7 +80,7 @@ jobs:
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.5.1
uses: pypa/gh-action-pypi-publish@v1.6.4
with:
user: __token__
password: ${{ secrets.pypi_password }}
23 changes: 11 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
Expand All @@ -17,10 +17,12 @@ repos:
- id: black
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-print
args: [--max-line-length=79]

- repo: https://github.com/pre-commit/mirrors-isort
Expand All @@ -30,7 +32,7 @@ repos:
exclude: ^docs/

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.990'
rev: v0.991
hooks:
- id: mypy
additional_dependencies: [types-all]
Expand All @@ -44,14 +46,11 @@ repos:
hooks:
- id: rst-backticks

# Temporarily disabled due to unable to suppress
# [WinError 2] The system cannot find the file specified
# - repo: https://github.com/myint/rstcheck
# rev: 3f92957478422df87bd730abde66f089cc1ee19b
# hooks:
# - id: rstcheck
# additional_dependencies: [rstcheck]
# args: [--ignore-directives=automodule]
- repo: https://github.com/myint/rstcheck
rev: v6.1.1
hooks:
- id: rstcheck
additional_dependencies: [rstcheck, sphinx]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.2.0
Expand Down
42 changes: 42 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
Version 0.18
============

Released December 27, 2022

- Code refactoring #801, #870 (arkid15r)
- Test refactoring / common functions #800, #830, #844 (arkid15r)
- Pre-commit reviews #786, #795 (KJhellico, arkid15r, dr-p)
- Import cleanup, flake8 settings review #792 (arkid15r, KJhellico, dr-p)
- PyMeeus for equinox and solstice calculation #828, #863 (Nalguedo)
- Easter holidays refactoring and unification #803 (KJhellico)
- Observed holidays calc optimizations #824 (KJhellico)
- Special holidays refactoring for 13 countries #796 (arkid15r, KJhellico)
- Support for Indonesia #787 (KJhellico)
- Support for Pakistan #847 (KJhellico)
- Support for Armenia #875 (KJhellico)
- Korea renamed to South Korea #797 (arkid15r)
- Azerbaijan: refactoring #859 (KJhellico)
- Hong Kong: optimizations #786 (KJhellico)
- Korea fixes #791 (KJhellico) + test optimizations (dr-p)
- Zambia: optimizations and refactoring #798 (KJhellico)
- Vietnam: optimizations and refactoring #799 (KJhellico)
- Malaysia: optimizations, refactoring and fixes #802, #858 (KJhellico)
- New Zealand: optimizations and refactoring #836 (KJhellico)
- Chile: optimizations #834 (KJhellico) + fixes #828 (Nalguedo)
- Uruguay updates #809 (KJhellico)
- Kazakhstan updates #829, #867 (KJhellico)
- Canada fixes #811 (jasonjensen)
- Nigeria updates #823 (KJhellico)
- NY Stock Exchange updates #817, #853 (SnowX65, KJHellico)
- New Zealand optimizazions #872 (KJhellico)
- Madagascar updates #818 (KJhellico)
- Paraguay updates #819 (KJhellico)
- United Kingdom updates #840 (KJhellico)
- South Africa: optimizations and updates #820, #848 (KJhellico)
- US updates #857 (KJhellico)
- Switzerland: optimizations, fix #821 (KJhellico)
- Angola: optimizations, fix #822, #835 (KJhellico)
- India updates #825 (KJhellico)
- NY Stock Exchange updates #833 (SnowX65, KJhellico)
- Hungary fixes #826 (KJhellico)

Version 0.17.2
==============

Expand Down
23 changes: 16 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ Some holidays may be only present in parts of a country:
'2018-01-06' in us_holidays # False
'2018-01-06' in us_pr_holidays # True
.. _documentation: https://python-holidays.readthedocs.io/
.. _python-holidays documentation: https://python-holidays.readthedocs.io/

Please see the `documentation`_ for additional examples and detailed
information.
Please see the `python-holidays documentation`_ for additional examples and
detailed information.


Available Countries
-------------------

.. _ISO 3166-1 alpha-2 code: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

We currently support 96 countries. The standard way to refer to a country is by
We currently support 101 countries. The standard way to refer to a country is by
using its `ISO 3166-1 alpha-2 code`_, the same used for domain names. The
following countries and their subdivisions are available:

Expand All @@ -124,6 +124,9 @@ following countries and their subdivisions are available:
* - Argentina
- AR
- None
* - Armenia
- AM
- None
* - Aruba
- AW
- None
Expand Down Expand Up @@ -238,6 +241,9 @@ following countries and their subdivisions are available:
* - India
- IN
- States: AN, AP, AR, AS, BR, CG, CH, DD, DH, DL, GA, GJ, HP, HR, JH, JK, KA, KL, LA, LD, MH, ML, MN, MP, MZ, NL, OR, PB, PY, RJ, SK, TN, TR, TS, UK, UP, WB
* - Indonesia
- ID
- None
* - Ireland
- IE
- None
Expand All @@ -262,9 +268,6 @@ following countries and their subdivisions are available:
* - Kenya
- KE
- None
* - Korea
- KR
- None
* - Latvia
- LV
- None
Expand Down Expand Up @@ -325,6 +328,9 @@ following countries and their subdivisions are available:
* - Norway
- NO
- None
* - Pakistan
- PK
- None
* - Paraguay
- PY
- None
Expand Down Expand Up @@ -361,6 +367,9 @@ following countries and their subdivisions are available:
* - South Africa
- ZA
- None
* - South Korea
- KR
- None
* - Spain
- ES
- Autonomous communities: AN (Andalucía), AR (Aragón), AS (Asturias), CB (Cantabria), CE (Ceuta), CL (Castilla y León), CM (Castilla La Mancha), CN (Canarias), CT (Cataluña), EX (Extremadura), GA (Galicia), IB (Islas Baleares), MC (Murcia), MD (Madrid), NC (Navarra), PV (País Vasco), RI (La Rioja), VC (Comunidad Valenciana)
Expand Down
36 changes: 5 additions & 31 deletions holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,11 @@
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)
from holidays.constants import (
MON,
TUE,
WED,
THU,
FRI,
SAT,
SUN,
WEEKEND,
JAN,
FEB,
MAR,
APR,
MAY,
JUN,
JUL,
AUG,
SEP,
OCT,
NOV,
DEC,
)

from holidays.constants import *
from holidays.countries import *
from holidays.financial import *
from holidays.holiday_base import * # * import required for IDE docstrings
from holidays.utils import (
CountryHoliday,
country_holidays,
financial_holidays,
list_supported_countries,
list_supported_financial,
)
from holidays.holiday_base import *
from holidays.utils import *

__version__ = "0.17.2"
__version__ = "0.18"
41 changes: 22 additions & 19 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from .angola import AGO, AO, Angola
from .angola import AO, AGO, Angola
from .argentina import AR, ARG, Argentina
from .aruba import ABW, AW, Aruba
from .armenia import AM, ARM, Armenia
from .aruba import AW, ABW, Aruba
from .australia import AU, AUS, Australia
from .austria import AT, AUT, Austria
from .azerbaijan import AZ, AZE, Azerbaijan
from .bangladesh import BD, BGD, Bangladesh
from .belarus import BLR, BY, Belarus
from .belarus import BY, BLR, Belarus
from .belgium import BE, BEL, Belgium
from .bolivia import BO, BOL, Bolivia
from .bosnia_and_herzegovina import BA, BIH, BosniaAndHerzegovina
from .botswana import BW, BWA, Botswana
from .brazil import BR, BRA, Brazil
from .bulgaria import BG, BLG, Bulgaria
from .burundi import BDI, BI, Burundi
from .burundi import BI, BDI, Burundi
from .canada import CA, CAN, Canada
from .chile import CHL, CL, Chile
from .china import CHN, CN, China
from .chile import CL, CHL, Chile
from .china import CN, CHN, China
from .colombia import CO, COL, Colombia
from .croatia import HR, HRV, Croatia
from .cuba import CU, CUB, Cuba
from .curacao import CUW, CW, Curacao
from .curacao import CW, CUW, Curacao
from .cyprus import CY, CYP, Cyprus
from .czechia import CZ, CZE, Czechia
from .denmark import DK, DNK, Denmark
Expand All @@ -50,39 +51,40 @@
from .hungary import HU, HUN, Hungary
from .iceland import IS, ISL, Iceland
from .india import IN, IND, India
from .indonesia import ID, IDN, Indonesia
from .ireland import IE, IRL, Ireland
from .isle_of_man import IM, IMN, IsleOfMan
from .israel import IL, ISR, Israel
from .italy import IT, ITA, Italy
from .jamaica import JAM, JM, Jamaica
from .jamaica import JM, JAM, Jamaica
from .japan import JP, JPN, Japan
from .kazakhstan import KAZ, KZ, Kazakhstan
from .kazakhstan import KZ, KAZ, Kazakhstan
from .kenya import KE, KEN, Kenya
from .korea import KOR, KR, Korea
from .latvia import LV, LVA, Latvia
from .lesotho import LS, LSO, Lesotho
from .liechtenstein import LI, LIE, Liechtenstein
from .lithuania import LT, LTU, Lithuania
from .luxembourg import LU, LUX, Luxembourg
from .madagascar import MDG, MG, Madagascar
from .madagascar import MG, MDG, Madagascar
from .malawi import MW, MWI, Malawi
from .malaysia import MY, MYS, Malaysia
from .malta import MLT, MT, Malta
from .mexico import MEX, MX, Mexico
from .moldova import MD, Moldova
from .malta import MT, MLT, Malta
from .mexico import MX, MEX, Mexico
from .moldova import MD, MDA, Moldova
from .morocco import MA, MOR, Morocco
from .mozambique import MOZ, MZ, Mozambique
from .mozambique import MZ, MOZ, Mozambique
from .namibia import NA, NAM, Namibia
from .netherlands import NL, NLD, Netherlands
from .new_zealand import NZ, NZL, NewZealand
from .nicaragua import NI, NIC, Nicaragua
from .nigeria import NG, NGA, Nigeria
from .north_macedonia import MK, MKD, NorthMacedonia
from .norway import NO, NOR, Norway
from .paraguay import PRY, PY, Paraguay
from .pakistan import PK, PAK, Pakistan
from .paraguay import PY, PRY, Paraguay
from .peru import PE, PER, Peru
from .poland import PL, POL, Poland
from .portugal import PRT, PT, Portugal
from .portugal import PT, PRT, Portugal
from .romania import RO, ROU, Romania
from .russia import RU, RUS, Russia
from .saudi_arabia import SA, SAU, SaudiArabia
Expand All @@ -91,6 +93,7 @@
from .slovakia import SK, SVK, Slovakia
from .slovenia import SI, SVN, Slovenia
from .south_africa import ZA, ZAF, SouthAfrica
from .south_korea import KR, KOR, Korea, SouthKorea
from .spain import ES, ESP, Spain
from .sweden import SE, SWE, Sweden
from .switzerland import CH, CHE, Switzerland
Expand All @@ -99,9 +102,9 @@
from .turkey import TR, TUR, Turkey
from .ukraine import UA, UKR, Ukraine
from .united_arab_emirates import AE, ARE, UnitedArabEmirates
from .united_kingdom import GB, GBR, UK, UnitedKingdom
from .united_kingdom import GB, UK, GBR, UnitedKingdom
from .united_states import US, USA, UnitedStates
from .uruguay import URY, UY, Uruguay
from .uruguay import UY, URY, Uruguay
from .uzbekistan import UZ, UZB, Uzbekistan
from .venezuela import VE, VEN, Venezuela
from .vietnam import VN, VNM, Vietnam
Expand Down
Loading

0 comments on commit 39f3538

Please sign in to comment.