Documentation
KTCalendars is a library providing utility classes for country-specific holiday-aware calendars and dates.
It builds on the holidays package and provides:
KTDay— a rich day object with date parsing, arithmetic, comparisons and holiday/work-day checks; every day is bound to aKTCalendar, and derived days (arithmetic results, copies) keep it.KTCalendar— acalendar.Calendarsubclass bound to a country calendar, with configurable weekend days and work-day and week iteration helpers.AbstractConfiguration— a pluggable configuration class, selected via theKTCALENDAR_CONFIGenvironment variable, centralising holiday overrides (e.g. company closures) and the default country calendar code.KTDateRange— a calendar-aware psycopgDateRangesubclass with inclusivity-awareKTDayiteration and rich comparison, containment and intersection helpers (requires thepsycopgextra).
Head over to Getting started for configuration and usage, or browse the examples.
Dependencies
- Python 3.10 or later
Installation
- Install ktcalendars using your package manager of choice, e.g. Pip:
bash pip install ktcalendars - To use
KTDateRange, install thepsycopgextra:bash pip install ktcalendars[psycopg]
Bug reports and requests for enhancements
Please open an issue on the project's issue tracker on GitHub.
Contributing to the project
See the contribution guide.
Licensing
Licensed under the Apache License 2.0.