Repository: dr-prodigy/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:

Patch:
diff --git a/CHANGES b/CHANGES
index db5bc2de..a7b69f98 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,11 +1,3 @@
-Version 0.10.3
-==============
-
-Released ????? ??, ????
-
-- Spain fix (dr-p)
-
-
 Version 0.10.2
 ==============
 
diff --git a/README.rst b/README.rst
index 641a7626..93453d0b 100644
--- a/README.rst
+++ b/README.rst
@@ -141,6 +141,7 @@ Italy               IT/ITA    prov = AN, AO, BA, BL, BO, BS, BZ, CB, Cesena, CH,
 Japan               JP/JPN    None
 Kenya               KE/KEN    None
 Korea               KR/KOR    None
+Latvia              LV/LVA    None
 Lithuania           LT/LTU    None
 Luxembourg          LU/LUX    None
 Mexico              MX/MEX    None
@@ -424,10 +425,6 @@ More Examples
 >>> from datetime import date
 >>> holidays.US()[date(2013, 12, 31): date(2014, 1, 2)]
 
-# Intermediate years are only shown if they are listed in the years parameter.
-
->>> holidays.US(years=[2014])[datetime.date(2013, 1, 1): datetime.date(2015, 12, 31)]
-
 Development Version
 -------------------
 
diff --git a/holidays/__init__.py b/holidays/__init__.py
index 6323fa83..424246f8 100644
--- a/holidays/__init__.py
+++ b/holidays/__init__.py
@@ -17,4 +17,4 @@ from holidays.constants import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT,
 from holidays.holiday_base import HolidayBase, createHolidaySum
 from holidays.utils import list_supported_countries, CountryHoliday
 
-__version__ = '0.10.3'
+__version__ = '0.10.2'
diff --git a/holidays/countries/__init__.py b/holidays/countries/__init__.py
index b180c00c..44ac20e9 100644
--- a/holidays/countries/__init__.py
+++ b/holidays/countries/__init__.py
@@ -42,6 +42,7 @@ from .israel import Israel, IL, ISR
 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
index 00000000..36ac7e90
--- /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
diff --git a/holidays/countries/spain.py b/holidays/countries/spain.py
index a28448ea..063f7adf 100644
--- a/holidays/countries/spain.py
+++ b/holidays/countries/spain.py
@@ -57,7 +57,7 @@ class Spain(HolidayBase):
         if self.prov and self.prov in \
                 ['CT', 'PV', 'NC', 'VC', 'IB', 'CM']:
             self[easter(year) + rd(weekday=MO)] = "Lunes de Pascua"
-        self[date(year, MAY, 1)] = "Día del Trabajador"
+            self[date(year, MAY, 1)] = "Día del Trabajador"
         if self.prov and self.prov in ['CT', 'GA', 'VC']:
             self[date(year, JUN, 24)] = "San Juan"
         self[date(year, AUG, 15)] = "Asunción de la Virgen"


Test patch:
diff --git a/tests.py b/tests.py
index 30934491..562f0e13 100644
--- a/tests.py
+++ b/tests.py
@@ -3188,7 +3188,6 @@ class TestES(unittest.TestCase):
         fixed_days_whole_country = (
             (1, 1),
             (1, 6),
-            (5, 1),
             (8, 15),
             (10, 12),
             (11, 1),
@@ -3217,6 +3216,7 @@ class TestES(unittest.TestCase):
             (3, 1): ['IB'],
             (4, 23): ['AR', 'CL'],
             (5, 30): ['CN'],
+            (5, 1): ['CT', 'PV', 'NC', 'VC', 'IB', 'CM'],
             (5, 2): ['MD'],
             (6, 9): ['MC', 'RI'],
             (7, 25): ['GA'],
@@ -5251,6 +5251,28 @@ class TestRussia(unittest.TestCase):
         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):