Skip to main content

Python package for Canadian holidays

Project description

canada-holiday

example workflow

a Python package for retrieving Canadian holidays information for all provinces for any given year.

Installation

With pip:

pip install canada-holiday

With poetry:

poetry add canada-holiday

Usage

import datetime
import canada_holiday

on_holidays_2023 = canada_holiday.get_holidays("Ontario", 2023)
# prints "Getting holiday information of Ontario province..."
print(on_holidays_2023)
# [CanadaHoliday(New Year's Day, 2023-01-01, Sunday, all), CanadaHoliday(Family Day, 2023-02-20, Monday, Ontario), ...]

manitoba_holidays_2023_june = canada_holiday.get_holidays("MB", 2023, 2)
# prints "Getting holiday information of Manitoba province..."
print(manitoba_holidays_2023_june)
# [CanadaHoliday(Louis Riel Day, 2023-02-20, Monday, Manitoba)]
louis_riel_day = manitoba_holidays_2023_june[0]
print(louis_riel_day.name)
# Louis Riel Day
print(louis_riel_day.month)
# 2
print(louis_riel_day.day)
# 20
print(louis_riel_day.date)
# 2023-02-20
print(louis_riel_day.province)
# Manitoba
print(louis_riel_day.day_of_the_week)
# Monday

date = datetime.date(2023, 8, 7)
result = canada_holiday.is_holiday(date, "British Columbia")
# prints "2023-08-07 is a holiday, B.C. Day in British Columbia province(s) in Canada"
print(result)
# True
date = datetime.date(2023, 4, 5)
result = canada_holiday.is_holiday(date, "Nova Scotia")
# prints "2023-04-05 is not a holiday in Nova Scotia province."
print(result)
# False

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

canada_holiday-1.2.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

canada_holiday-1.2.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file canada_holiday-1.2.0.tar.gz.

File metadata

  • Download URL: canada_holiday-1.2.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.12 Linux/5.4.0-200-generic

File hashes

Hashes for canada_holiday-1.2.0.tar.gz
Algorithm Hash digest
SHA256 add12d65d3f76164d3e89c414510c7db91a5d684864f742f3d8026580cc4438b
MD5 23d1bd27bcf1e7e73bd62435a02b14bb
BLAKE2b-256 98245602ad6d3f50978a060b1456d5eaee7c29cb58d2b201e3e3592d29f2f053

See more details on using hashes here.

File details

Details for the file canada_holiday-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: canada_holiday-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.12 Linux/5.4.0-200-generic

File hashes

Hashes for canada_holiday-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d89631f3e9f3320d001d18d8a778c0928084df62571b1f945c6bcca81553e758
MD5 28572bd1c385a37e5bbfd56a163e694b
BLAKE2b-256 8c737d2097917c6561a58878423c1e96c5a95e93a55b3b66a46db09cf89918db

See more details on using hashes here.

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