Skip to content

Commit

Permalink
Merge branch 'main' into docs-py-38+
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann committed Jun 23, 2024
2 parents f75a179 + f7f0c20 commit 2cce183
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 113 deletions.
30 changes: 14 additions & 16 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ Changelog
Minor changes:

- Test that all code works with both ``pytz`` and ``zoneinfo``.
- Rename ``master`` branch to ``main``, see `Issue
<https://github.com/collective/icalendar/issues/627>`_

- Added missing public classes and functions to API documentation.
- Add version badge

Breaking changes:

Expand Down Expand Up @@ -36,13 +39,22 @@ Breaking changes:
- Replaced ``pkg_resources.get_distribution`` with ``importlib.metadata`` in
``docs/conf.py`` to allow building docs on Python 3.12.

- Remove ``is_broken`` property. Use ``errors`` instead to check if a
component had suppressed parsing errors.
See `Issue 424 <https://github.com/collective/icalendar/issues/424>`_.

- Remove untested and broken ``LocalTimezone`` and ``FixedOffset`` tzinfo
sub-classes, see `Issue 67 <https://github.com/collective/icalendar/issues/67>`_

New features:

- ...

Bug fixes:

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

5.0.13 (2024-06-20)
-------------------
Expand All @@ -57,10 +69,6 @@ Minor changes:
- Document how to serve the built documentation to view with the browser
- Improve test coverage

Breaking changes:

- ...

New features:

- Create GitHub releases for each tag.
Expand All @@ -87,18 +95,8 @@ Minor changes:
- Update GitHub Actions steps versions
- Keep GitHub Actions up to date with GitHub's Dependabot


Breaking changes:

- ...

New features:

- ...

Bug fixes:

- ...
- Fixed index error in cal.py when attempting to pop from an empty stack
- Fixed type error in prop.py when attempting to join strings into a byte-string
- Caught Wrong Date Format in ical_fuzzer to resolve fuzzing coverage blocker
Expand Down Expand Up @@ -328,7 +326,7 @@ New features:
- No longer test on Python 3.4, 3.5 and PyPy2, because we cannot get it to work.
Technically it should still work, it is just no longer tested.
Do not expect much development on branch 4.x anymore.
The master branch will be for the remaining Python versions that we support.
The main branch will be for the remaining Python versions that we support.
[maurits]

Bug fixes:
Expand Down Expand Up @@ -968,7 +966,7 @@ Fixes:
[garbas]

- hook out github repository to https://readthedocs.org service so sphinx
documentation is generated on each commit (for master). Documentation can be
documentation is generated on each commit (for main). Documentation can be
visible on: https://icalendar.readthedocs.io/en/latest/
[garbas]

Expand Down
11 changes: 7 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ files.
:Code: https://github.com/collective/icalendar
:Mailing list: https://github.com/collective/icalendar/issues
:Dependencies: `python-dateutil`_ and `pytz`_.
:Compatible with: Python 2.7 and 3.4+
:License: `BSD`_

----
Expand All @@ -20,13 +19,17 @@ files.
:target: https://pypi.org/project/icalendar/
:alt: Python Package Version on PyPI

.. image:: https://img.shields.io/pypi/pyversions/icalendar
:target: https://pypi.org/project/icalendar/
:alt: PyPI - Python Version

.. image:: https://img.shields.io/pypi/dm/icalendar.svg
:target: https://pypi.org/project/icalendar/#files
:alt: Downloads from PyPI

.. image:: https://img.shields.io/github/actions/workflow/status/collective/icalendar/tests.yml?branch=master&label=master&logo=github
:target: https://github.com/collective/icalendar/actions/workflows/tests.yml?query=branch%3Amaster
:alt: GitHub Actions build status for master
.. image:: https://img.shields.io/github/actions/workflow/status/collective/icalendar/tests.yml?branch=main&label=main&logo=github
:target: https://github.com/collective/icalendar/actions/workflows/tests.yml?query=branch%3Amain
:alt: GitHub Actions build status for main

.. image:: https://img.shields.io/github/actions/workflow/status/collective/icalendar/tests.yml?branch=4.x&label=4.x&logo=github
:target: https://github.com/collective/icalendar/actions/workflows/tests.yml?query=branch%3A4.x++
Expand Down
5 changes: 2 additions & 3 deletions docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ iCalendar package for Python. The inspiration has come from the email package
in the standard lib, which he thinks is pretty simple, yet efficient and
powerful.

The icalendar package is an RFC 5545-compatible parser/generator for iCalendar files.
The ``icalendar`` package is an `RFC 5545 <https://tools.ietf.org/html/rfc5545>`
compatible parser/generator for iCalendar files.

