Skip to content

Commit

Permalink
Merge pull request #198 from kuzmoyev/dev
Browse files Browse the repository at this point in the history
v2.5.0
  • Loading branch information
kuzmoyev authored Oct 18, 2024
2 parents 49c5348 + 9037609 commit 02dc100
Show file tree
Hide file tree
Showing 27 changed files with 232 additions and 175 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
include:
- python-version: '3.12'
- python-version: '3.13'
note: with-style-and-docs-checks

steps:
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ Issue submissions, discussions, suggestions are as welcomed contributions as pul
1. [Fork](https://github.com/kuzmoyev/google-calendar-simple-api/fork) the repository
2. Clone it with `git clone [email protected]:{your_username}/google-calendar-simple-api.git`
3. Install dependencies if needed with `pip install -e .` (or `pip install -e ".[dev]"` if you want to run tests, compile documentation, etc.).
Use [virtualenv](https://virtualenv.pypa.io/en/latest/) to avoid polluting your global python
Use [virtualenv](https://virtualenv.pypa.io/en/latest/) to avoid polluting your global python
4. Make and commit the changes. Add `closes #{issue_number}` to commit message if applies
5. Run the tests with `tox` (these will be run on pull request):
* `tox` - all the tests
* `tox -e pytest` - unit tests
* `tox -e flake8` - style check
* `tox -e sphinx` - docs compilation test
* `tox -e mypy` - static type check
6. Push
7. Create pull request
* towards `dev` branch if the changes require a new GCSA version (i.e. changes in [gcsa](https://github.com/kuzmoyev/google-calendar-simple-api/tree/master/gcsa) module)
Expand Down
18 changes: 18 additions & 0 deletions docs/source/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
Change log
==========


v2.5.0
~~~~~~

API
---
* Consistent type annotations (primarily regarding `Optional`)
* Support python3.13

Core
----
* Include mypy as a PR check

Backward compatibility
----------------------
* Full compatibility


v2.4.0
~~~~~~

Expand Down
7 changes: 3 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.autosummary',
'sphinx_rtd_theme'
'sphinx_rtd_theme',
'sphinxcontrib.googleanalytics'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -178,9 +179,7 @@
autodoc_member_order = 'bysource'
autodoc_typehints = "description"

html_theme_options = {
'analytics_id': 'G-PT0TPQSZ56',
}
googleanalytics_id = 'G-PT0TPQSZ56'

html_css_files = [
'css/custom.css',
Expand Down
12 changes: 6 additions & 6 deletions gcsa/_services/acl_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable, Union
from typing import Iterable, Union, Optional

from gcsa._services.base_service import BaseService
from gcsa.acl import AccessControlRule
Expand All @@ -10,7 +10,7 @@ class ACLService(BaseService):

def get_acl_rules(
self,
calendar_id: str = None,
calendar_id: Optional[str] = None,
show_deleted: bool = False
) -> Iterable[AccessControlRule]:
"""Returns the rules in the access control list for the calendar.
Expand Down Expand Up @@ -39,7 +39,7 @@ def get_acl_rules(
def get_acl_rule(
self,
rule_id: str,
calendar_id: str = None
calendar_id: Optional[str] = None
) -> AccessControlRule:
"""Returns an access control rule
Expand All @@ -64,7 +64,7 @@ def add_acl_rule(
self,
acl_rule: AccessControlRule,
send_notifications: bool = True,
calendar_id: str = None
calendar_id: Optional[str] = None
):
"""Adds access control rule
Expand Down Expand Up @@ -93,7 +93,7 @@ def update_acl_rule(
self,
acl_rule: AccessControlRule,
send_notifications: bool = True,
calendar_id: str = None
calendar_id: Optional[str] = None
):
"""Updates given access control rule
Expand Down Expand Up @@ -123,7 +123,7 @@ def update_acl_rule(
def delete_acl_rule(
self,
acl_rule: Union[AccessControlRule, str],
calendar_id: str = None
calendar_id: Optional[str] = None
):
"""Deletes access control rule.
Expand Down
10 changes: 5 additions & 5 deletions gcsa/_services/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class AuthenticatedService:
def __init__(
self,
*,
credentials: Credentials = None,
credentials_path: str = None,
token_path: str = None,
credentials: Optional[Credentials] = None,
credentials_path: Optional[str] = None,
token_path: Optional[str] = None,
save_token: bool = True,
read_only: bool = False,
authentication_flow_host: str = 'localhost',
authentication_flow_port: int = 8080,
authentication_flow_bind_addr: str = None,
authentication_flow_bind_addr: Optional[str] = None,
open_browser: Optional[bool] = None
):
"""
Expand Down Expand Up @@ -104,7 +104,7 @@ def _get_credentials(
save_token: bool,
host: str,
port: int,
bind_addr: str,
bind_addr: Optional[str],
open_browser: Optional[bool]
) -> Credentials:
credentials = None
Expand Down
4 changes: 2 additions & 2 deletions gcsa/_services/base_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable, Type, Union
from typing import Callable, Type, Union, Optional

from gcsa._resource import Resource
from gcsa._services.authentication import AuthenticatedService
Expand All @@ -22,7 +22,7 @@ def __init__(self, default_calendar, *args, **kwargs):
@staticmethod
def _list_paginated(
request_method: Callable,
serializer_cls: Type = None,
serializer_cls: Optional[Type] = None,
**kwargs
):
page_token = None
Expand Down
10 changes: 5 additions & 5 deletions gcsa/_services/calendar_lists_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable, Union
from typing import Iterable, Union, Optional

from gcsa._services.base_service import BaseService
from gcsa.calendar import CalendarListEntry, Calendar
Expand All @@ -10,7 +10,7 @@ class CalendarListService(BaseService):

def get_calendar_list(
self,
min_access_role: str = None,
min_access_role: Optional[str] = None,
show_deleted: bool = False,
show_hidden: bool = False
) -> Iterable[CalendarListEntry]:
Expand All @@ -37,7 +37,7 @@ def get_calendar_list(

def get_calendar_list_entry(
self,
calendar_id: str = None
calendar_id: Optional[str] = None
) -> CalendarListEntry:
"""Returns a calendar with the corresponding calendar_id from the user's calendar list.
Expand All @@ -56,7 +56,7 @@ def get_calendar_list_entry(
def add_calendar_list_entry(
self,
calendar: CalendarListEntry,
color_rgb_format: bool = None
color_rgb_format: Optional[bool] = None
) -> CalendarListEntry:
"""Adds an existing calendar into the user's calendar list.
Expand All @@ -83,7 +83,7 @@ def add_calendar_list_entry(
def update_calendar_list_entry(
self,
calendar: CalendarListEntry,
color_rgb_format: bool = None
color_rgb_format: Optional[bool] = None
) -> CalendarListEntry:
"""Updates an existing calendar on the user's calendar list.
Expand Down
4 changes: 2 additions & 2 deletions gcsa/_services/calendars_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union
from typing import Union, Optional

from gcsa._services.base_service import BaseService
from gcsa.calendar import Calendar, CalendarListEntry
Expand All @@ -10,7 +10,7 @@ class CalendarsService(BaseService):

def get_calendar(
self,
calendar_id: str = None
calendar_id: Optional[str] = None
) -> Calendar:
"""Returns the calendar with the corresponding calendar_id.
Expand Down
28 changes: 14 additions & 14 deletions gcsa/_services/events_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import date, datetime
from typing import Union, Iterator, Iterable, Callable
from typing import Union, Iterator, Iterable, Callable, Optional

from beautiful_date import BeautifulDate
from dateutil.relativedelta import relativedelta
Expand Down Expand Up @@ -57,13 +57,13 @@ def _list_events(

def get_events(
self,
time_min: Union[date, datetime, BeautifulDate] = None,
time_max: Union[date, datetime, BeautifulDate] = None,
order_by: str = None,
time_min: Optional[Union[date, datetime, BeautifulDate]] = None,
time_max: Optional[Union[date, datetime, BeautifulDate]] = None,
order_by: Optional[str] = None,
timezone: str = get_localzone_name(),
single_events: bool = False,
query: str = None,
calendar_id: str = None,
query: Optional[str] = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Iterable[Event]:
"""Lists events.
Expand Down Expand Up @@ -119,7 +119,7 @@ def get_instances(
time_min: Union[date, datetime, BeautifulDate] = None,
time_max: Union[date, datetime, BeautifulDate] = None,
timezone: str = get_localzone_name(),
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Iterable[Event]:
"""Lists instances of recurring event
Expand Down Expand Up @@ -187,7 +187,7 @@ def __getitem__(self, r):
def get_event(
self,
event_id: str,
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Event:
"""Returns the event with the corresponding event_id.
Expand Down Expand Up @@ -217,7 +217,7 @@ def add_event(
self,
event: Event,
send_updates: str = SendUpdatesMode.NONE,
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Event:
"""Creates event in the calendar
Expand Down Expand Up @@ -253,7 +253,7 @@ def add_quick_event(
self,
event_string: str,
send_updates: str = SendUpdatesMode.NONE,
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Event:
"""Creates event in the calendar by string description.
Expand Down Expand Up @@ -290,7 +290,7 @@ def update_event(
self,
event: Event,
send_updates: str = SendUpdatesMode.NONE,
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Event:
"""Updates existing event in the calendar
Expand Down Expand Up @@ -327,7 +327,7 @@ def update_event(
def import_event(
self,
event: Event,
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
) -> Event:
"""Imports an event in the calendar
Expand Down Expand Up @@ -362,7 +362,7 @@ def move_event(
event: Event,
destination_calendar_id: str,
send_updates: str = SendUpdatesMode.NONE,
source_calendar_id: str = None,
source_calendar_id: Optional[str] = None,
**kwargs
) -> Event:
"""Moves existing event from calendar to another calendar
Expand Down Expand Up @@ -400,7 +400,7 @@ def delete_event(
self,
event: Union[Event, str],
send_updates: str = SendUpdatesMode.NONE,
calendar_id: str = None,
calendar_id: Optional[str] = None,
**kwargs
):
"""Deletes an event.
Expand Down
12 changes: 6 additions & 6 deletions gcsa/_services/free_busy_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import date, datetime
from typing import Union, List
from typing import Union, List, Optional

from beautiful_date import BeautifulDate
from dateutil.relativedelta import relativedelta
Expand All @@ -14,13 +14,13 @@
class FreeBusyService(BaseService):
def get_free_busy(
self,
resource_ids: Union[str, List[str]] = None,
resource_ids: Optional[Union[str, List[str]]] = None,
*,
time_min: Union[date, datetime, BeautifulDate] = None,
time_max: Union[date, datetime, BeautifulDate] = None,
time_min: Optional[Union[date, datetime, BeautifulDate]] = None,
time_max: Optional[Union[date, datetime, BeautifulDate]] = None,
timezone: str = get_localzone_name(),
group_expansion_max: int = None,
calendar_expansion_max: int = None,
group_expansion_max: Optional[int] = None,
calendar_expansion_max: Optional[int] = None,
ignore_errors: bool = False
) -> FreeBusy:
"""Returns free/busy information for a set of calendars and/or groups.
Expand Down
6 changes: 4 additions & 2 deletions gcsa/acl.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from gcsa._resource import Resource


Expand Down Expand Up @@ -40,8 +42,8 @@ def __init__(
*,
role: str,
scope_type: str,
acl_id: str = None,
scope_value: str = None
acl_id: Optional[str] = None,
scope_value: Optional[str] = None
):
"""
:param role:
Expand Down
11 changes: 7 additions & 4 deletions gcsa/attachment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from typing import Optional


class Attachment:
_SUPPORTED_MIME_TYPES = {
"application/vnd.google-apps.audio",
Expand All @@ -21,10 +24,10 @@ class Attachment:
def __init__(
self,
file_url: str,
title: str = None,
mime_type: str = None,
_icon_link: str = None,
_file_id: str = None
title: Optional[str] = None,
mime_type: Optional[str] = None,
_icon_link: Optional[str] = None,
_file_id: Optional[str] = None
):
"""File attachment for the event.
Expand Down
Loading

0 comments on commit 02dc100

Please sign in to comment.