Skip to content

Commit

Permalink
Merge branch 'main' into remove-pytz
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann authored Jun 25, 2024
2 parents 45adb83 + 6122447 commit ea19fba
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
matrix:
config:
# [Python version, tox env]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.8", "nopytz"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["pypy-3.9", "pypy3"]
- ["3.10", "docs"]
- ["3.11", "py311"]
- ["3.12", "py312"]

runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
Expand Down
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ New features:

Bug fixes:

- Change documentation to represent compatibility with Python 3.8 - 3.12, and PyPy3.
- Rename RFC 2445 to RFC 5545, see `Issue 278
<https://github.com/collective/icalendar/issues/278>`_

Expand Down
36 changes: 5 additions & 31 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,8 @@ with the same result:
X-DT-ZONEINFO;TZID=Europe/London:20240619T100100
END:VEVENT
Versions and Compatibility
--------------------------

``icalendar`` is a critical project used by many. It has been there for a long time and maintaining
long-term compatibility with projects conflicts partially with providing and using the features that
the latest Python versions bring.

Volunteers pour `effort into maintaining and developing icalendar
<https://github.com/collective/icalendar/discussions/360>`_.
Below, you can find an overview of the versions and how we maintain them.

Version 6
~~~~~~~~~
Version 6 with zoneinfo
~~~~~~~~~~~~~~~~~~~~~~~

Version 6 of ``icalendar`` switches the timezone implementation to ``zoneinfo``.
This only affects you if you parse ``icalendar`` objects with ``from_ical()``.
Expand All @@ -169,7 +156,7 @@ By default and since 6.0.0, ``zoneinfo`` timezones are created.
ZoneInfo(key='Europe/Vienna')
If you would like to continue to receive ``pytz`` timezones in as parse results,
you can receive all the latest updates, and switch back to version 5.x behavior:
you can receive all the latest updates, and switch back to earlier behavior:

.. code:: python
Expand All @@ -178,23 +165,10 @@ you can receive all the latest updates, and switch back to version 5.x behavior:
>>> dt.tzinfo
<DstTzInfo 'Europe/Vienna' CET+1:00:00 STD>
Version 6 is on `branch main <https://github.com/collective/icalendar/>`_ with compatibility to Python versions ``3.7+`` and ``PyPy3``.
Version 6 is on `branch main <https://github.com/collective/icalendar/>`_.
It is compatible with Python versions 3.8 - 3.12, and PyPy3.
We expect the ``main`` branch with versions ``6+`` to receive the latest updates and features.

Version 5
~~~~~~~~~

Version 5 uses only the ``pytz`` timezone implementation, and not ``zoneinfo``.
No updates will be released for this.
Please use version 6 and switch to use ``zoneinfo`` as documented above.

Version 4
~~~~~~~~~

Version 4 is on `branch 4.x <https://github.com/collective/icalendar/tree/4.x>`_ with maximum compatibility with Python versions ``2.7`` and ``3.4+``, ``PyPy2`` and ``PyPy3``.
The ``4.x`` branch only receives security and bug fixes if someone makes the effort.
We recommend migrating to later Python versions and also providing feedback if you depend on the ``4.x`` features.

Related projects
================

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'python-dateutil',
# 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.9"',
'tzdata'
]

Expand All @@ -38,11 +38,11 @@
'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',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
Expand All @@ -56,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={
Expand Down
3 changes: 2 additions & 1 deletion src/icalendar/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,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
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pytz = None
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
Expand Down
5 changes: 0 additions & 5 deletions src/icalendar/tests/prop/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/tests/test_cli_tool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from datetime import tzinfo, datetime
from datetime import datetime
from icalendar import Calendar, cli
try:
import zoneinfo
Expand Down
3 changes: 1 addition & 2 deletions src/icalendar/tests/test_components_break_on_bad_ics.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,7 +22,7 @@ def test_rdate_dosent_become_none_on_invalid_input_issue_464(events):
https://github.com/collective/icalendar/issues/464
'''
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',
Expand Down
3 changes: 0 additions & 3 deletions src/icalendar/tests/test_icalendar.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/icalendar/tests/test_issue_116.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import unittest

import datetime
import icalendar
import os
import pytest
from dateutil import tz


def test_issue_116():
Expand Down
1 change: 0 additions & 1 deletion src/icalendar/tests/test_issue_165_missing_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion src/icalendar/tests/test_issue_27_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion src/icalendar/tests/test_issue_350.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/icalendar/tests/test_multiple.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""An example with multiple VCALENDAR components"""
from icalendar import Calendar
from icalendar.prop import vText


Expand Down
2 changes: 0 additions & 2 deletions src/icalendar/tests/test_property_params.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest
from icalendar import Calendar, Event, Parameters, vCalAddress

import unittest
import icalendar
import re

@pytest.mark.parametrize('parameter, expected', [
Expand Down
2 changes: 0 additions & 2 deletions src/icalendar/tests/test_timezoned.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import unittest

import datetime
import dateutil.parser
import icalendar
import os
from icalendar.prop import tzid_from_dt


Expand Down
5 changes: 2 additions & 3 deletions src/icalendar/tests/test_unit_cal.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/tests/test_with_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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",
Expand Down

0 comments on commit ea19fba

Please sign in to comment.