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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.266s · 27.6MB
glibcpy 3.10–3.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)}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'workalendar'
The 'workalendar' package is not installed in the Python environment.
fixpip install workalendar
ImportError: cannot import name 'France' from 'workalendar'
The import statement is incorrect; 'France' should be imported from 'workalendar.europe'.
fixfrom workalendar.europe import France
AttributeError: module 'workalendar' has no attribute 'europe'
Attempting to access the 'europe' submodule directly from 'workalendar' without proper import.
fixfrom 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.
fixEnsure 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.
fixProvide 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.