.. _`Max M`: http://www.mxm.dk
.. _`RFC 2445`: https://tools.ietf.org/html/rfc2445
.. _`RFC 5545`: https://tools.ietf.org/html/rfc5545
12 changes: 6 additions & 6 deletions docs/maintenance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app

.. code-block:: bash
git checkout master
git checkout main
git pull
git checkout -b release master
git checkout -b release main
git add CHANGES.rst src/icalendar/__init__.py docs/install.rst
git commit -m"version 5.0.0"
Expand All @@ -90,7 +90,7 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app

.. code-block:: bash
git checkout master
git checkout main
git pull
git branch -d release
git push -d origin release
Expand All @@ -99,7 +99,7 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app

.. code-block:: bash
git checkout master
git checkout main
git pull
git tag v5.0.0
git push upstream v5.0.0 # could be origin or whatever reference
Expand Down Expand Up @@ -137,13 +137,13 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app

.. code-block:: bash
git checkout master
git checkout main
git pull
git add CHANGES.rst
git commit -m"Add new CHANGELOG section for future release
See https://icalendar.readthedocs.io/en/latest/maintenance.html#new-releases"
git push upstream master # could be origin or whatever reference
git push upstream main # could be origin or whatever reference
Links
-----
Expand Down
6 changes: 3 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ iCalendar package
=================

This package is used for parsing and generating iCalendar files following the
standard in RFC 2445.
standard in RFC 5545.

It should be fully compliant, but it is possible to generate and parse invalid
files if you really want to.
Expand Down Expand Up @@ -129,7 +129,7 @@ added. Here is an example::
END:VCALENDAR

Note: this version doesn't check for compliance, so you should look in
the RFC 2445 spec for legal properties for each component, or look in
the RFC 5545 spec for legal properties for each component, or look in
the icalendar/calendar.py file, where it is at least defined for each
component.

Expand Down Expand Up @@ -372,5 +372,5 @@ Print out the calendar::
More documentation
==================

