Repository: vacanza/python-holidays

Issue:
Latvia holiday calendar
Thanks for the package! Just wanted to make it known that someone here is interested in Latvia holiday calendar. I might also do it myself if I find the time (and the information), we'll see.


Discussion:

Resolving patch:
diff --git a/holidays/countries/__init__.py b/holidays/countries/__init__.py
--- a/holidays/countries/__init__.py
+++ b/holidays/countries/__init__.py
@@ -42,6 +42,7 @@
 from .japan import Japan, JP, JPN
 from .kenya import Kenya, KE, KEN
 from .korea import Korea, KR, KOR
+from .latvia import Latvia, LV, LVA
 from .lithuania import Lithuania, LT, LTU
 from .luxembourg import Luxembourg, LU, LUX
 from .mexico import Mexico, MX, MEX
diff --git a/holidays/countries/latvia.py b/holidays/countries/latvia.py
new file mode 100644
--- /dev/null
+++ b/holidays/countries/latvia.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+
+#  python-holidays
+#  ---------------
+#  A fast, efficient Python library for generating country, province and state
+#  specific sets of holidays on the fly. It aims to make determining whether a
+#  specific date is a holiday as fast and flexible as possible.
+#
+#  Author:      ryanss <ryanssdev@icloud.com> (c) 2014-2017
+#               dr-prodigy <maurizio.montel@gmail.com> (c) 2017-2020
+#  Contributor: rolandinsh <rolands@mediabox.lv> (c) 2020
+#  Website:     https://github.com/rolandinsh/python-holidays
+#  License:     MIT (see LICENSE file)
+
+from datetime import date
+
+from dateutil.easter import easter
+from dateutil.relativedelta import relativedelta as rd, SU
+
+from holidays.holiday_base import HolidayBase
+
+
+class Latvia(HolidayBase):
+
+    # https://en.wikipedia.org/wiki/Public_holidays_in_Latvia
+    # https://information.lv/
+
+    def __init__(self, **kwargs):
+        self.country = "LV"
+        HolidayBase.__init__(self, **kwargs)
+
+    def _populate(self, year):
+        # New Year's Day
+        self[date(year, 1, 1)] = "Jaunais gads"
+
+        # Good Friday
+        easter_date = easter(year)
+        self[easter_date - rd(days=2)] = "Lielā Piektdiena"
+
+        # Easter
+        easter_date = easter(year)
+        self[easter_date] = "Lieldienas"
+
+        # Easter 2nd day
+        self[easter_date + rd(days=1)] = "Otrās Lieldienas"
+
+        # International Workers' Day
+        self[date(year, 5, 1)] = "Darba svētki"
+
+        # Restoration of Independence Day (1990). 
+        # Latvia proclaimed its independence from the USSR, 
+        #   and restoration of the Republic of Latvia.
+        if year >= 1990:
+            self[date(year, 5, 4)] = "Latvijas Republikas \
+                Neatkarības atjaunošanas diena"
+
+        # by law https://likumi.lv/ta/id/72608-par-svetku-atceres-un-atzimejamam-dienam 
+        # Midsummer's Eve
+        if year >= 1990:
+            self[date(year, 6, 23)] = "Līgo diena"
+
+        # Midsummer's Day
+        # Also so called "St. John's Day"
+        if year >= 1990:
+            self[date(year, 6, 24)] = "Jāņu dienu"
+
+        # Proclamation Day of the Republic of Latvia
+        if year >= 1918:
+            self[date(year, 11, 18)] = "Latvijas Republikas proklamēšanas diena"
+
+        # Christmas Eve
+        self[date(year, 12, 24)] = "Ziemassvētku vakars"
+
+        # Christmas 1st day
+        self[date(year, 12, 25)] = "Ziemassvētki"
+
+        # Christmas 2nd day
+        self[date(year, 12, 26)] = "Otrie Ziemassvētki"
+
+        # New Year's Eve
+        self[date(year, 12, 31)] = "Vecgada vakars"
+
+
+class LV(Latvia):
+    pass
+
+
+class LVA(Latvia):
+    pass


Test patch:
diff --git a/tests.py b/tests.py
--- a/tests.py
+++ b/tests.py
@@ -5251,6 +5251,28 @@ def test_2018(self):
         self.assertIn(date(2018, 11, 4), self.holidays)
 
 
+class TestLatvia(unittest.TestCase):
+    def setUp(self):
+        self.holidays = holidays.LV()
+
+    def test_2020(self):
+        # https://www.officeholidays.com/countries/latvia/2020
+        # https://en.wikipedia.org/wiki/Public_holidays_in_Latvia
+        # https://likumi.lv/ta/id/72608-par-svetku-atceres-un-atzimejamam-dienam 
+        self.assertIn(date(2020, 1, 1), self.holidays)
+        self.assertIn(date(2020, 4, 10), self.holidays)
+        self.assertIn(date(2020, 4, 13), self.holidays)
+        self.assertIn(date(2020, 5, 1), self.holidays)
+        self.assertIn(date(2020, 5, 4), self.holidays)
+        self.assertIn(date(2020, 6, 23), self.holidays)
+        self.assertIn(date(2020, 6, 24), self.holidays)
+        self.assertIn(date(2020, 11, 18), self.holidays)
+        self.assertIn(date(2020, 12, 24), self.holidays)
+        self.assertIn(date(2020, 12, 25), self.holidays)
+        self.assertIn(date(2020, 12, 26), self.holidays)
+        self.assertIn(date(2020, 12, 31), self.holidays)
+
+
 class TestLithuania(unittest.TestCase):
 
     def setUp(self):