Tool to load UK bank holidays from GOV.UK
This library loads the official list of bank holidays in the United Kingdom as supplied by GOV.UK. GOV.UK tend to provide this list for only a year or two into the future.
Install using pip install govuk-bank-holidays. Sample usage:
from govuk_bank_holidays.bank_holidays import BankHolidays bank_holidays = BankHolidays() for bank_holiday in bank_holidays.get_holidays(): print(bank_holiday['title'], '>', bank_holiday['date']) print(bank_holidays.get_next_holiday()) # see govuk_bank_holidays/bank_holidays.py source file for more methods and arguments… # choose a different locale for holiday titles and notes bank_holidays = BankHolidays(locale='cy')
Bank holidays differ around the UK. The GOV.UK source currently lists these for 3 “divisions”:
- England and Wales
- Northern Ireland
… and many methods in this library take a division parameter (see constants defined on BankHolidays class).
NB: If no division is specified, only holidays common to all divisions are returned so some local bank holidays may not be listed. Therefore specifying a division is recommended.
While localisation is provided in English (the default with locale code ‘en’) and Welsh (locale code ‘cy’), please note that the Welsh version may contain errors.
Please report bugs and open pull requests on GitHub.
Update translation files using python setup.py makemessages, e.g. when updating the i18n module or when adding new languages. Compile them using python setup.py compilemessages; this is required before testing and distribution.
Use python setup.py compilemessages test to run all tests locally.
Distribute a new version by:
- updating the VERSION tuple in govuk_bank_holidays
- adding a note to the History
- creating a release on GitHub which triggers an upload to PYPI
Alternatively, run python setup.py compilemessages sdist bdist_wheel upload locally.
- The library does not differ from 0.7. This release is the first to use GitHub Actions to automatically publish to PYPI.
- Minor documentation update.
- Updated cached bank holidays file to include latest holidays published by GOV.UK. Added python 3.8 to testing matrix. Minor documentation update.
- Updated cached bank holidays file to include latest holidays published by GOV.UK.
- Updated cached bank holidays file to include latest holidays published by GOV.UK. Added python 3.7 to testing matrix. Documentation improved.
- Improved testing. Library unchanged.
- Updated cached bank holidays file to include latest holidays published by GOV.UK. Added option to force use of cached file. Added next work day calculation.
- Initial release.
Copyright (C) 2020 HM Government (Ministry of Justice Digital & Technology). See LICENSE.txt for further details.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size govuk_bank_holidays-0.8-py2.py3-none-any.whl (12.5 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size govuk-bank-holidays-0.8.tar.gz (11.9 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for govuk_bank_holidays-0.8-py2.py3-none-any.whl