Skip to main content

Japanese holiday for Python

Project description

Build Status PyPI version PyPI downloads GitHub release

holiday_jp-python

Japanese holiday for Python

install

pip install holiday-jp

dependencies

pip3 install -r requirements.txt

using dataset from https://github.com/holiday-jp/holiday_jp

test

python3 -m unittest holiday_jp.test

for dev

Build on linux with python 3.6

Build command:

python setup.py sdist

OR

Run ./build.sh build the package that will be available in the dist/ directory

alternative install

download the release and install this way: pip3 install holiday_jp-xxx.tar.gz

Usage

from holiday_jp import HolidayJp
if HolidayJp('1990-01-01').is_holiday:
  print('True')

work with date
import datetime
from holiday_jp import HolidayJp

if HolidayJp(datetime.date.today()).is_holiday:
  print('False')
else:
  print('True')

# Between return holidays between 2 dates in text
holidays = HolidayJp.between('2009-01-01', '2009-01-31')
new_year_day = holidays[0]
self.assertEqual(datetime.date(year=2009, month=1, day=1), new_year_day.date_obj)
self.assertEqual('元日', new_year_day.name)

# Or date object
holidays = HolidayJp.between(datetime.date(year=2008, month=12, day=23), datetime.date(year=2009, month=1, day=12))

For more usage check the unit test holiday_jp/test.py

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

holiday_jp-19.4.23.tar.gz (11.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page