Skip to main content

Tool to load UK bank holidays from GOV.UK

Project description

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.

Usage

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

  • Scotland

  • 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.

Development

https://travis-ci.org/ministryofjustice/govuk-bank-holidays.svg?branch=master https://github.com/ministryofjustice/govuk-bank-holidays/workflows/Run%20tests/badge.svg?branch=master

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.

History

0.8

The library does not differ from 0.7. This release is the first to use GitHub Actions to automatically publish to PYPI.

0.7

Minor documentation update.

0.6

Updated cached bank holidays file to include latest holidays published by GOV.UK. Added python 3.8 to testing matrix. Minor documentation update.

0.5

Updated cached bank holidays file to include latest holidays published by GOV.UK.

0.4

Updated cached bank holidays file to include latest holidays published by GOV.UK. Added python 3.7 to testing matrix. Documentation improved.

0.3

Improved testing. Library unchanged.

0.2

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.

0.1

Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

govuk-bank-holidays-0.8.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

govuk_bank_holidays-0.8-py2.py3-none-any.whl (12.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file govuk-bank-holidays-0.8.tar.gz.

File metadata

  • Download URL: govuk-bank-holidays-0.8.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for govuk-bank-holidays-0.8.tar.gz
Algorithm Hash digest
SHA256 6d0cc8d60f3ffa771fe6b7002dbc6f9900419bd000873d101d315726fb7789d3
MD5 866ba8da3ab2eb7c3512890672519261
BLAKE2b-256 811a05cda07eed487d9faa11317ddbbdd65c2d4fc980b300e1df75e4e222634d

See more details on using hashes here.

File details

Details for the file govuk_bank_holidays-0.8-py2.py3-none-any.whl.

File metadata

  • Download URL: govuk_bank_holidays-0.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for govuk_bank_holidays-0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 65f7fe6e7c8cfbb384e1f5390461670ba5307a8e4def96d9e0aa73c5f897e573
MD5 37426557f05616f4db2b3b3f26fe4ad2
BLAKE2b-256 c55a5995ef8875edc781e5aadaf92992f6af8e9f87aac7a0e770b3aa94ee227b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page