Install & Compatibility
Where this runs
tested against v2023.12.30 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.069s · 18.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.7s · import 0.065s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
workdays
✓ from workadays import workdays
✗ import workadays
The primary functionality is exposed via the 'workdays' object, not the top-level package name.
workdays
✓ from workadays import workdays as wd
✗ from workday import workdays
Common typo: 'workadayS' (plural) is the correct package name, not 'workday' (singular). The latter is a different, unrelated library.
This quickstart demonstrates how to calculate network days, add working days, and check for holidays using the `workadays` library. It emphasizes the importance of specifying the country for accurate holiday calculations.
import datetime as dt
from workadays import workdays as wd
# Example: Calculate the number of business days between two dates in Brazil
dt_inicio = dt.date(2022, 9, 20)
dt_atual = dt.date(2022, 12, 12)
# You can also pass a list of custom holidays if needed
# holidays = [dt.date(2022, 10, 12), dt.date(2022, 11, 2)]
# n = wd.networkdays(dt_inicio, dt_atual, country='BR', holidays=holidays)
n = wd.networkdays(dt_inicio, dt_atual, country='BR')
print(f"Number of business days between {dt_inicio} and {dt_atual} in Brazil: {n}")
# Example: Add 5 business days to a date
start_date = dt.date(2024, 4, 15)
future_date = wd.add_working_days(start_date, 5, country='US')
print(f"5 business days after {start_date} in the US is: {future_date}")
# Example: Check if a date is a holiday
is_holiday = wd.is_holiday(dt.date(2024, 12, 25), country='US')
print(f"Is December 25, 2024 a holiday in the US? {is_holiday}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'workday'
Attempting to import from the incorrect package name 'workday' instead of 'workadays'.
fixChange your import statement from `from workday import ...` to `from workadays import ...`.
AttributeError: module 'workadays' has no attribute 'networkdays'
You likely used `import workadays` and then tried to call methods directly on the `workadays` module. The core functions are typically exposed through the `workdays` object within the package.
fixUse `from workadays import workdays` (or `from workadays import workdays as wd`) and then call methods like `workdays.networkdays(...)` or `wd.networkdays(...)`.
Upgrade
Version history
2023.12.30latest on PyPI · released Dec 30, 2023
Audit
Dependencies
No dependency data recorded yet.