Skip to main content

purecalendars

purecalendars

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

Overview

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, no browser.

The live fetchers (*Web classes, DatesUSNasdaq) moved to the separate opendata-calendars package, which returns purecalendars calendars.

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 purecalendars.br.anbima ANBIMA national holidays
DatesBRFebraban purecalendars.br.febraban FEBRABAN bank holidays
DatesBRB3 purecalendars.br.b3 National + B3 exchange non-trading days
DatesUSFederalHolidays purecalendars.us.federal_holidays US federal holidays (statutory + observed)

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.

Documentation

The full documentation is published at https://guilhermegor.github.io/purecalendars/:

Getting Started

Python 3.11+ is the only prerequisite; Poetry is recommended.

Install

pip install purecalendars

Or with Poetry:

poetry add purecalendars

Everything works offline after install — no network, no browser.

Usage

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

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.

Project Structure

purecalendars/
├── .github/              workflows, CODEOWNERS, PR template
├── .specs/               work ledgers and specs
├── assets/               logo
├── bin/                  gate scripts and helpers
├── docs/                 published documentation (mkdocs)
├── src/purecalendars/
│   ├── br/               ANBIMA, FEBRABAN and B3 calendars
│   ├── us/               US federal holidays
│   └── _internal/        private: vendored helpers
├── tests/
│   ├── unit/
│   └── integration/
├── pyproject.toml
└── poe_tasks.toml        task runner entry points

Development

git clone https://github.com/guilhermegor/purecalendars.git
cd purecalendars
bash bin/venv.sh                            # create the venv and install dependencies
bash bin/poe_exec.sh init                   # seed .env, install pre-commit hooks
bash bin/poe_exec.sh unit_tests             # run the test suite
bash bin/poe_exec.sh install_dist_locally   # build the wheel and smoke-import it

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

Public API

The package root exports only __version__; each provider is imported from its own module, and everything under _internal/ is private:

  • purecalendars.br.anbima.DatesBRAnbima
  • purecalendars.br.febraban.DatesBRFebraban
  • purecalendars.br.b3.DatesBRB3
  • purecalendars.us.federal_holidays.DatesUSFederalHolidays

Publishing

Releases are cut by dispatching the release workflows under .github/workflows/ with a version input, and go out through PyPI trusted publishing (OIDC); the vX.Y.Z tag records the release.

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.

Authors


Generated from the lib-minimal template via BlueprintX.

Metadata

Release files for purecalendars 4.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purecalendars 4.0.1
File Size Uploaded Provenance Actions
purecalendars-4.0.1.tar.gz 27.4 kB With provenance Details for purecalendars-4.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for purecalendars 4.0.1
File Interpreter ABI Platform Actions
purecalendars-4.0.1-py3-none-any.whl Python 3 none any Details for purecalendars-4.0.1-py3-none-any.whl

Total release size: 63.2 kB

Release files / purecalendars-4.0.1.tar.gz

Download URL purecalendars-4.0.1.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6736e5c6e9c452982f75c9d9d4555424ba8456a8481d34e12559fe70d9c1da3f
BLAKE2b-256 checksum
How to use checksums
88d2c635a9a870cd059807eeb370d1f6e09b34b4e8355addff81df1a64502ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / purecalendars-4.0.1-py3-none-any.whl

Download URL purecalendars-4.0.1-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf13184f6618092f2b4efc0590b266d0eff15713d479e033285d87fc29e736c2
BLAKE2b-256 checksum
How to use checksums
49ec8aa804c24793784488bc723173e203c0daba8592adb672632b52ee9649da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for purecalendars 4.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for purecalendars-4.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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