Skip to main content

python-shukujitsu

Python Japanese holidays library based on static data published by Cabinet Office, Government of Japan

PyPI License        PyPI Downloads      PyPI Version        PyPI Python Versions

flake8 and pytest   Publish to PyPI     Publish to DockerHub RPM and DEB         CodeQL

Important notices

  • This python-shukujitsu package covers only holidays in Japan from 1955 to 2025; will expand to holidays in 2026 in February 2025.
  • This python-shukujitsu package has ZERO relation to the Government of Japan - NEVER EVER assume any authorization as this is just a personal project.
  • The signature key 8A124CD64688ABCC was expired Mon Nov 21 11:31:15 2022 UTC; please file an issue if you hit troubles around DEB/RPM packages due to the expiry.

Installation

pip3 install python-shukujitsu

Usage

Play the dict-like object.

import shukujitsu

jp_holidays = shukujitsu.Japan()
# or:
# jp_holidays = shukujitsu.JP()
# or:
# jp_holidays = shukujitsu.CountryHoliday('JP')

from datetime import date

date(2020, 7, 24) in jp_holidays  # True
date(2019, 7, 24) in jp_holidays  # False

# The dict-like object also accepts misc. date(time)-like strings
# and int/float representing a Unix timestamp
'2014-01-01' in jp_holidays  # True
'1/1/2014' in jp_holidays    # True
1388597445 in jp_holidays    # True

jp_holidays.get('2014-01-01')  # "元日"

jp_holidays['2014-01-01': '2014-01-03']  # [date(2014, 1, 1)]

Command-Line interface

shukujitsu command is bundled.

$ shukujitsu --help  # or python3 -m shukujitsu --help
usage: shukujitsu [-h] [-i] [-n] [-V] [DATE ...]

Select Japanese holidays from 1955 to 2024

positional arguments:
  DATE                date to be examined

options:
  -h, --help          show this help message and exit
  -i, --invert-match  select non-holidays
  -n, --holiday-name  output holiday name instead
  -V, --version       display version information and exit

With no DATE, read standard input. Exit status is 0 if any date is selected, 1 otherwise.

Pass any dates through command-line arguments or STDIN.

$ # With logical operators
$ shukujitsu 1/1/2020 && echo Holiday found || echo Holiday not found
1/1/2020
Holiday found

$ # Select holidays
$ cat <<EOF | shukujitsu > holidays.txt
> 2020-05-02
> 2020-05-03
> 2020-05-04
> 2020-05-05
> 2020-05-06
> 2020-05-07
> EOF

$ # Select holidays
$ shukujitsu 2020/7/22 2020/7/23 2020/7/24
2020/7/23
2020/7/24

$ # Output each holiday name
$ shukujitsu -n 2020/7/22 2020/7/23 2020/7/24
海の日
スポーツの日

$ # Select non-holidays
$ shukujitsu -i 2020/7/22 2020/7/23 2020/7/24
2020/7/22

Docker image

Docker Pulls Image Size

$ docker run -it sakuraiyouhei/shukujitsu --help

yum repository

$ sudo yum install -y curl
$ curl -fsSL https://sakurai-youhei.github.io/python-shukujitsu/rpm/python-shukujitsu.repo | sudo tee /etc/yum.repos.d/python-shukujitsu.repo
$ sudo yum install -y python-shukujitsu
$ shukujitsu --help

Note: There is one known issue in the RPM package as of 2023-02-04; https://github.com/sakurai-youhei/python-shukujitsu/issues/25

apt repository

$ sudo apt install -y curl gpg
$ curl -fsSL https://sakurai-youhei.github.io/python-shukujitsu/gpg | sudo apt-key add -
$ curl -fsSL https://sakurai-youhei.github.io/python-shukujitsu/deb/python-shukujitsu.list | sudo tee /etc/apt/sources.list.d/python-shukujitsu.list
$ sudo apt update
$ sudo apt install -y python-shukujitsu
$ shukujitsu --help

Source data

This python-shukujitsu package bundles the following source data, which is distributed by the Government of Japan under the CC BY compatible conditions according to 内閣府ホームページ利用規約.

Release files for python-shukujitsu 2024.7.17.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-shukujitsu 2024.7.17.post1
File Size Uploaded
python_shukujitsu-2024.7.17.post1.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-shukujitsu 2024.7.17.post1
File Interpreter ABI Platform
python_shukujitsu-2024.7.17.post1-py3-none-any.whl Python 3 none any Details

Total release size:61.8 kB

Release files / python_shukujitsu-2024.7.17.post1.tar.gz

Download URL python_shukujitsu-2024.7.17.post1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f79d8191d6b1f2fcad202441c31822ffe941fd47a035f8ae97e9f52e156315e8
BLAKE2b-256 checksum
How to use checksums
dc74b8a1b939e510a6012ebfc182feeeff246ec5f927499107de237c45e063ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / python_shukujitsu-2024.7.17.post1-py3-none-any.whl

Download URL python_shukujitsu-2024.7.17.post1-py3-none-any.whl
Size 48.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c452cf1a75dac30a94829310e9f3e73f2c0d1479b2e8de31e044235a0eaca78
BLAKE2b-256 checksum
How to use checksums
70954fa38f6b6a5e0606ec263839f5d68d355cc707647719fe30b24bc141a84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

2024.7.17.post1 This release

2 release files

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