From 4aa0684c4aa4a3ef7ba62b219fdfc565b57befe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Thu, 20 Jun 2024 15:52:03 +0000 Subject: [PATCH 1/6] drop python<=3.7 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to https://endoflife.date/python python 3.7 has been EOSed 27 Jun 2023. Filter all code over `pyupgracde --py38-plus`. Signed-off-by: Tomasz Kłoczko --- src/icalendar/tests/test_with_doctest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/icalendar/tests/test_with_doctest.py b/src/icalendar/tests/test_with_doctest.py index 59660fbc..9f994b04 100644 --- a/src/icalendar/tests/test_with_doctest.py +++ b/src/icalendar/tests/test_with_doctest.py @@ -51,7 +51,7 @@ def test_docstring_of_python_file(module_name): if filename.lower().endswith(".rst") ] except FileNotFoundError: - raise EnvironmentError("Could not find the documentation - remove the build folder and try again.") + raise OSError("Could not find the documentation - remove the build folder and try again.") @pytest.mark.parametrize("filename", [ "README.rst", From 660b52331287a361e3c96f2e39fa0c5f60bc2aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Thu, 20 Jun 2024 15:55:19 +0000 Subject: [PATCH 2/6] update minimum supported python version to 3.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomasz Kłoczko --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index edbaa4f2..f9301b13 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ 'pytz', # install requirements depending on python version # see https://www.python.org/dev/peps/pep-0508/#environment-markers - 'backports.zoneinfo; python_version == "3.7" or python_version == "3.8"', + 'backports.zoneinfo; python_version <= "3.8"', 'tzdata' ] @@ -39,7 +39,6 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -57,7 +56,7 @@ package_dir={'': 'src'}, include_package_data=True, zip_safe=False, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=install_requires, entry_points = {'console_scripts': ['icalendar = icalendar.cli:main']}, extras_require={ From e3c7f49b21fd9508bc5cec4305f65d289dc55c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Thu, 20 Jun 2024 15:56:48 +0000 Subject: [PATCH 3/6] filter all code over ruff as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mostly ruff drops unused imports. Signed-off-by: Tomasz Kłoczko --- src/icalendar/cal.py | 3 ++- src/icalendar/prop.py | 2 +- src/icalendar/tests/conftest.py | 3 +-- src/icalendar/tests/prop/test_unit.py | 5 ----- src/icalendar/tests/test_cli_tool.py | 2 +- src/icalendar/tests/test_components_break_on_bad_ics.py | 3 +-- src/icalendar/tests/test_icalendar.py | 3 --- src/icalendar/tests/test_issue_116.py | 5 ----- src/icalendar/tests/test_issue_165_missing_event.py | 1 - .../test_issue_168_parsing_invalid_calendars_no_warning.py | 1 - src/icalendar/tests/test_issue_27_period.py | 1 - src/icalendar/tests/test_issue_350.py | 1 - src/icalendar/tests/test_issue_500_vboolean_for_parameter.py | 2 +- src/icalendar/tests/test_multiple.py | 1 - src/icalendar/tests/test_property_params.py | 2 -- src/icalendar/tests/test_timezoned.py | 2 -- src/icalendar/tests/test_unit_cal.py | 5 ++--- src/icalendar/tests/test_with_doctest.py | 3 --- 18 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py index 02a1fa6d..3e8f1b42 100644 --- a/src/icalendar/cal.py +++ b/src/icalendar/cal.py @@ -16,7 +16,8 @@ from icalendar.prop import vText, vDDDLists from icalendar.timezone import tzp from typing import Tuple, List -import dateutil.rrule, dateutil.tz +import dateutil.rrule +import dateutil.tz import os diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index 795400fd..8e13988d 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -338,7 +338,7 @@ def __init__(self, dt): self.params = Parameters({'value': 'PERIOD'}) tzid = tzid_from_dt(dt) if isinstance(dt, (datetime, time)) else None - if not tzid is None and tzid != 'UTC': + if tzid is not None and tzid != 'UTC': self.params.update({'TZID': tzid}) self.dt = dt diff --git a/src/icalendar/tests/conftest.py b/src/icalendar/tests/conftest.py index a1891b90..3f9424bf 100644 --- a/src/icalendar/tests/conftest.py +++ b/src/icalendar/tests/conftest.py @@ -5,9 +5,8 @@ import pytest import icalendar import pytz -from datetime import datetime from dateutil import tz -from icalendar.cal import Component, Calendar, Event, ComponentFactory +from icalendar.cal import Component, Calendar from icalendar.timezone import tzp as _tzp from icalendar.timezone import TZP from pathlib import Path diff --git a/src/icalendar/tests/prop/test_unit.py b/src/icalendar/tests/prop/test_unit.py index 9228e6fd..7804a80c 100644 --- a/src/icalendar/tests/prop/test_unit.py +++ b/src/icalendar/tests/prop/test_unit.py @@ -4,11 +4,6 @@ from datetime import timedelta from icalendar.parser import Parameters import unittest -from icalendar.prop import vDatetime, vDDDTypes -from icalendar.timezone.windows_to_olson import WINDOWS_TO_OLSON -import pytest -from copy import deepcopy -from dateutil import tz class TestProp(unittest.TestCase): diff --git a/src/icalendar/tests/test_cli_tool.py b/src/icalendar/tests/test_cli_tool.py index 0ae9b5ab..802a1132 100644 --- a/src/icalendar/tests/test_cli_tool.py +++ b/src/icalendar/tests/test_cli_tool.py @@ -1,6 +1,6 @@ import unittest -from datetime import tzinfo, datetime +from datetime import datetime from icalendar import Calendar, cli try: import zoneinfo diff --git a/src/icalendar/tests/test_components_break_on_bad_ics.py b/src/icalendar/tests/test_components_break_on_bad_ics.py index 6ac92aec..b8288500 100644 --- a/src/icalendar/tests/test_components_break_on_bad_ics.py +++ b/src/icalendar/tests/test_components_break_on_bad_ics.py @@ -1,6 +1,5 @@ import pytest -from icalendar import Event, Calendar def test_ignore_exceptions_on_broken_events_issue_104(events): ''' Issue #104 - line parsing error in a VEVENT @@ -25,7 +24,7 @@ def test_rdate_dosent_become_none_on_invalid_input_issue_464(events): ''' assert events.issue_464_invalid_rdate.is_broken assert ('RDATE', 'Expected period format, got: 199709T180000Z/PT5H30M') in events.issue_464_invalid_rdate.errors - assert not b'RDATE:None' in events.issue_464_invalid_rdate.to_ical() + assert b'RDATE:None' not in events.issue_464_invalid_rdate.to_ical() @pytest.mark.parametrize('calendar_name', [ 'big_bad_calendar', diff --git a/src/icalendar/tests/test_icalendar.py b/src/icalendar/tests/test_icalendar.py index f809025a..8d52f237 100644 --- a/src/icalendar/tests/test_icalendar.py +++ b/src/icalendar/tests/test_icalendar.py @@ -1,6 +1,3 @@ -import icalendar -import os -import textwrap from ..parser import Contentlines, Contentline, Parameters, foldline from ..parser import q_join, q_split, dquote from ..prop import vText diff --git a/src/icalendar/tests/test_issue_116.py b/src/icalendar/tests/test_issue_116.py index c795f00e..dca39902 100644 --- a/src/icalendar/tests/test_issue_116.py +++ b/src/icalendar/tests/test_issue_116.py @@ -1,10 +1,5 @@ -import unittest -import datetime import icalendar -import os -import pytest -from dateutil import tz def test_issue_116(): diff --git a/src/icalendar/tests/test_issue_165_missing_event.py b/src/icalendar/tests/test_issue_165_missing_event.py index 4f927fb2..e48c3962 100644 --- a/src/icalendar/tests/test_issue_165_missing_event.py +++ b/src/icalendar/tests/test_issue_165_missing_event.py @@ -2,7 +2,6 @@ https://github.com/collective/icalendar/issues/165 ''' -from icalendar import Calendar def test_issue_165_missing_event(calendars): events = list(calendars.issue_165_missing_event.walk('VEVENT')) diff --git a/src/icalendar/tests/test_issue_168_parsing_invalid_calendars_no_warning.py b/src/icalendar/tests/test_issue_168_parsing_invalid_calendars_no_warning.py index d73386c7..77abdf19 100644 --- a/src/icalendar/tests/test_issue_168_parsing_invalid_calendars_no_warning.py +++ b/src/icalendar/tests/test_issue_168_parsing_invalid_calendars_no_warning.py @@ -2,7 +2,6 @@ https://github.com/collective/icalendar/issues/168 ''' -from icalendar import Calendar def test_issue_168_parsing_inavlid_calendars_no_warning(calendars): expected_error = (None, "Content line could not be parsed into parts: 'X-APPLE-RADIUS=49.91307046514149': X-APPLE-RADIUS=49.91307046514149") diff --git a/src/icalendar/tests/test_issue_27_period.py b/src/icalendar/tests/test_issue_27_period.py index 6d92e5fa..71eeb530 100644 --- a/src/icalendar/tests/test_issue_27_period.py +++ b/src/icalendar/tests/test_issue_27_period.py @@ -2,7 +2,6 @@ https://github.com/collective/icalendar/issues/27 ''' -from icalendar import Calendar def test_issue_27_multiple_periods(calendars): free_busy = list(calendars.issue_27_multiple_periods_in_freebusy_multiple_freebusies.walk('VFREEBUSY'))[0] diff --git a/src/icalendar/tests/test_issue_350.py b/src/icalendar/tests/test_issue_350.py index 6e3348ba..7939c04c 100644 --- a/src/icalendar/tests/test_issue_350.py +++ b/src/icalendar/tests/test_issue_350.py @@ -2,7 +2,6 @@ https://github.com/collective/icalendar/issues/350 ''' -from icalendar import Calendar def test_issue_350(calendars): calendar = list(calendars.issue_350.walk('X-COMMENT')) diff --git a/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py b/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py index 2c67883a..3bb95c87 100644 --- a/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py +++ b/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py @@ -2,7 +2,7 @@ def test_vBoolean_can_be_used_as_parameter_issue_500(events): '''https://github.com/collective/icalendar/issues/500''' - attendee = vCalAddress(f'mailto:someone@example.com') + attendee = vCalAddress('mailto:someone@example.com') attendee.params['rsvp'] = vBoolean(True) event = Event() event.add('attendee', attendee) diff --git a/src/icalendar/tests/test_multiple.py b/src/icalendar/tests/test_multiple.py index 0fd33365..e87486df 100644 --- a/src/icalendar/tests/test_multiple.py +++ b/src/icalendar/tests/test_multiple.py @@ -1,5 +1,4 @@ """An example with multiple VCALENDAR components""" -from icalendar import Calendar from icalendar.prop import vText diff --git a/src/icalendar/tests/test_property_params.py b/src/icalendar/tests/test_property_params.py index 63b2ffed..48d37633 100644 --- a/src/icalendar/tests/test_property_params.py +++ b/src/icalendar/tests/test_property_params.py @@ -1,8 +1,6 @@ import pytest from icalendar import Calendar, Event, Parameters, vCalAddress -import unittest -import icalendar import re @pytest.mark.parametrize('parameter, expected', [ diff --git a/src/icalendar/tests/test_timezoned.py b/src/icalendar/tests/test_timezoned.py index 9ab410b1..1f2795af 100644 --- a/src/icalendar/tests/test_timezoned.py +++ b/src/icalendar/tests/test_timezoned.py @@ -1,9 +1,7 @@ -import unittest import datetime import dateutil.parser import icalendar -import os from icalendar.prop import tzid_from_dt diff --git a/src/icalendar/tests/test_unit_cal.py b/src/icalendar/tests/test_unit_cal.py index 007d38b0..68f7a3d9 100644 --- a/src/icalendar/tests/test_unit_cal.py +++ b/src/icalendar/tests/test_unit_cal.py @@ -1,14 +1,13 @@ import itertools from datetime import datetime from datetime import timedelta -import unittest import pytest import icalendar import re -from icalendar.cal import Component, Calendar, Event, ComponentFactory -from icalendar import prop, cal +from icalendar.cal import Component, Calendar, Event +from icalendar import prop from icalendar.prop import tzid_from_dt diff --git a/src/icalendar/tests/test_with_doctest.py b/src/icalendar/tests/test_with_doctest.py index 9f994b04..fe450a75 100644 --- a/src/icalendar/tests/test_with_doctest.py +++ b/src/icalendar/tests/test_with_doctest.py @@ -73,6 +73,3 @@ def test_documentation_file(document, zoneinfo_only, env_for_doctest): def test_can_import_zoneinfo(env_for_doctest): """Allow importing zoneinfo for tests.""" - import pytz - import zoneinfo - from dateutil import tz From 1b93304ba5b070a0e2992e116c0ca1895e830bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Thu, 20 Jun 2024 15:59:55 +0000 Subject: [PATCH 4/6] remove python 3.7 from CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomasz Kłoczko --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 566a2904..e4c9b808 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,6 @@ jobs: matrix: config: # [Python version, tox env] - - ["3.7", "py37"] - ["3.8", "py38"] - ["3.9", "py39"] - ["3.10", "py310"] From 1f5ed8a4b23efb57dad4c32872ddfa9ac6795bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Thu, 20 Jun 2024 16:01:19 +0000 Subject: [PATCH 5/6] addd python 3.12 to list of supported python versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomasz Kłoczko --- .github/workflows/tests.yml | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e4c9b808..25ec5d80 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: - ["pypy-3.9", "pypy3"] - ["3.10", "docs"] - ["3.11", "py311"] + - ["3.12", "py312"] runs-on: ubuntu-latest name: ${{ matrix.config[1] }} diff --git a/setup.py b/setup.py index f9301b13..bb52cf1d 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], From f2874552cb6a8835f3e7e2378cf1a0210c93be96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Sat, 22 Jun 2024 17:54:55 +0000 Subject: [PATCH 6/6] fixed install time backports.zoneinfo dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomasz Kłoczko --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bb52cf1d..86a97946 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ 'pytz', # install requirements depending on python version # see https://www.python.org/dev/peps/pep-0508/#environment-markers - 'backports.zoneinfo; python_version <= "3.8"', + 'backports.zoneinfo; python_version < "3.9"', 'tzdata' ]