This library provides a convenient way to load the official list of bank holidays in the United Kingdom directly from GOV.UK. Currently at version 0.19, it is actively maintained with frequent updates to include new holiday data as published by GOV.UK, alongside regular maintenance for Python version compatibility.
pip install govuk-bank-holidaysVerified import paths — ran on the pinned version, not inferred.
Initializes the `BankHolidays` class, demonstrating how to fetch all holidays for a specific division and retrieve the next upcoming holiday. It also shows how to use the cached holiday data offline.
Upgrade your Python environment to version 3.10 or newer. Check the library's release notes for the exact supported Python versions for your `govuk-bank-holidays` library version.
Always specify a `division` (e.g., `BankHolidays.ENGLAND_AND_WALES`, `BankHolidays.SCOTLAND`, `BankHolidays.NORTHERN_IRELAND`) when calling methods like `get_holidays()` or `get_next_holiday()` to ensure all relevant holidays for that region are included.
Be aware that very far-future holiday data might be missing or incomplete. For critical planning, always cross-reference with official GOV.UK sources.
Upgrade to version 0.17 or newer to benefit from the built-in download timeout and fallback to cached data.
Exercise caution when using the Welsh locale (`BankHolidays(locale='cy')`) and verify the accuracy of the holiday titles and notes if relied upon for official purposes.
Use the constants provided by the `BankHolidays` class for divisions (e.g., `BankHolidays.ENGLAND_AND_WALES`). If parsing raw JSON, ensure you understand its nested structure.
The correct import statement is `from govuk_bank_holidays.bank_holidays import BankHolidays`.
Always pass the appropriate division constant to the method, e.g., `bank_holidays.get_holidays(division=BankHolidays.SCOTLAND)` to get holidays specific to Scotland.
Ensure stable internet connectivity. Upgrade the library to version 0.17 or newer for robust timeout handling. Alternatively, initialize with `BankHolidays(use_cached_holidays=True)` to use the locally cached data, bypassing live download.
No dependency data recorded yet.