Skip to content

Commit

Permalink
Merge pull request #89 from cronofy/python3.12
Browse files Browse the repository at this point in the history
Support Python up to 3.12 & drop 2.x
  • Loading branch information
CronofyMatt authored Oct 24, 2023
2 parents a09c9c5 + 72ccbfe commit d508b38
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7,3.7,3.8,3.9]
python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.2
3.9.18
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python 3.7.9
python 3.9.18
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [2.0.0]
* Add support for Python v3.12+ and drop support for Python v2.7 [#89]

## [1.9.6]
* Update library description

Expand All @@ -11,11 +14,13 @@
## [1.9.3]
* Add support for Element Token generation [#70]

[2.0.0]: https://github.com/cronofy/pycronofy/releases/tag/2.0.0
[1.9.6]: https://github.com/cronofy/pycronofy/releases/tag/1.9.6
[1.9.5]: https://github.com/cronofy/pycronofy/releases/tag/1.9.5
[1.9.4]: https://github.com/cronofy/pycronofy/releases/tag/1.9.4
[1.9.3]: https://github.com/cronofy/pycronofy/releases/tag/1.9.3

[#89]: https://github.com/cronofy/pycronofy/pull/89
[#78]: https://github.com/cronofy/pycronofy/pull/78
[#76]: https://github.com/cronofy/pycronofy/pull/76
[#74]: https://github.com/cronofy/pycronofy/pull/74
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Inspired by [Cronofy-Ruby](https://github.com/cronofy/cronofy-ruby)

# Installation

**NOTE:** Support for Python v2.7 was dropped as of pycronofy v2.0.0

(unless performing a system wide install, it's recommended to install inside of a virtualenv)

```bash
Expand Down
12 changes: 5 additions & 7 deletions pycronofy/client.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import datetime
import collections
import collections.abc

import hashlib
import base64
import hmac

import pytz
from future.standard_library import hooks

from pycronofy import settings
from pycronofy.auth import Auth
Expand All @@ -18,8 +17,7 @@
from pycronofy.request_handler import RequestHandler
from pycronofy.validation import validate

with hooks():
from urllib.parse import urlencode
from urllib.parse import urlencode


class Client(object):
Expand Down Expand Up @@ -808,7 +806,7 @@ def translate_available_periods(self, periods):
params[tp] = format_event_time(params[tp])

def map_availability_sequence(self, sequence):
if isinstance(sequence, collections.Iterable):
if isinstance(sequence, collections.abc.Iterable):
return list(map(lambda item: self.map_sequence_item(item), sequence))
else:
return sequence
Expand Down Expand Up @@ -856,7 +854,7 @@ def map_availability_participants(self, participants):
if type(participants) is dict:
# Allow one group to be specified without being nested
return [self.map_availability_participants_group(participants)]
elif isinstance(participants, collections.Iterable):
elif isinstance(participants, collections.abc.Iterable):
return list(map(lambda group: self.map_availability_participants_group(group), participants))
else:
return participants
Expand All @@ -870,7 +868,7 @@ def map_availability_participants_group(self, participants):
participants['required'] = 'all'

return participants
elif isinstance(participants, collections.Iterable):
elif isinstance(participants, collections.abc.Iterable):
return list(map(lambda group: self.map_availability_participants(group), participants))
else:
participants
Expand Down
2 changes: 1 addition & 1 deletion pycronofy/tests/test_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def request_callback(request):
}

result = client.availability(required_duration={'minutes': 30}, available_periods=periods, participants=example_participants, buffer=example_buffer)
assert(len(result)) == 1
assert len(result) == 1


@responses.activate
Expand Down
3 changes: 1 addition & 2 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
requests>=2.21.0
pytz>=2018.9
future

pytest
pytest-cov
responses
flake8
flake8
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
requests>=2.21.0
pytz>=2018.9
future

pytest==6.2.4
pytest-cov==2.12.1
responses==0.5.0
pytest>=6.2.4
pytest-cov>=2.12.1
responses>=0.5.0
flake8
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ def find_version(*file_paths):
install_requires=[
"requests>=2.20.0",
"pytz>=2013.7",
"future",
],
)
16 changes: 15 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
[tox:tox]
envlist = py{3.7,3.8,3.9,3.10,3.11,3.12}

[flake8]
exclude = .tox,./build
filename = *.py
ignore = E501
ignore = E501 E721

[testenv]
basepython =
py3.7: python3.7
py3.8: python3.8
py3.9: python3.9
py3.10: python3.10
py3.11: python3.11
py3.12: python3.12
commands = pytest
deps = -rrequirements.txt

0 comments on commit d508b38

Please sign in to comment.