# python-shukujitsu
Python Japanese holidays library based on static data published by Cabinet Office, Government of Japan
[](https://pypi.org/project/python-shukujitsu/)
[](https://pypi.org/project/python-shukujitsu/)
[](https://pypi.org/project/python-shukujitsu/)
[](https://pypi.org/project/python-shukujitsu/)
[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22flake8+and+pytest%22)
[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22Publish+to+PyPI%22)
[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22Publish+to+DockerHub%22)
[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22RPM+and+DEB%22)
[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3ACodeQL)
## Important notices
- This [python-shukujitsu](https://github.com/sakurai-youhei/python-shukujitsu) package covers only holidays in Japan from **1955 to 2024**; will expand to holidays in 2025 in February 2024.
- This [python-shukujitsu](https://github.com/sakurai-youhei/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.
```python
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.
```console
$ 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.
```console
$ # 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
[](https://hub.docker.com/r/sakuraiyouhei/shukujitsu/)
[](https://hub.docker.com/r/sakuraiyouhei/shukujitsu/)
```console
$ docker run -it sakuraiyouhei/shukujitsu --help
```
## yum repository
```console
$ 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
```console
$ 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](https://github.com/sakurai-youhei/python-shukujitsu) package bundles the following source data, which is distributed by the Government of Japan under the [CC BY](https://creativecommons.org/licenses/by/4.0/legalcode.ja) compatible conditions according to [内閣府ホームページ利用規約](https://www.cao.go.jp/notice/rule.html).
- 2023年2月4日時点の [内閣府ホームページ](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) で公開されていた「昭和30年(1955年)から令和6年(2024年)国民の祝日(csv形式:20KB)」( https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv )
- 2023年2月1日時点の [内閣府ホームページ](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) で公開されていた「昭和30年(1955年)から令和6年(2024年)国民の祝日(csv形式:20KB)」( https://www8.cao.go.jp/chosei/shukujitsu/shukujitsu.csv )
- 2022年2月1日時点の [内閣府ホームページ](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) で公開されていた「昭和30年(1955年)から令和5年(2023年)国民の祝日(csv形式:20KB)」( https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv )
- 2021年2月1日時点の [内閣府ホームページ](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) で公開されていた「昭和30年(1955年)から令和4年(2022年)国民の祝日(csv形式:19KB)」( https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv )
- 2020年11月27日時点の [内閣府ホームページ](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) で公開されていた「昭和30年(1955年)から令和3年(2021年)国民の祝日(csv形式:19KB)」( https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv )
- 2020年11月18日時点の [内閣府ホームページ](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) で公開されていた「昭和30年(1955年)から令和3年(2021年)国民の祝日(csv形式:19KB)」( https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv )
Raw data
{
"_id": null,
"home_page": "https://github.com/sakurai-youhei/python-shukujitsu",
"name": "python-shukujitsu",
"maintainer": "Youhei Sakurai",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "sakurai.youhei@gmail.com",
"keywords": "",
"author": "Youhei Sakurai",
"author_email": "sakurai.youhei@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cd/7a/5dd4ae53d91509cfcbd351b496a80d0e989c74a4b6c0e9caa9513a1724af/python-shukujitsu-2023.2.4.tar.gz",
"platform": "any",
"description": "# python-shukujitsu\nPython Japanese holidays library based on static data published by Cabinet Office, Government of Japan\n\n[](https://pypi.org/project/python-shukujitsu/)\n[](https://pypi.org/project/python-shukujitsu/)\n[](https://pypi.org/project/python-shukujitsu/)\n[](https://pypi.org/project/python-shukujitsu/)\n\n[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22flake8+and+pytest%22)\n[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22Publish+to+PyPI%22)\n[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22Publish+to+DockerHub%22)\n[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3A%22RPM+and+DEB%22)\n[](https://github.com/sakurai-youhei/python-shukujitsu/actions?query=workflow%3ACodeQL)\n\n## Important notices\n\n- This [python-shukujitsu](https://github.com/sakurai-youhei/python-shukujitsu) package covers only holidays in Japan from **1955 to 2024**; will expand to holidays in 2025 in February 2024.\n- This [python-shukujitsu](https://github.com/sakurai-youhei/python-shukujitsu) package has ZERO relation to the Government of Japan - NEVER EVER assume any authorization as this is just a personal project.\n- 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.\n\n## Installation\n\n```\npip3 install python-shukujitsu\n```\n\n## Usage\n\nPlay the dict-like object.\n\n```python\nimport shukujitsu\n\njp_holidays = shukujitsu.Japan()\n# or:\n# jp_holidays = shukujitsu.JP()\n# or:\n# jp_holidays = shukujitsu.CountryHoliday('JP')\n\nfrom datetime import date\n\ndate(2020, 7, 24) in jp_holidays # True\ndate(2019, 7, 24) in jp_holidays # False\n\n# The dict-like object also accepts misc. date(time)-like strings\n# and int/float representing a Unix timestamp\n'2014-01-01' in jp_holidays # True\n'1/1/2014' in jp_holidays # True\n1388597445 in jp_holidays # True\n\njp_holidays.get('2014-01-01') # \"\u5143\u65e5\"\n\njp_holidays['2014-01-01': '2014-01-03'] # [date(2014, 1, 1)]\n```\n\n## Command-Line interface\n\n`shukujitsu` command is bundled.\n\n```console\n$ shukujitsu --help # or python3 -m shukujitsu --help\nusage: shukujitsu [-h] [-i] [-n] [-V] [DATE ...]\n\nSelect Japanese holidays from 1955 to 2024\n\npositional arguments:\n DATE date to be examined\n\noptions:\n -h, --help show this help message and exit\n -i, --invert-match select non-holidays\n -n, --holiday-name output holiday name instead\n -V, --version display version information and exit\n\nWith no DATE, read standard input. Exit status is 0 if any date is selected, 1 otherwise.\n```\n\nPass any dates through command-line arguments or STDIN.\n\n```console\n$ # With logical operators\n$ shukujitsu 1/1/2020 && echo Holiday found || echo Holiday not found\n1/1/2020\nHoliday found\n\n$ # Select holidays\n$ cat <<EOF | shukujitsu > holidays.txt\n> 2020-05-02\n> 2020-05-03\n> 2020-05-04\n> 2020-05-05\n> 2020-05-06\n> 2020-05-07\n> EOF\n\n$ # Select holidays\n$ shukujitsu 2020/7/22 2020/7/23 2020/7/24\n2020/7/23\n2020/7/24\n\n$ # Output each holiday name\n$ shukujitsu -n 2020/7/22 2020/7/23 2020/7/24\n\u6d77\u306e\u65e5\n\u30b9\u30dd\u30fc\u30c4\u306e\u65e5\n\n$ # Select non-holidays\n$ shukujitsu -i 2020/7/22 2020/7/23 2020/7/24\n2020/7/22\n```\n\n## Docker image\n\n[](https://hub.docker.com/r/sakuraiyouhei/shukujitsu/)\n[](https://hub.docker.com/r/sakuraiyouhei/shukujitsu/)\n\n```console\n$ docker run -it sakuraiyouhei/shukujitsu --help\n```\n\n## yum repository\n\n```console\n$ sudo yum install -y curl\n$ curl -fsSL https://sakurai-youhei.github.io/python-shukujitsu/rpm/python-shukujitsu.repo | sudo tee /etc/yum.repos.d/python-shukujitsu.repo\n$ sudo yum install -y python-shukujitsu\n$ shukujitsu --help\n```\n\nNote: There is one known issue in the RPM package as of 2023-02-04; https://github.com/sakurai-youhei/python-shukujitsu/issues/25\n\n## apt repository\n\n```console\n$ sudo apt install -y curl gpg\n$ curl -fsSL https://sakurai-youhei.github.io/python-shukujitsu/gpg | sudo apt-key add -\n$ curl -fsSL https://sakurai-youhei.github.io/python-shukujitsu/deb/python-shukujitsu.list | sudo tee /etc/apt/sources.list.d/python-shukujitsu.list\n$ sudo apt update\n$ sudo apt install -y python-shukujitsu\n$ shukujitsu --help\n```\n\n## Source data\n\nThis [python-shukujitsu](https://github.com/sakurai-youhei/python-shukujitsu) package bundles the following source data, which is distributed by the Government of Japan under the [CC BY](https://creativecommons.org/licenses/by/4.0/legalcode.ja) compatible conditions according to [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u5229\u7528\u898f\u7d04](https://www.cao.go.jp/notice/rule.html).\n\n- 2023\u5e742\u67084\u65e5\u6642\u70b9\u306e [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u305f\u300c\u662d\u548c30\u5e74\uff081955\u5e74\uff09\u304b\u3089\u4ee4\u548c6\u5e74\uff082024\u5e74\uff09\u56fd\u6c11\u306e\u795d\u65e5\uff08csv\u5f62\u5f0f\uff1a20KB\uff09\u300d\uff08 https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv \uff09\n- 2023\u5e742\u67081\u65e5\u6642\u70b9\u306e [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u305f\u300c\u662d\u548c30\u5e74\uff081955\u5e74\uff09\u304b\u3089\u4ee4\u548c6\u5e74\uff082024\u5e74\uff09\u56fd\u6c11\u306e\u795d\u65e5\uff08csv\u5f62\u5f0f\uff1a20KB\uff09\u300d\uff08 https://www8.cao.go.jp/chosei/shukujitsu/shukujitsu.csv \uff09\n- 2022\u5e742\u67081\u65e5\u6642\u70b9\u306e [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u305f\u300c\u662d\u548c30\u5e74\uff081955\u5e74\uff09\u304b\u3089\u4ee4\u548c5\u5e74\uff082023\u5e74\uff09\u56fd\u6c11\u306e\u795d\u65e5\uff08csv\u5f62\u5f0f\uff1a20KB\uff09\u300d\uff08 https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv \uff09\n- 2021\u5e742\u67081\u65e5\u6642\u70b9\u306e [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u305f\u300c\u662d\u548c30\u5e74\uff081955\u5e74\uff09\u304b\u3089\u4ee4\u548c4\u5e74\uff082022\u5e74\uff09\u56fd\u6c11\u306e\u795d\u65e5\uff08csv\u5f62\u5f0f\uff1a19KB\uff09\u300d\uff08 https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv \uff09\n- 2020\u5e7411\u670827\u65e5\u6642\u70b9\u306e [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u305f\u300c\u662d\u548c30\u5e74\uff081955\u5e74\uff09\u304b\u3089\u4ee4\u548c3\u5e74\uff082021\u5e74\uff09\u56fd\u6c11\u306e\u795d\u65e5\uff08csv\u5f62\u5f0f\uff1a19KB\uff09\u300d\uff08 https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv \uff09\n- 2020\u5e7411\u670818\u65e5\u6642\u70b9\u306e [\u5185\u95a3\u5e9c\u30db\u30fc\u30e0\u30da\u30fc\u30b8](https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html) \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u305f\u300c\u662d\u548c30\u5e74\uff081955\u5e74\uff09\u304b\u3089\u4ee4\u548c3\u5e74\uff082021\u5e74\uff09\u56fd\u6c11\u306e\u795d\u65e5\uff08csv\u5f62\u5f0f\uff1a19KB\uff09\u300d\uff08 https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv \uff09\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python Japanese holidays library based on static data published by Cabinet Office, Government of Japan",
"version": "2023.2.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "20344fe5a9c85009c02102a4d6ba77e6823e82bde7c77144e7e0d569f1098e6c",
"md5": "2849cdb5d3708c87289d0cb0abd41325",
"sha256": "1d4f2b24903cd44fa0c289967bc99527efa462354b0075a62413da2fbd67e321"
},
"downloads": -1,
"filename": "python_shukujitsu-2023.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2849cdb5d3708c87289d0cb0abd41325",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 44064,
"upload_time": "2023-02-04T03:05:52",
"upload_time_iso_8601": "2023-02-04T03:05:52.526682Z",
"url": "https://files.pythonhosted.org/packages/20/34/4fe5a9c85009c02102a4d6ba77e6823e82bde7c77144e7e0d569f1098e6c/python_shukujitsu-2023.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cd7a5dd4ae53d91509cfcbd351b496a80d0e989c74a4b6c0e9caa9513a1724af",
"md5": "5b127bd2d6ed2c4354ad1369974219fd",
"sha256": "15764e9a5430321b5b2784bf5253f32f669b12232a6f48a366fbcc23fb7fed24"
},
"downloads": -1,
"filename": "python-shukujitsu-2023.2.4.tar.gz",
"has_sig": false,
"md5_digest": "5b127bd2d6ed2c4354ad1369974219fd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 13412,
"upload_time": "2023-02-04T03:05:54",
"upload_time_iso_8601": "2023-02-04T03:05:54.027498Z",
"url": "https://files.pythonhosted.org/packages/cd/7a/5dd4ae53d91509cfcbd351b496a80d0e989c74a4b6c0e9caa9513a1724af/python-shukujitsu-2023.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-04 03:05:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "sakurai-youhei",
"github_project": "python-shukujitsu",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "python-shukujitsu"
}