Package: govuk-bank-holidays
This library loads the official list of bank holidays in the United Kingdom as supplied byGOV.UK.
GOV.UK tend to provide this list for only a year or two into the future.A cached backup list of known bank holidays is stored in this package though it is not updated often.
GOV.UK no longer provide bank holidays for some of the older years still part of this backup list.UsageInstall usingpip installgovuk-bank-holidays. Sample usage:fromgovuk_bank_holidays.bank_holidaysimportBankHolidaysbank_holidays=BankHolidays()forbank_holidayinbank_holidays.get_holidays():print(bank_holiday['title'],'is on',bank_holiday['date'])print(bank_holidays.get_next_holiday())# see govuk_bank_holidays/bank_holidays.py source file for more methods and argument details…# choose a different locale for holiday titles and notesbank_holidays=BankHolidays(locale='cy')# use cached holidays if internet connection is not desiredbank_holidays=BankHolidays(use_cached_holidays=True)Bank holidays differ around the UK. The GOV.UK source currently lists these for 3 “divisions”:England and WalesScotlandNorthern Ireland… and many methods in this library take adivisionparameter (see constants defined onBankHolidaysclass).NB: If no division is specified, only holidays common toalldivisions 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.DevelopmentPlease report bugs and open pull requests onGitHub.To work on changes to this library, it’s recommended to install it in editable mode into a virtual environment,
i.e.pip install--editable.Update cached bank holidays from GOV.UK usingpythonscripts/update-cache.py.Update translation files usingpython scripts/messages.py update, e.g. when updating the i18n module or when adding new languages.
Compile them usingpython scripts/messages.py compile; this isrequiredbefore testing and distribution.
Updating and compiling translation files requires the gettext system package to be installed.Usepython-mteststo run all tests locally.
Alternatively, you can usetoxif you have multiple python versions.[Only for GitHub team members] Distribute a new version toPyPIby:updating theVERSIONtuple ingovuk_bank_holidays/__init__.pyadding a note to theHistorypublishing a release on GitHub which triggers an upload to PyPI;
alternatively, runpython scripts/messages.py compile; python-mbuild; twine upload dist/*locallyHistory0.14Migrated test, build and release processes away from deprecated setuptools commands.
Translation files are updated and compiled through scripts which are not included in distribution.
TheBankHolidaysclass has a newALL_DIVISIONSconstant.0.13The library does not differ from 0.12.0.12Removed support for python versions older than 3.7.
Updated cached bank holidays file to include latest holidays published by GOV.UK.
Moved code style linting from unit test to github action.
Added setup.py command to update cached bank holidays from GOV.UK.0.11Updated cached bank holidays file to include latest holidays published by GOV.UK.
Added python 3.10 to testing matrix.0.10Added methods to generate series of holidays and work days before/after starting from a given date.0.9Added methods to find previous bank holidays / work days, mirroring the existing methods.
Removed support for python versions older than 3.6.
Added python 3.9 to testing matrix.0.8The library does not differ from 0.7.
This release is the first to use GitHub Actions to automatically publish to PyPI.0.7Minor documentation update.0.6Updated cached bank holidays file to include latest holidays published by GOV.UK.
Added python 3.8 to testing matrix.
Minor documentation update.0.5Updated cached bank holidays file to include latest holidays published by GOV.UK.0.4Updated cached bank holidays file to include latest holidays published by GOV.UK.
Added python 3.7 to testing matrix.
Documentation improved.0.3Improved testing.
Library unchanged.0.2Updated 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.0.1Initial release.CopyrightCopyright (C) 2023 HM Government (Ministry of Justice Digital & Technology).
See LICENSE.txt for further details.