Skip to main content

A simple Python helper class to determine Italian holidays with the possibility to set custom holidays.

Project description

ItalianHolidays

A simple Python helper class to determine Italian holidays with the possibility to set custom holidays. Easter holidays' calculation will work for dates between 1900-2199.

PyPI status PyPI pyversions PyPI version shields.io PyPI - Downloads GitHub license

Install

Using Pip

pip install italian-holidays

Usage

from italian_holidays import italian_holidays
from datetime import datetime

custom_holidays = ["01-03", "01-05"] # date format: month-day | in this example: 3 January, 5 January

# But accepts also array of datetime object
custom_holidays = [datetime(2021, 1, 3), datetime(2021, 1, 5)]

holidays = italian_holidays(custom_holidays) # or simply italian_holidays() if you have no custom holidays to set

# Passing string
is_holiday = holidays.is_holiday("2024-01-03")
print(is_holiday) # True

# Passing datetime object
day = datetime(2031, 4, 14)
is_holiday = holidays.is_holiday(day)
print(is_holiday) # True

# Getting holiday's name (return None if date is not an italian holiday, return 'Custom holiday' if is one of the given dates)
holiday_name = holidays.holiday_name("2020-11-01")
print(holiday_name) # All Saints' Day

Licence

Source code can be found on github, licenced under MIT.

Developed by Giuseppe Bruno

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

italian_holidays-0.0.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

italian_holidays-0.0.7-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file italian_holidays-0.0.7.tar.gz.

File metadata

  • Download URL: italian_holidays-0.0.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for italian_holidays-0.0.7.tar.gz
Algorithm Hash digest
SHA256 08a4b8701df882e17fc54a7544e2cc513f95e8e32ef5b82fde3d6adc0e23c308
MD5 dc79d85df334cd345614eabc5b8a9d42
BLAKE2b-256 b7b55f34a3f8ab149eb6ef0033a28194a459735b9d5dfe12d14d9b695e38a577

See more details on using hashes here.

File details

Details for the file italian_holidays-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for italian_holidays-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 51bcf358fa0d4bd1a5b5604ceb709f179eeaf09ce368e2315f8ae4ed3f23fc2d
MD5 be86f6c481b7230b883dcce7ab6b64ba
BLAKE2b-256 31e07b297cb13951ca6365b3da1c4772c7e47d2fbeaa6286aa9ea8704c13cc3c

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