Have a look at the `tests <https://github.com/collective/icalendar/tree/master/src/icalendar/tests>`__ of this package to get more examples.
Have a look at the `tests <https://github.com/collective/icalendar/tree/main/src/icalendar/tests>`__ of this package to get more examples.
All modules and classes docstrings, which document how they work.
5 changes: 0 additions & 5 deletions src/icalendar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
vUTCOffset,
TypesFactory,
)
# useful tzinfo subclasses
from icalendar.prop import (
FixedOffset,
LocalTimezone,
)
# Parameters and helper methods for splitting and joining string with escaped
# chars.
from icalendar.parser import (
Expand Down
10 changes: 3 additions & 7 deletions src/icalendar/cal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Calendar is a dictionary like Python object that can render itself as VCAL
files according to rfc2445.
files according to RFC 5545.
These are the defined components.
"""
Expand Down Expand Up @@ -37,7 +37,7 @@ def get_example(component_directory: str, example_name: str) -> bytes:
# The component factory

class ComponentFactory(CaselessDict):
"""All components defined in rfc 2445 are registered in this factory class.
"""All components defined in RFC 5545 are registered in this factory class.
To get a component you can use it like this.
"""

Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(self, *args, **kwargs):

class Component(CaselessDict):
"""Component is the base object for calendar, Event and the other
components defined in RFC 2445. Normally you will not use this class
components defined in RFC 5545. Normally you will not use this class
directly, but rather one of the subclasses.
"""

Expand Down Expand Up @@ -118,10 +118,6 @@ def is_empty(self):
"""
return True if not (list(self.values()) + self.subcomponents) else False # noqa

@property
def is_broken(self):
return bool(self.errors)

#############################
# handling of property values

Expand Down
4 changes: 2 additions & 2 deletions src/icalendar/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This module parses and generates contentlines as defined in RFC 2445
"""This module parses and generates contentlines as defined in RFC 5545
(iCalendar), but will probably work for other MIME types with similar syntax.
Eg. RFC 2426 (vCard)
Expand Down Expand Up @@ -174,7 +174,7 @@ class Parameters(CaselessDict):
"""

def params(self):
"""In rfc2445 keys are called parameters, so this is to be consitent
"""In RFC 5545 keys are called parameters, so this is to be consitent
with the naming conventions.
"""
return self.keys()
Expand Down
63 changes: 2 additions & 61 deletions src/icalendar/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
iCalendar properties have values. The values are strongly typed. This module
defines these types, calling val.to_ical() on them will render them as defined
in rfc2445.
in rfc5545.
If you pass any of these classes a Python primitive, you will have an object
that can render itself as iCalendar formatted date.
Expand All @@ -40,12 +40,6 @@
from datetime import time
from datetime import timedelta
from datetime import tzinfo

try:
from dateutil.tz import tzutc
except ImportError:
tzutc = None

from icalendar.caselessdict import CaselessDict
from icalendar.parser import Parameters
from icalendar.parser import escape_char
Expand All @@ -70,19 +64,6 @@
WEEKDAY_RULE = re.compile(r'(?P<signal>[+-]?)(?P<relative>[\d]{0,2})'
r'(?P<weekday>[\w]{2})$')

####################################################
# handy tzinfo classes you can use.
#

ZERO = timedelta(0)
HOUR = timedelta(hours=1)
STDOFFSET = timedelta(seconds=-_time.timezone)
if _time.daylight:
DSTOFFSET = timedelta(seconds=-_time.altzone)
else:
DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET


def tzid_from_dt(dt: datetime) -> Optional[str]:
"""Retrieve the timezone id from the datetime object."""
Expand All @@ -98,46 +79,6 @@ def tzid_from_dt(dt: datetime) -> Optional[str]:
return tzid


class FixedOffset(tzinfo):
"""Fixed offset in minutes east from UTC.
"""

def __init__(self, offset, name):
self.__offset = timedelta(minutes=offset)
self.__name = name

def utcoffset(self, dt):
return self.__offset

def tzname(self, dt):
return self.__name

def dst(self, dt):
return ZERO


class LocalTimezone(tzinfo):
"""Timezone of the machine where the code is running.
"""

def utcoffset(self, dt):
return DSTOFFSET if self._isdst(dt) else STDOFFSET

def dst(self, dt):
return DSTDIFF if self._isdst(dt) else ZERO

def tzname(self, dt):
return _time.tzname[self._isdst(dt)]

def _isdst(self, dt):
tt = (dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.weekday(), 0, -1)
stamp = _time.mktime(tt)
tt = _time.localtime(stamp)
return tt.tm_isdst > 0


class vBinary:
"""Binary property values are base 64 encoded.
"""
Expand Down Expand Up @@ -928,7 +869,7 @@ def from_ical(cls, ical):


class TypesFactory(CaselessDict):
"""All Value types defined in rfc 2445 are registered in this factory
"""All Value types defined in RFC 5545 are registered in this factory
class.
The value and parameter names don't overlap. So one factory is enough for
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/tests/prop/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def test_prop_vText(self):
b'Text with escaped\\n chars')

# If you pass a unicode object, it will be utf-8 encoded. As this is
# the (only) standard that RFC 2445 support.
# the (only) standard that RFC 5545 support.
t = vText('international chars \xe4\xf6\xfc')
self.assertEqual(t.to_ical(),
b'international chars \xc3\xa4\xc3\xb6\xc3\xbc')
Expand Down
3 changes: 0 additions & 3 deletions src/icalendar/tests/test_components_break_on_bad_ics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def test_ignore_exceptions_on_broken_events_issue_104(events):
https://github.com/collective/icalendar/issues/104
'''
assert events.issue_104_mark_events_broken.is_broken # TODO: REMOVE FOR NEXT MAJOR RELEASE
assert events.issue_104_mark_events_broken.errors == [(None, "Content line could not be parsed into parts: 'X': Invalid content line")]

def test_dont_ignore_exceptions_on_broken_calendars_issue_104(calendars):
Expand All @@ -23,7 +22,6 @@ def test_rdate_dosent_become_none_on_invalid_input_issue_464(events):
'''Issue #464 - [BUG] RDATE can become None if value is invalid
https://github.com/collective/icalendar/issues/464
'''
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()

Expand All @@ -38,4 +36,3 @@ def test_error_message_doesnt_get_too_big(calendars, calendar_name):
calendars[calendar_name]
# Ignore part before first : for the test.
assert len(str(exception).split(': ', 1)[1]) <= 100

2 changes: 1 addition & 1 deletion src/icalendar/tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_no_tzid_when_utc(utc, date, expected_output):
https://github.com/collective/icalendar/issues/58
https://github.com/collective/icalendar/issues/335
'''
# According to RFC 2445: "The TZID property parameter MUST NOT be
# According to RFC 5545: "The TZID property parameter MUST NOT be
# applied to DATE-TIME or TIME properties whose time values are
# specified in UTC.
date = date.replace(tzinfo=utc)
Expand Down
Loading

0 comments on commit 2cce183

Please sign in to comment.