Skip to content

Commit

Permalink
v.0.20 (#982)
Browse files Browse the repository at this point in the history
* Replace `relativedelta` with `timedelta` for days offset calculation.

* Replace `relativedelta` with `timedelta` for days offset calculation.

* update spain.py with changes for year 2023

* update test_spain.py

* update test_spain.py

* update test_spain.py

* update test_spain.py

* update spain.py with changes for year 2023

* update spain.py with changes for year 2023

* Import timedelta as td.

* Import timedelta as td.

* update spain.py with changes for year 2023

* update spain.py with changes for year 2023

* update spain.py with changes for year 2023

* update spain.py with changes for year 2023

* update spain.py with changes for year 2023

* Update holidays/countries/spain.py

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* Montenegro optimization

* Add initial PR template.

* Update template.

* Update template.

* Change the template.

* add docstring with reference to Spain

* update Spain tests

* remove unused constants

* Add commnent with reference to Spain

* fix

Co-authored-by: Arkadii Yakovets <ark@cho.red>

* Init v.0.20 beta.

* Upgrade dependency: change black version from 22.12.0 to 23.1.0.

* Change holiday name separator from ", " to "; ".

* Update Australia holidays: fix 2020 QLD holidays.

* Jamaica holidays update

* Bosnia and Herzegovina holidays update

* Simplify if/else statement.

* fix

Co-authored-by: Arkadii Yakovets <ark@cho.red>

* Bolivia holidays update and refactoring

* Panama holidays added

* Refactor days offset calculation for recently added countries

* Change some of common.TestCase methods behavior:
  - `TestCase::assertHolidayName
  - `TestCase::assertHolidaysName`
  - `TestCase::assertNoHolidayName`

* Cuba holidays refactoring

* Hong Kong fix

* Thai Lunar Calendar added, exact start of holidays for historic use, refs, etc.

* In-code comment improvements for readability

* Add contact info in case future changes are needed

* Fixed syntax error

* TH Special Holidays code improvements

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH in lieu holiday trigger refactor

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: turns out <= <= is now a thing

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH testcases updated

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: case switch for standardizaton

* TH autoformatting from running `tox`

* TH: E266 comment block format adherence

* TH: E501 line too long format adherence (except link and Thai date names for now)

* TH: E501 cleanups. other final checks (for now)

* TH Sort testcase date

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* Added tests for Thailand

* TH fixed Visakha Bucha trigger

* TH fixed wording, add missing special election holiday

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH fixes New Year's Eve (in lieu)

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH  Songkran special in lieu, fixes Queen Sirikit's bday error

No, you cannot simply changes your own birthday lmao, but the case is indeed correct for Mother's Day

* TH Asarnha-Buddhist Lent Day in lieu fixes

* TH: holiday limiter is ; not , (1)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: holiday limiter is ; not , (2)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: remove redundant function (1)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: remove redundant function (2)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: remove redundant function (3)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: remove redundant function (4)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: remove useless recursive call for `add_holiday`

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: improve test code

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: remove redundant function (5)

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: add missing `self.observed`, remove all defunct codes

* TH: further simplify Asarnha Bucha trigger

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: improve test code (2)

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* Burundi holidays refactoring

* Fix Islamic holidays calculation
- fix for holidays that happen twice in a Gregorian year (primarily islamic New Year)
- years range checking more strictly

* Update environment:
  - Add Makefile, wrap common commands
  - Move all requirements file to `requirements` directory
  - Move tests from `test` to `tests` directory
  - Introduce `pytest-xdist`, make pytest running in parallel
  - Add local pre-push hook for tests
  - Format ci-cd.yml
  - Clean up pyproject.toml
  - Update tox.ini, make tox running in parallel
  - Update setup.cfg
  - Update CONTRIBUTION.rst instructions

* Add filter warnings comment.

* Fix utils tests.

* Set Python version for QA job.

* Run tests via 'make test'.

* TH: no `self.observed` needed if they already have special  in-lieus

* TH: adjust this for coverall tests

* docstring fix

* TH: Thai lunar calendar now works up to 1941, all trigger now starts in 1941

* TH: test case refractor + extend checks to 2030

Individual Holiday's test case:

- assertNoHoliday 1 year prior
- assertHoliday while exists
- assertNoHoliday 1 year post

- asserNoHoliday for holidays_no_observed for 2010-2030

* TH: Buddhist holiday extended testcases, applying suggestions

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* Tests update

* Update .pre-commit-config.yaml and tox.ini.

* Fix imports.

* Botswana observed holidays performance optimization

* Burundi observed holidays performance optimization

* Ukraine observed holidays performance optimization

* TH: remove `_en` suffix, `__init__(self, **kwargs):`

* TH: code improvements suggestions from @arkid15r

Co-Authored-By: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* TH: remove financial holiday stubs (this will be its own thing later)

* TH: move sources to 2nd row, `_ThaiLuniSolar` is now in util.py

* fix

Co-authored-by: Arkadii Yakovets <ark@cho.red>

* TH: add Atthami Bucha and Ok Phansa support for

* TH: fixed double `raeknakhwan` oversight

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: `_ThaiLuniSolar` either returns date-type or None

* TH: `add_holiday` --> `_add_with_observed` for unified wording

* TH: `KJhellico`'s suggestions

Co-Authored-By: ~Jhellico <KJhellico@users.noreply.github.com>

* Fix merge issues.

* TH: applying `arkid15r` 's suggestions

- Simplified __init__ section for Thailand's, removed for _ThaiLuniSolar
- Simplified _ThaiLuniSolar holiday codes
- _ThaiLuniSolar's comment are now docstrings
- Move all Thailand's holiday references to above limitations' section
- Remove Thailand's duplicate date checks (with TODO comments instead)
- Thailand's In Line comments are also moved to each holiday's header for better readability

Co-Authored-By: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* TH: in-line single instance holidays

Co-Authored-By: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* TH: forgot to re-sort this, oof

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* TH: fixed duplicate var, other improvements

Co-Authored-By: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* TH: clean up comments

* TH: back to `@lru_cache()` again

* Simplify test classes setup.
Update documentation.

* Exclude tests from the MANIFEST.in.

* Add Marshall Islands (ISO-3666-1 code MH)

* Fix Northern Mariana Islands (ISO-3666-2 code US-MP)

* Adds ISO 3166-1 entries for countries that are also ISO 3166-2 subdivisions of the United States

* isort fix

* add TODO

* Lost some pieces on the way...

* MH additional testing for coverall

* Update holidays/countries/united_states.py

Thanks...no idea what's happening with snippets of code!

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* Add United States Minor Outlying Islands (ISO-3666-2 code US-UM) (#940)

* ISO 3166-1 for US subdivisions (#941)

* Add Marshall Islands (ISO-3666-1 code MH)

* Fix Northern Mariana Islands (ISO-3666-2 code US-MP)

* Adds ISO 3166-1 entries for countries that are also ISO 3166-2 subdivisions of the United States

* isort fix

* add TODO

* Lost some pieces on the way...

* MH additional testing for coverall

* Update holidays/countries/united_states.py

Thanks...no idea what's happening with snippets of code!

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

---------

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>
Co-authored-by: dr-prodigy <dr.prodigy.github@gmail.com>

* Add International Women's Day for DE-MV (#936)

* Add internationaler Frauentag for DE-MV

* Remove trailing whitespace

* Remove .gitpod.yml

* Add .gitpod.yml to .gitignore

* Add tests for Frauentag in DE-MV

* CHANGES sync

* Return `None` explicitly. (#935)

* CHANGES sync

* Rework i18n.

* Update pre-commit settings.

* Fix Thailand related changes coverage decrease.

* Fix naming and minor issues in .pot files generator.

* Update translations.

* Add final fixes.

* Add additional cases.

* TH: additional testcases for the rest of Thai Lunar Holidays

* Fix Ukraine tests

* Fix ordering.

* Add missing cases.

* Rename dev env setup target.

* Suppress warnings for tests.

* Poland:
- added historical holidays
- added Ukrainian translation
- refactored tests

* header fix

* Optimize observed holidays for Mozambique, Namibia, Zambia, Zimbabwe

* Added test for Ukrainian

* Update Albania observed holidays

* National Day for Truth and Reconciliation in British Columbia (Canada)

* Optimize observed holidays for Angola, Eswatini, Kazakhstan, Kenya, Malawi, Singapore, South Africa

* fix

Co-authored-by: PPsyrius <19505219+PPsyrius@users.noreply.github.com>

* Localize ascii incompatible countries.
Add en_US localizatin for:
  - Armenia
  - Belarus
  - Bulgaria
  - Canada
  - Cyprus
  - Ethiopia
  - Georgia
  - Greece
  - Japan
  - Russia
  - Serbia
Update po generation files script.
Update MANIFEST.in.
Update README.rst.
Fix packaging.

* Fix headers.

* fix

Co-authored-by: Arkadii Yakovets <ark@cho.red>

* Fix mo cleanup process.

* Fix compatibility issue.

* Fix .po files related issues.

* Add .mo files generator. Rework `TestCase` base class l10n handling.

* Update Makefile.

* Re-enable fallback translation.

* Fix minor test issues.

* Update PR template.

* Update CHANGES.

* Update version format.

* Update CHANGES

* Bump mypy version. (#970)

* Fix readthedocs.io build: (#973)

- Add .readthedocs.yaml.
  - Update .gitignore.
  - Update .pre-commit-config.yaml.
  - Update Makefile.
  - Update tox.ini.

* Update CHANGES.

* Update CHANGES

* Update .rst files.

---------

Co-authored-by: delaosa <delaosa@gmail.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>
Co-authored-by: ~Jhellico <jhellico@gmail.com>
Co-authored-by: PPsyrius <19505219+PPsyrius@users.noreply.github.com>
Co-authored-by: Mike Borsetti <mike@borsetti.com>
Co-authored-by: Mike Borsetti <26698111+mborsetti@users.noreply.github.com>
Co-authored-by: dr-prodigy <dr.prodigy.github@gmail.com>
Co-authored-by: Alexander Schulze <alexanderschulze@users.noreply.github.com>
  • Loading branch information
9 people authored Feb 23, 2023
1 parent 05defee commit a30688e
Show file tree
Hide file tree
Showing 323 changed files with 13,895 additions and 5,660 deletions.
48 changes: 48 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
Thanks for contributing to python-holidays!
-->

## Proposed change

<!--
Describe the big picture of your changes.
Don't forget to link your PR to an existing issue if any.
-->

Your PR description goes here.

## Type of change

<!--
Type of change you want to introduce. Please, check one (1) box only!
If your PR requires multiple boxes to be checked, most likely it needs to
be split into multiple PRs.
-->

- [ ] New country holidays support (thank you!)
- [ ] Supported country holidays update (calendar discrepancy fix, localization)
- [ ] Existing code/tests/processes improvement (best practice, refactoring, optimization)
- [ ] Dependency upgrade (version update)
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] Breaking change (a code change causing existing functionality to break)
- [ ] New feature (adds functionality to python-holidays in general)

## Checklist

<!--
Put an `x` in the boxes that apply. You can change them after PR is created.
-->

- [ ] I've followed the [contributing guidelines][contributing-guidelines]
- [ ] This PR is filed against `beta` branch of the repository
- [ ] This PR doesn't contain any merge conflicts
- [ ] The code style looks good (`make pre-commit`)
- [ ] I've added tests to verify that the new code works and all tests pass locally (`make test`)
- [ ] The related [documentation][docs] has been added/updated (check off the box for free if no updates is required)

<!--
Thanks again for your contribution!
-->

[contributing-guidelines]: https://github.com/dr-prodigy/python-holidays/blob/beta/CONTRIBUTING.rst
[docs]: https://github.com/dr-prodigy/python-holidays/tree/beta/docs/source
46 changes: 24 additions & 22 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Tests"
name: Tests
on: [push, pull_request, workflow_dispatch]

env:
Expand All @@ -9,38 +9,40 @@ jobs:
name: Run Quality Assurance
runs-on: ubuntu-latest
steps:
- name: Check out repo
- name: Check Out Repository
uses: actions/checkout@v3
- name: Set up Python
- name: Set Up Python
uses: actions/setup-python@v4.5.0
with:
python-version: '3.11'
- name: Run pre-commit
uses: pre-commit/action@v3.0.0

test:
name: "Test: python=${{ matrix.python-version }} on ${{ matrix.os }}"
name: 'Test: Python=${{ matrix.python-version }} on ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
needs: [pre-commit]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7"]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.5.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements_dev.txt
- name: Install dependencies
cache-dependency-path: requirements/dev.txt
- name: Install Dependencies
run: |
python -m pip install -U pip wheel 'coveralls>=3'
python -m pip install -U -r requirements_dev.txt
python -m pip install -U -r requirements/dev.txt
python -m pip install -e .
- name: Run tests
- name: Run Tests
run: |
pytest
make test
- name: Upload Coverage
run: coveralls --service=github
env:
Expand All @@ -54,32 +56,32 @@ jobs:
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install -U 'coveralls>=3'
coveralls --finish --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Finished
run: |
pip3 install -U 'coveralls>=3'
coveralls --finish --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [test]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
- name: Set Up Python
uses: actions/setup-python@v4.5.0
with:
python-version: "3.10"
- name: Install dependencies
python-version: '3.11'
- name: Install Dependencies
run: |
python -m pip install -U pip wheel
pip install -U .
- name: Build dist
- name: Build Distribution
run: |
python setup.py sdist bdist_wheel
- name: Publish package
- name: Publish Package
uses: pypa/gh-action-pypi-publish@v1.6.4
with:
user: __token__
Expand Down
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
build/
build/*
dist/
venv/
MANIFEST
.coverage
*.egg-info
*.mo
*.pot
*.pyc
*.DS_Store
coverage.xml
.tox
.venv
docs/_build
docs/source/_build
docs/build
holidays/locale/pot

# IDE Stuff
.idea
.vscode/
*.code-workspace
Pipfile
.gitpod.yml
25 changes: 21 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ repos:
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: fix-encoding-pragma
args: [--remove]
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace

- repo: https://github.com/python/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
exclude: ^(docs|scripts/l10n/msgfmt.py)
language_version: python3

- repo: https://github.com/pycqa/flake8
Expand All @@ -24,15 +26,19 @@ repos:
additional_dependencies:
- flake8-print
args: [--max-line-length=79]
exclude: ^(docs|scripts/l10n/msgfmt.py)

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
exclude: ^docs/
# holidays/countries/__init__.py is excluded due to a bug whereby
# black and isort don't agree and enter into an infinite fix loop.
# TODO remove this exclusion when isort and black play nice again.
exclude: ^(docs|holidays/countries/__init__.py|scripts/l10n/msgfmt.py)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.0.1
hooks:
- id: mypy
additional_dependencies: [types-all]
Expand All @@ -56,3 +62,14 @@ repos:
rev: v2.2.0
hooks:
- id: setup-cfg-fmt

- repo: local
hooks:
- id: tests
always_run: true
entry: make test
language: system
name: run tests
pass_filenames: false
stages:
- push
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Read the Docs configuration file.
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details.

version: 2

build:
os: ubuntu-22.04
tools:
python: '3.11'

python:
install:
- requirements: requirements/docs.txt

sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: true
51 changes: 51 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
Version 0.20
============

Released February 23, 2023

- Add localization support, #827 (@arkid15r, @bkthomps, @dragoon)
- Introduce `HolidayBase::_is_leap_year()`, #886 (@arkid15r)
- Introduce `HolidayBase::_is_monday` - `HolidayBase::_is_sunday` helper methods, #841 (@arkid15r)
- Refactor Burundi holidays, #925 (@KJhellico)
- Refactor Cuba holidays, #927 (@KJhellico)
- Refactor HolidayBase class and utils, #815 (@arkid15r)
- Refactor common.TestCase, #926 (@arkid15r)
- Refactor days offset calculation for recently added countries, #924 (@KJhellico)
- Refactor days offset calculation: replace `relativedelta` with `timedelta` (tests), #901 (@arkid15r)
- Refactor days offset calculation: replace `relativedelta` with `timedelta`, #900 (@arkid15r)
- Refactor implicit returns, #935 (@arkid15r)
- Add Panama holidays, #916 (@KJhellico)
- Localize ascii incompatible countries, #955 (@arkid15r)
- Change holiday name separator from ", " to "; ", #922 (@arkid15r)
- Fix Hong Kong, #928 (@KJhellico)
- Fix Islamic holidays calculation, #914 (@KJhellico)
- Fix Thailand related changes coverage decrease, #942 (@arkid15r, @PPsyrius)
- Fix Ukraine tests, #943 (@KJhellico)
- Fix readthedocs.io build, #973 (@arkid15r)
- Improve Thailand holidays, #929 (@PPsyrius, @arkid15r, @KJhellico)
- Optimize Botswana observed holidays, #932 (@KJhellico)
- Optimize Burundi observed holidays, #933 (@KJhellico)
- Optimize Montenegro: observed holidays, #908 (@KJhellico)
- Optimize Ukraine observed holidays, #934 (@KJhellico)
- Optimize observed holidays, part 1, #949 (@KJhellico)
- Optimize observed holidays, part 2, #952 (@KJhellico)
- Update Albania observed holidays, #950 (@KJhellico)
- Update Australia holidays: fix 2020 QLD holidays, #923 (@arkid15r)
- Update Bolivia holidays, #910 (@KJhellico)
- Update Bosnia and Herzegovina holidays, #909 (@KJhellico)
- Update Canada holidays (add National Day for Truth and Reconciliation in British Columbia), #951 (@KJhellico)
- Update Jamaica holidays, #913 (@KJhellico)
- Update PR template, #960 (@arkid15r)
- Update Poland holidays, add uk localization, #947 (@KJhellico)
- Update dev/test environments, #930 (@arkid15r)
- Upgrade dependency: change black version from 22.12.0 to 23.1.0, #921 (@arkid15r)
- Upgrade pre-commit config: mypy v1.0.1, #970 (@arkid15r)
- Add GitHub pull request template, #911 (@arkid15r)
- Add International Women's Day for DE-MV, #936 (@alexanderschulze)
- Add Marshall Islands (ISO-3666-1 code MH), #937 (@mborsetti)
- Add Northern Mariana Islands (ISO-3666-2 code US-MP), #939 (@mborsetti)
- Add United States Minor Outlying Islands (ISO-3666-2 code US-UM), #940 (@mborsetti)
- ISO 3166-1 for US subdivisions, #941 (@mborsetti, @dr-prodigy)
- Rename dev env setup target, #944 (@arkid15r)
- Suppress warnings for tests, #945 (@arkid15r)

Version 0.19
============

Expand Down
Loading

0 comments on commit a30688e

Please sign in to comment.