Skip to main content

wwdates wwdates

Project Status: Active Python Version Linting Type-checked: mypy Test Coverage License Open Issues Contributions Welcome

Global calendar system. Python package.

wwdates fetches official holiday calendars for Brazil (ANBIMA, FEBRABAN, B3) and the United States (Nasdaq, 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. Fetched calendars are cached locally so repeated calls stay fast and offline-friendly.

📖 Full documentation: https://guilhermegor.github.io/wwdates/

✨ Key Features

🗓️ Holiday providers

One class per calendar source; all share the same date-operations surface — they differ only in which holidays they load.

Most sources come in two flavours: an offline class (the default — no network, no cache) and a *Web class that reads the publisher's live page.

Provider Import Holidays
DatesBRAnbima wwdates.br.anbima 🇧🇷 ANBIMA national holidays (offline, recommended)
DatesBRAnbimaWeb wwdates.br.anbima_web 🇧🇷 The same set, fetched live from ANBIMA
DatesBRFebraban wwdates.br.febraban 🇧🇷 FEBRABAN bank holidays (offline, recommended)
DatesBRFebrabanWeb wwdates.br.febraban_web 🇧🇷 The same set, fetched live from FEBRABAN
DatesBRB3 wwdates.br.b3 🇧🇷 National + B3 exchange non-trading days (offline, recommended)
DatesBRB3Web wwdates.br.b3_web 🇧🇷 Scraped from B3's trading calendar (2021–2026 only)
DatesUSNasdaq wwdates.us.nasdaq 🇺🇸 Nasdaq market closures
DatesUSFederalHolidays wwdates.us.federal_holidays 🇺🇸 US federal holidays (offline, recommended)
DatesUSFederalHolidaysWeb wwdates.us.federal_holidays_web 🇺🇸 US federal holidays via live scrape

⚙️ Shared calendar operations

Every provider inherits the full surface: working-day predicates (is_working_day, is_holiday, is_weekend), business-day arithmetic (add_working_days, nearest_working_day, get_nth_weekday_month), ranges & deltas (working_days_range, delta_working_days, delta_working_hours), timezone/timestamp conversions, and locale-aware formatting. See the API Reference for the complete list.

🚀 Getting Started

Prerequisites

  • Python 3.10+
  • Poetry (recommended)

Installation

pip install wwdates

Or with Poetry:

poetry add wwdates

Everything works offline after install — no browser needed. The recommended DatesUSFederalHolidays computes federal holidays locally.

Optional: the browser-scrape provider ([web] extra)

Only the DatesUSFederalHolidaysWeb provider needs a browser — it scrapes federalholidays.net with Playwright, which is not installed by the base package. It is vital only if you specifically want that provider's live-scraped dates; otherwise skip this entirely and use the offline DatesUSFederalHolidays.

To enable it, install the optional web extra (note the brackets — quote them so the shell does not glob), then fetch the browser binary:

pip install "wwdates[web]"   # adds Playwright
playwright install chromium  # one-time browser download (pip cannot do this step)

Without both steps, constructing/using DatesUSFederalHolidaysWeb raises a clear ImportError telling you to run them.

Quick start

from datetime import date

from wwdates.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), ...]

DatesBRB3 here is just an example — the same methods work on every provider; only the loaded holiday set differs. More recipes in the Examples guide.

📚 Documentation

🛠️ Development

git clone https://github.com/guilhermegor/wwdates.git
cd wwdates
make init                  # or: bash tasks.sh init  (venv + deps + pre-commit hooks)
make unit_tests            # run the test suite
make install_dist_locally  # build the wheel and smoke-import it

See Contributing for the full branch/PR workflow and CI gate.

👨‍💻 Authors

Guilherme Rodrigues
GitHub
LinkedIn

🔗 Useful Links

🤝 Contributing

Issues and PRs are welcome. Please read CONTRIBUTING.md first for dev setup, tests, the branch/PR workflow, and the CI gate.

📜 License

This project is licensed under the MIT License — see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wwdates-1.0.1.tar.gz (66.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wwdates-1.0.1-py3-none-any.whl (91.5 kB view details)

Uploaded Python 3

File details

Details for the file wwdates-1.0.1.tar.gz.

File metadata

  • Download URL: wwdates-1.0.1.tar.gz
  • Upload date:
  • Size: 66.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for wwdates-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d4142510e7732f594390b0ac8acbc90dd216df48ff51c07d7410eb4e0dc10762
MD5 58a19ff82b7786da8d197f11a7d11b35
BLAKE2b-256 1a4bea9fc4f7fa683227648d1799554e3dbaa91fd295c0c5eeb848aa998c9e1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wwdates-1.0.1.tar.gz:

Publisher: release_pypi.yaml on guilhermegor/wwdates

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wwdates-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: wwdates-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 91.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for wwdates-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d84317319e9bdc76d11b56f1a0201057a29c9d9116becd6fdadc8a8b886c325
MD5 c63411503af3020dcf1d70334e8fa20e
BLAKE2b-256 38611c513e4fa611206479d341a51c8ed7962a1e4f7e5d5de628c4c78471172b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wwdates-1.0.1-py3-none-any.whl:

Publisher: release_pypi.yaml on guilhermegor/wwdates

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.0

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page