purecalendars
¶
Holiday calendars and business-day arithmetic for Brazilian and US markets, computed offline.
purecalendars ships official holiday calendars for Brazil (ANBIMA, FEBRABAN, B3) and the United
States (Federal Holidays), then layers a rich set of working-day / date helpers on top
β is_working_day, add_working_days, working_days_range, delta_working_days,
timezone-aware conversions, and more. Every calendar is computed locally: no network, no cache.
Live fetchers moved
The live fetchers (*Web classes, DatesUSNasdaq) moved to the separate opendata-calendars package, which returns purecalendars calendars.
Contents¶
| Section | Description |
|---|---|
| Usage | Installation, choosing a provider, and basic examples |
| Examples | Task-oriented recipes (settlement dates, expiry, cross-market) |
| API Reference | Public providers and every shared calendar operation |
| FAQ | Common questions and troubleshooting |
| Contributing | Dev setup, testing, wheel build, PR workflow, releasing |
| Changelog | Per-version release history |
Quick start¶
from datetime import date
from purecalendars.br.b3 import DatesBRB3
cls_cal = DatesBRB3()
cls_cal.is_working_day(date(2024, 12, 25)) # False β Christmas
cls_cal.add_working_days(date(2024, 12, 24), 3) # skips holidays + weekends
cls_cal.holidays() # [(name, date), ...]
Everything works offline after install β no network, no browser.
Providers at a glance¶
| Country | Import | Source |
|---|---|---|
| π§π· Brazil | from purecalendars.br.anbima import DatesBRAnbima |
ANBIMA national holidays (offline, recommended) |
| π§π· Brazil | from purecalendars.br.febraban import DatesBRFebraban |
FEBRABAN bank holidays (offline, recommended) |
| π§π· Brazil | from purecalendars.br.b3 import DatesBRB3 |
National + B3 exchange extras (offline, recommended) |
| πΊπΈ USA | from purecalendars.us.federal_holidays import DatesUSFederalHolidays |
US federal holidays (offline, recommended) |
Generated from the lib-minimal template via BlueprintX.