Registry / data / workalendar

workalendar

JSON →
library17.0.0pypypi✓ verified 23d ago

Workalendar is a Python library providing a comprehensive toolkit for calculating holidays and working days across various countries and regions worldwide. It's currently at version 17.0.0 and sees regular releases, often driven by updates to national holidays and the addition of new calendars.

pip install workalendar
INSTALL
IMPORT
SIG · WORKALENDAR
W
workalendar
datapythonv17.0.0
Install
3.7s avg
Import
260ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v17.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.266s · 27.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.7s · import 0.254s · 28MB
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

France
from workalendar.europe import France
from workalendar.europe import FranceCalendar
Older versions of workalendar (e.g., pre-1.0) often used class names ending in `Calendar` (e.g., `FranceCalendar`). The modern and recommended pattern is to import the country name directly (e.g., `France`).
date
from datetime import date
The library's functions typically expect standard Python `datetime.date` or `datetime.datetime` objects for date inputs.

This quickstart demonstrates how to instantiate a country-specific calendar, retrieve a list of holidays for a particular year, and check whether a given date is considered a working day.

from datetime import date from workalendar.europe import France # Initialize a calendar for a specific country cal = France() year = 2024 # Get all holidays for a given year holidays_2024 = cal.holidays(year) print(f"Holidays in France for {year}:") for hol_date, hol_name in holidays_2024: print(f" {hol_date}: {hol_name}") # Check if a specific day is a working day test_date_christmas = date(2024, 12, 25) # Christmas Day test_date_weekday = date(2024, 1, 10) # A Wednesday print(f"\nIs {test_date_christmas} a working day in France? {cal.is_working_day(test_date_christmas)}") print(f"Is {test_date_weekday} a working day in France? {cal.is_working_day(test_date_weekday)}")
Debug
Known issues
breakingCompatibility with Python 3.6 was removed in version 17.0.0. Users running Python 3.6 or older must upgrade their Python environment to version 3.7 or newer to use workalendar 17.0.0 and subsequent releases.
fix
Upgrade your Python installation to version 3.7 or newer.
affects: >=17.0.0
breakingThe `skyfield` dependency was transitioned from a core requirement to an optional extra (`workalendar[astronomy]`) in version 16.0.0. Additionally, `pyCalverter` was replaced by `convertdate`. Users relying on astronomical calculations (e.g., for certain Asian calendars) should install the library with the astronomy extra: `pip install workalendar[astronomy]`. It is also recommended to uninstall any previously installed `skyfield` or `skyfield-data` packages to benefit from workalendar's pre-computed astronomical data and performance improvements.
fix
If astronomical calculations are needed, install with `pip install workalendar[astronomy]`. Consider `pip uninstall skyfield skyfield-data` if these were previously installed as core dependencies.
affects: >=16.0.0
gotchaSome calendars, particularly the Islamic calendar, may not perfectly align with officially declared holidays due to variations in religious authority decisions. Workalendar's computations are based on algorithms, which may sometimes differ from actual observations.
fix
For applications requiring absolute precision (e.g., financial systems), always cross-reference computed holidays with official local declarations, especially for culturally sensitive calendars.
affects: all
gotchaThe library strictly expects standard Python `datetime.date` or `datetime.datetime` objects (or their subclasses from the standard library) as inputs for its core functions. Attempting to pass date-like objects from external, non-standard libraries will raise an `UnsupportedDateType` error.
fix
Ensure all date and datetime objects passed to `workalendar` functions are instances of `datetime.date` or `datetime.datetime`.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'workalendar'
The 'workalendar' package is not installed in the Python environment.
fix
pip install workalendar
ImportError: cannot import name 'France' from 'workalendar'
The import statement is incorrect; 'France' should be imported from 'workalendar.europe'.
fix
from workalendar.europe import France
AttributeError: module 'workalendar' has no attribute 'europe'
Attempting to access the 'europe' submodule directly from 'workalendar' without proper import.
fix
from workalendar.europe import France
TypeError: 'NoneType' object is not callable
Calling a method on a 'None' object, possibly due to incorrect initialization of a calendar class.
fix
Ensure the calendar class is correctly instantiated before calling its methods.
ValueError: year must be a positive integer
Passing an invalid year (e.g., negative or zero) to a method that requires a positive integer.
fix
Provide a valid positive integer for the year parameter.
Upgrade
Version history
17.0.0latest on PyPI · released Jan 1, 2023
Audit
Dependencies
convertdaterequiredCore dependency for date conversions, replaced pyCalverter in v16.0.0.
skyfieldoptionalOptional dependency for astronomy-based calculations (e.g., lunar holidays), moved to an extra ('astronomy') in v16.0.0. If previously installed as a core dependency, it should be uninstalled to benefit from performance gains from pre-computed files.
Agent activity
41 hits · last 30 days
node
34
OpenAI (training)
1
Resources
workalendar — pip install workalendar · libregistry