Registry / serialization / workadays

workadays

JSON →
library2023.12.30pypypi✓ verified 85d ago

Workadays is a Python library designed for working with business days, calendar days, and 360-day basis (30/360) date calculations. It allows users to add business days to a given date, check if a specific date is a business day, and retrieve a list of holidays for various countries, states, and provinces. The library had its latest release on December 30, 2023, and generally follows an annual or semi-annual release cadence.

pip install workadays
INSTALL
IMPORT
SIG · WORKADAYS
W
workadays
serializationpythonv2023.12.30
Install
1.7s avg
Import
67ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.069s · 18.8MB
glibc
py 3.103.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}")
Debug
Known issues
gotchaBe careful not to confuse `workadays` (plural) with the `workday` (singular) PyPI package. They are different libraries with distinct functionalities. Always ensure you install `workadays`.
fix
Ensure your `pip install` command and `from ... import ...` statements use `workadays`.
affects: All
gotchaWhen calculating business days or checking holidays, remember to specify the `country` parameter (and optionally `state` or `province`) to ensure accurate results, as holiday calendars are region-specific. The default country might not match your expectation.
fix
Always pass the `country` argument (e.g., `country='BR'`) to functions like `networkdays`, `add_working_days`, and `is_holiday`.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'workday'
Attempting to import from the incorrect package name 'workday' instead of 'workadays'.
fix
Change 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.
fix
Use `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.

Agent activity
40 hits · last 30 days
node
33
OpenAI (training)
1
Resources
workadays — pip install workadays · libregistry