Docu review done: Wed 31 Jul 2024 02:18:15 PM CEST
holiday
Table of Content
Description
holidata is a utility for algorithmically producing holiday data. Its purpose is mainly for holidata.net. Holiday data can be produced for a given year in a supported locale and output format.
Installation
First of all, clone the git repo
$ git clone https://github.com/GothenburgBitFactory/holidata.git
$ cd holidata
Inside of the repo you will find the setup.py
file, run this with the parameter build
and install
$ python3 ./setup.py build
$ sudo python3 ./setup.py install
After you finished the installation of holidata, you need to fullfill the requirements Therefor you can just install the following package with apt
$ sudo apt install python3-arrow python3-dateutil
Optional you can install the package python3-pytest
as well if you want to run the test python script
$ sudo apt install python3-pytest
One more thing is missing, the holidata/holidays python file. Just run holidata the first time and you will get an error like that:
$ holidata --help
Traceback (most recent call last):
File "/usr/local/bin/holidata", line 22, in <module>
from holidata import Emitter
File "/usr/local/lib/python3.8/dist-packages/holidata/__init__.py", line 1, in <module>
from .holidays import *
There you will find the path where to store the missing python fines and you are good to go (e.g. /usr/local/lib/python3.8/dist-packages/holidata/
)
# from the repo root
$ sudo cp -rf holidata/holidays /usr/local/lib/python3.8/dist-packages/holidata/
$ sudo chown -R root:staff /usr/local/lib/python3.8/dist-packages/holidata/holidays
Congratulations, now you should be able to run it without issues
$ holidata --help
Holidata - generate holidata files.
Usage:
holidata (--year=<value>) (--locale=<value>) [--output=<value>]
Options:
--year=<value> Specify which year to generate data for.
--locale=<value> Specify the locale for which data should be generated.
--output=(csv|json) Specify the output format [default: csv].
Dependencies:
pip3 install arrow docopt
Usage
Call holidata
providing the necessary data, e.g.
$ holidata --year=2020 --locale=de-DE
Call holidata
with the --usage
or --help
option to get usage info or help respectively.
Data
For each holiday the following data is provided:
locale
- language and country the holiday is defined forregion
- region code of the given subdivision the holiday is defined fordate
- actual date the holiday takes placedescription
- name of the holiday in the given languagetype
- holiday type flagsnotes
- additional information
Output Formats
Holidata supports different output formats, currently csv
, json
, yaml
, and xml
.
If you think an output format is missing, open a feature request on github.
Limitations
Holidata focuses on holidays which are defined by law on which business or work are suspended or reduced (there may be some exceptions to that rule).
Holidata only provides data for countries and their principal subdivisions (both as they are defined in ISO 3166). Holidays for other subdivisions are either merged or ignored. There is also no explicit representation of partial holidays.