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 __version__ and ABCCalendarOperations, the base class to subclass for your own calendar; each provider is imported from its own module. Nothing under _internal/ is public; ABCCalendarOperations lives in the public purecalendars.abc_calendar_operations module and is re-exported from the root:

  • purecalendars.ABCCalendarOperations
  • 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.1.0

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.1.0
File Size Uploaded Provenance Actions
purecalendars-4.1.0.tar.gz 28.3 kB With provenance Details for purecalendars-4.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 65.4 kB

Release files / purecalendars-4.1.0.tar.gz

Download URL purecalendars-4.1.0.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5f253d880c497329d6ad399b497b6ae01ae80b14e520d769579575609d25663b
BLAKE2b-256 checksum
How to use checksums
2c62f20be08ba4c3018cdca08a2b36a76adb23e626e0df6a076eb8c053fb7a40
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 22, 2026.

Transparency log

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

Download URL purecalendars-4.1.0-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91979b4600d25e66bff87f0189e99be77dbd57c150b5a19ea8a968d83cff1021
BLAKE2b-256 checksum
How to use checksums
6af56c045d2381f2c6cb35c23f55f4c8ead43fdeae60a72a2e7d9d88734058f5
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 22, 2026.

Transparency log

Security for purecalendars 4.1.0

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.1.0.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 22, 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