Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honzajavorek/czech-holidays
Czech holidays on PyPI
https://github.com/honzajavorek/czech-holidays
Last synced: about 5 hours ago
JSON representation
Czech holidays on PyPI
- Host: GitHub
- URL: https://github.com/honzajavorek/czech-holidays
- Owner: honzajavorek
- License: mit
- Created: 2013-08-06T16:28:18.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2024-03-04T09:36:51.000Z (9 months ago)
- Last Synced: 2024-11-07T00:50:41.609Z (11 days ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/czech-holidays
- Size: 50.8 KB
- Stars: 15
- Watchers: 6
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Czech Holidays
==============Python package with `Czech public holidays `_.
Installation
------------From PyPI::
pip install czech-holidays
In case you have an adventurous mind, give a try to the source::
pip install git+https://github.com/honzajavorek/czech-holidays.git#egg=czech-holidays
Examples
--------Czech Holidays provides the following interface:
.. code:: python
>>> from czech_holidays import czech_holidays
>>> holidays = czech_holidays(2022)
>>> holidays[:3]
[Holiday(date=datetime.date(2022, 1, 1), name='Nový rok', name_en="New Year's Day"),
Holiday(date=datetime.date(2022, 1, 1), name='Den obnovy samostatného českého státu', name_en='Restoration Day of the Independent Czech State'),
Holiday(date=datetime.date(2022, 4, 18), name='Velikonoční pondělí', name_en='Easter Monday')]The function accepts year as a single argument and returns a list of `named tuples `_:
.. code:: python
>>> holidays[0].date
datetime.date(2022, 1, 1)
>>> holidays[0].name
'Nový rok'
>>> holidays[0].name_en
"New Year's Day"Albeit named, it's still just a tuple:
.. code:: python
>>> holidays[0][0]
datetime.date(2022, 1, 1)
>>> holidays[0][1]
'Nový rok'
>>> holidays[0][2]
"New Year's Day"
>>> tuple(holidays[0])
(datetime.date(2022, 1, 1), 'Nový rok', "New Year's Day")
>>> holidays[0] < holidays[5]
TrueTwo shortcuts are available:
.. code:: python
>>> from czech_holidays import czech_easter, czech_christmas
>>> czech_easter(2022)
Holiday(date=datetime.date(2022, 4, 18), name='Velikonoční pondělí', name_en='Easter Monday')
>>> czech_christmas(2022)
Holiday(date=datetime.date(2022, 12, 24), name='Štědrý den', name_en='Christmas Eve')The aim of this library is to simplify work with Czech public holidays in current
applications, thus **it does not provide any historical data**. If provided with
a year prior to the last legislative change to the list, the library raises an error:.. code:: python
>>> czech_holidays(2013)
Traceback (most recent call last):
NotImplementedError: ...Development
-----------Install using `poetry `_::
git clone [email protected]:honzajavorek/czech-holidays.git
cd czech-holidays
poetry installThen run tests::
pytest
License: MIT
------------© 2022 Honza Javorek
This work is licensed under `MIT license `_.