Skip to main content

Global calendar system. Python package.

Project description

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.

Provider Import Holidays
DatesBRAnbima wwdates.br.anbima 🇧🇷 ANBIMA national holidays
DatesBRFebraban wwdates.br.febraban 🇧🇷 FEBRABAN bank holidays
DatesBRB3 wwdates.br.b3 🇧🇷 ANBIMA + B3 exchange non-trading days
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

📜 License

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

🔗 Useful Links

Project 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-0.1.0.tar.gz (61.1 kB view details)

Uploaded Source

Built Distribution

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

wwdates-0.1.0-py3-none-any.whl (82.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wwdates-0.1.0.tar.gz
  • Upload date:
  • Size: 61.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wwdates-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2694a0da1288e5342a4a03f28d8ebb05a64308831ce1dcc6182b1be6dda634c3
MD5 4448f58729bd293dddeb2ca4ff03f8cc
BLAKE2b-256 a864e38121482c709237eb03173f23ec1222ba7f4491d3baf0c69992216c5e57

See more details on using hashes here.

Provenance

The following attestation bundles were made for wwdates-0.1.0.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-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wwdates-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 82.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wwdates-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f8dc056f124f64757480d8dcd33000abccdb7ea2b9e77cbf3707b199dea1bbd
MD5 e62b980db433136101d1804d2d112fb8
BLAKE2b-256 3ac7437161efaeb0e6e93c9114d2b479a410c7f09605d411d37bbc53364c14fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for wwdates-0.1.0-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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page