Skip to content

Commit 48a0b47

Browse files
authored
Merge pull request #201 from eriknw/test_cythons
Test with Cython 0.29 and 3.0; update to Python 3.12
2 parents f402d74 + 7caa6ee commit 48a0b47

File tree

7 files changed

+94
-56
lines changed

7 files changed

+94
-56
lines changed

Diff for: .github/workflows/test.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,30 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: ["ubuntu-latest"]
16+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
17+
cython-version: ["0.29.37", "3.0.7"]
1718
python-version:
1819
- "3.7"
1920
- "3.8"
2021
- "3.9"
2122
- "3.10"
2223
- "3.11"
23-
- "pypy3.6"
24+
- "3.12"
2425
- "pypy3.7"
2526
- "pypy3.8"
26-
# - "pypy3.9"
27-
# - "pypy3.10"
27+
- "pypy3.9"
28+
- "pypy3.10"
2829
steps:
2930
- name: Checkout
30-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3132
- name: Set up Python
32-
uses: actions/setup-python@v4
33+
uses: actions/setup-python@v5
3334
with:
3435
python-version: ${{ matrix.python-version }}
3536
- name: Install dependencies
3637
run: |
3738
python -m pip install --upgrade pip setuptools wheel
38-
pip install cython pytest
39+
pip install cython==${{ matrix.cython-version }} pytest
3940
pip install git+https://github.com/pytoolz/toolz.git
4041
python setup.py build_ext --inplace --with-cython
4142
pip install -e .

Diff for: .github/workflows/wheels.yml

+34-34
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
# # PyPy may have issues. Intermittent failures have been seen on:
2828
# # pp37-manylinux_aarch64 pp38-win_amd64
2929
#
30-
# pys = ['cp36', 'cp37', 'cp38', 'cp39', 'cp310', 'cp311']
31-
# pys_arm = ['cp38', 'cp39', 'cp310', 'cp311']
30+
# pys = ['cp37', 'cp38', 'cp39', 'cp310', 'cp311', 'cp312']
31+
# pys_arm = ['cp38', 'cp39', 'cp310', 'cp311', 'cp312']
3232
# pypys = ['pp37', 'pp38', 'pp39', 'pp310']
3333
# SKIP = set() # {"pp37-manylinux_aarch64", "pp38-win_amd64"}
3434
# combos = []
@@ -60,10 +60,9 @@ jobs:
6060
# combos.append(('windows', f'{py}-win_amd64', 'AMD64'))
6161
#
6262
# # Sort, filter, and print combinations
63-
# for os, build, arch in sorted(combos, key=lambda x: (x[0], x[1].replace('310', '390').replace('311', '391'), x[2])):
63+
# for os, build, arch in sorted(combos, key=lambda x: (x[0], x[1].replace('310', '390').replace('311', '391').replace('312', '392'), x[2])):
6464
# skip = "# " if build in SKIP else ""
6565
# print(f' {skip}- {{"os": "{os}", "build": "{build}", "arch": "{arch}"}}')
66-
- {"os": "macos", "build": "cp36-macosx_x86_64", "arch": "x86_64"}
6766
- {"os": "macos", "build": "cp37-macosx_x86_64", "arch": "x86_64"}
6867
- {"os": "macos", "build": "cp38-macosx_arm64", "arch": "arm64"}
6968
- {"os": "macos", "build": "cp38-macosx_x86_64", "arch": "x86_64"}
@@ -73,20 +72,12 @@ jobs:
7372
- {"os": "macos", "build": "cp310-macosx_x86_64", "arch": "x86_64"}
7473
- {"os": "macos", "build": "cp311-macosx_arm64", "arch": "arm64"}
7574
- {"os": "macos", "build": "cp311-macosx_x86_64", "arch": "x86_64"}
75+
- {"os": "macos", "build": "cp312-macosx_arm64", "arch": "arm64"}
76+
- {"os": "macos", "build": "cp312-macosx_x86_64", "arch": "x86_64"}
7677
- {"os": "macos", "build": "pp37-macosx_x86_64", "arch": "x86_64"}
7778
- {"os": "macos", "build": "pp38-macosx_x86_64", "arch": "x86_64"}
78-
# - {"os": "macos", "build": "pp39-macosx_x86_64", "arch": "x86_64"}
79-
# - {"os": "macos", "build": "pp310-macosx_x86_64", "arch": "x86_64"}
80-
- {"os": "ubuntu", "build": "cp36-manylinux_aarch64", "arch": "aarch64"}
81-
- {"os": "ubuntu", "build": "cp36-manylinux_i686", "arch": "i686"}
82-
- {"os": "ubuntu", "build": "cp36-manylinux_ppc64le", "arch": "ppc64le"}
83-
- {"os": "ubuntu", "build": "cp36-manylinux_s390x", "arch": "s390x"}
84-
- {"os": "ubuntu", "build": "cp36-manylinux_x86_64", "arch": "x86_64"}
85-
- {"os": "ubuntu", "build": "cp36-musllinux_aarch64", "arch": "aarch64"}
86-
- {"os": "ubuntu", "build": "cp36-musllinux_i686", "arch": "i686"}
87-
- {"os": "ubuntu", "build": "cp36-musllinux_ppc64le", "arch": "ppc64le"}
88-
- {"os": "ubuntu", "build": "cp36-musllinux_s390x", "arch": "s390x"}
89-
- {"os": "ubuntu", "build": "cp36-musllinux_x86_64", "arch": "x86_64"}
79+
- {"os": "macos", "build": "pp39-macosx_x86_64", "arch": "x86_64"}
80+
- {"os": "macos", "build": "pp310-macosx_x86_64", "arch": "x86_64"}
9081
- {"os": "ubuntu", "build": "cp37-manylinux_aarch64", "arch": "aarch64"}
9182
- {"os": "ubuntu", "build": "cp37-manylinux_i686", "arch": "i686"}
9283
- {"os": "ubuntu", "build": "cp37-manylinux_ppc64le", "arch": "ppc64le"}
@@ -137,21 +128,28 @@ jobs:
137128
- {"os": "ubuntu", "build": "cp311-musllinux_ppc64le", "arch": "ppc64le"}
138129
- {"os": "ubuntu", "build": "cp311-musllinux_s390x", "arch": "s390x"}
139130
- {"os": "ubuntu", "build": "cp311-musllinux_x86_64", "arch": "x86_64"}
140-
# Intermittent segfault on pp37-manylinux_aarch64 in test_dicttoolz.py:test_merge_with
131+
- {"os": "ubuntu", "build": "cp312-manylinux_aarch64", "arch": "aarch64"}
132+
- {"os": "ubuntu", "build": "cp312-manylinux_i686", "arch": "i686"}
133+
- {"os": "ubuntu", "build": "cp312-manylinux_ppc64le", "arch": "ppc64le"}
134+
- {"os": "ubuntu", "build": "cp312-manylinux_s390x", "arch": "s390x"}
135+
- {"os": "ubuntu", "build": "cp312-manylinux_x86_64", "arch": "x86_64"}
136+
- {"os": "ubuntu", "build": "cp312-musllinux_aarch64", "arch": "aarch64"}
137+
- {"os": "ubuntu", "build": "cp312-musllinux_i686", "arch": "i686"}
138+
- {"os": "ubuntu", "build": "cp312-musllinux_ppc64le", "arch": "ppc64le"}
139+
- {"os": "ubuntu", "build": "cp312-musllinux_s390x", "arch": "s390x"}
140+
- {"os": "ubuntu", "build": "cp312-musllinux_x86_64", "arch": "x86_64"}
141141
- {"os": "ubuntu", "build": "pp37-manylinux_aarch64", "arch": "aarch64"}
142142
- {"os": "ubuntu", "build": "pp37-manylinux_i686", "arch": "i686"}
143143
- {"os": "ubuntu", "build": "pp37-manylinux_x86_64", "arch": "x86_64"}
144144
- {"os": "ubuntu", "build": "pp38-manylinux_aarch64", "arch": "aarch64"}
145145
- {"os": "ubuntu", "build": "pp38-manylinux_i686", "arch": "i686"}
146146
- {"os": "ubuntu", "build": "pp38-manylinux_x86_64", "arch": "x86_64"}
147-
# - {"os": "ubuntu", "build": "pp39-manylinux_aarch64", "arch": "aarch64"}
148-
# - {"os": "ubuntu", "build": "pp310-manylinux_aarch64", "arch": "aarch64"}
149-
# - {"os": "ubuntu", "build": "pp39-manylinux_i686", "arch": "i686"}
150-
# - {"os": "ubuntu", "build": "pp310-manylinux_i686", "arch": "i686"}
151-
# - {"os": "ubuntu", "build": "pp39-manylinux_x86_64", "arch": "x86_64"}
152-
# - {"os": "ubuntu", "build": "pp310-manylinux_x86_64", "arch": "x86_64"}
153-
- {"os": "windows", "build": "cp36-win32", "arch": "x86"}
154-
- {"os": "windows", "build": "cp36-win_amd64", "arch": "AMD64"}
147+
- {"os": "ubuntu", "build": "pp39-manylinux_aarch64", "arch": "aarch64"}
148+
- {"os": "ubuntu", "build": "pp39-manylinux_i686", "arch": "i686"}
149+
- {"os": "ubuntu", "build": "pp39-manylinux_x86_64", "arch": "x86_64"}
150+
- {"os": "ubuntu", "build": "pp310-manylinux_aarch64", "arch": "aarch64"}
151+
- {"os": "ubuntu", "build": "pp310-manylinux_i686", "arch": "i686"}
152+
- {"os": "ubuntu", "build": "pp310-manylinux_x86_64", "arch": "x86_64"}
155153
- {"os": "windows", "build": "cp37-win32", "arch": "x86"}
156154
- {"os": "windows", "build": "cp37-win_amd64", "arch": "AMD64"}
157155
- {"os": "windows", "build": "cp38-win32", "arch": "x86"}
@@ -162,27 +160,29 @@ jobs:
162160
- {"os": "windows", "build": "cp310-win_amd64", "arch": "AMD64"}
163161
- {"os": "windows", "build": "cp311-win32", "arch": "x86"}
164162
- {"os": "windows", "build": "cp311-win_amd64", "arch": "AMD64"}
163+
- {"os": "windows", "build": "cp312-win32", "arch": "x86"}
164+
- {"os": "windows", "build": "cp312-win_amd64", "arch": "AMD64"}
165165
- {"os": "windows", "build": "pp37-win_amd64", "arch": "AMD64"}
166166
- {"os": "windows", "build": "pp38-win_amd64", "arch": "AMD64"}
167-
# - {"os": "windows", "build": "pp39-win_amd64", "arch": "AMD64"}
168-
# - {"os": "windows", "build": "pp310-win_amd64", "arch": "AMD64"}
167+
- {"os": "windows", "build": "pp39-win_amd64", "arch": "AMD64"}
168+
- {"os": "windows", "build": "pp310-win_amd64", "arch": "AMD64"}
169169

170170
steps:
171171
- name: Setup QEMU
172172
if: ${{ matrix.os == 'ubuntu' }}
173-
uses: docker/setup-qemu-action@v2
173+
uses: docker/setup-qemu-action@v3
174174
with:
175175
platforms: all
176176
- name: Checkout
177-
uses: actions/checkout@v3
177+
uses: actions/checkout@v4
178178
with:
179179
fetch-depth: 0
180180
- name: Set up Python
181-
uses: actions/setup-python@v4
181+
uses: actions/setup-python@v5
182182
with:
183183
python-version: "3.x"
184184
- name: Build wheels
185-
uses: pypa/cibuildwheel@v2.14.1
185+
uses: pypa/cibuildwheel@v2.16.2
186186
env:
187187
CIBW_BUILD: ${{ matrix.build }}
188188
CIBW_ARCHS: ${{ matrix.arch }}
@@ -204,11 +204,11 @@ jobs:
204204
shell: bash -l {0}
205205
steps:
206206
- name: Checkout
207-
uses: actions/checkout@v3
207+
uses: actions/checkout@v4
208208
with:
209209
fetch-depth: 0
210210
- name: Set up Python
211-
uses: actions/setup-python@v4
211+
uses: actions/setup-python@v5
212212
with:
213213
python-version: "3.8"
214214
- name: Install build dependencies
@@ -237,7 +237,7 @@ jobs:
237237
run: |
238238
ls -al dist/
239239
- name: Publish to PyPI
240-
uses: pypa/[email protected].8
240+
uses: pypa/[email protected].11
241241
if: startsWith(github.ref, 'refs/tags/')
242242
with:
243243
user: __token__

Diff for: README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Install
4848
Dependencies
4949
------------
5050

51-
``cytoolz`` supports Python 3.6+ with a common codebase.
51+
``cytoolz`` supports Python 3.7+ with a common codebase.
5252
It is developed in Cython, but requires no dependecies other than CPython
5353
and a C compiler. Like ``toolz``, it is a light weight dependency.
5454

@@ -72,7 +72,7 @@ Community
7272
See our `mailing list <https://groups.google.com/forum/#!forum/pytoolz>`__.
7373
We're friendly.
7474

75-
.. |Build Status| image:: https://travis-ci.org/pytoolz/cytoolz.svg?branch=master
76-
:target: https://travis-ci.org/pytoolz/cytoolz
75+
.. |Build Status| image:: https://github.com/pytoolz/cytoolz/actions/workflows/test.yml/badge.svg?branch=master
76+
:target: https://github.com/pytoolz/cytoolz/actions
7777
.. |Version Status| image:: https://badge.fury.io/py/cytoolz.svg
7878
:target: http://badge.fury.io/py/cytoolz

Diff for: cytoolz/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
functoolz._sigs.update_signature_registry()
2525

2626
# What version of toolz does cytoolz implement?
27-
__toolz_version__ = '0.12.0'
27+
__toolz_version__ = '0.12.1'
2828

2929
from ._version import get_versions
3030

Diff for: cytoolz/tests/test_functoolz.py

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import inspect
2+
import sys
23
import cytoolz
34
from cytoolz.functoolz import (thread_first, thread_last, memoize, curry,
45
compose, compose_left, pipe, complement, do, juxt,
@@ -7,6 +8,12 @@
78
from cytoolz.utils import raises
89
from functools import partial
910

11+
IS_PYPY_GE_39 = (
12+
sys.implementation.name == "pypy"
13+
and sys.version_info.major == 3
14+
and sys.version_info.minor >= 9
15+
)
16+
1017

1118
def iseven(x):
1219
return x % 2 == 0
@@ -253,7 +260,8 @@ def f(x, y):
253260
return x
254261

255262
g = curry(f)
256-
assert g.__doc__ == f.__doc__
263+
if not IS_PYPY_GE_39: # pypy >=3.9 doesn't like __doc__ property
264+
assert g.__doc__ == f.__doc__
257265
assert str(g) == str(f)
258266
assert f(1, 2) == g(1, 2)
259267

@@ -582,14 +590,16 @@ def g(a):
582590

583591
composed = compose(f, g)
584592
assert composed.__name__ == 'f_of_g'
585-
assert composed.__doc__ == 'lambda *args, **kwargs: f(g(*args, **kwargs))'
593+
if not IS_PYPY_GE_39: # pypy >=3.9 doesn't like __doc__ property
594+
assert composed.__doc__ == 'lambda *args, **kwargs: f(g(*args, **kwargs))'
586595

587596
# Create an object with no __name__.
588597
h = object()
589598

590599
composed = compose(f, h)
591600
assert composed.__name__ == 'Compose'
592-
assert composed.__doc__ == 'A composition of functions'
601+
if not IS_PYPY_GE_39: # pypy >=3.9 doesn't like __doc__ property
602+
assert composed.__doc__ == 'A composition of functions'
593603

594604
assert repr(composed) == 'Compose({!r}, {!r})'.format(f, h)
595605

@@ -760,9 +770,10 @@ def handler(e):
760770
assert excepting(3) == -1
761771

762772
assert excepting.__name__ == 'idx_excepting_ValueError'
763-
assert 'idx docstring' in excepting.__doc__
764-
assert 'ValueError' in excepting.__doc__
765-
assert 'handler docstring' in excepting.__doc__
773+
if not IS_PYPY_GE_39: # pypy >=3.9 doesn't like __doc__ property
774+
assert 'idx docstring' in excepting.__doc__
775+
assert 'ValueError' in excepting.__doc__
776+
assert 'handler docstring' in excepting.__doc__
766777

767778
def getzero(a):
768779
"""getzero docstring
@@ -776,9 +787,10 @@ def getzero(a):
776787
assert excepting({0: 1}) == 1
777788

778789
assert excepting.__name__ == 'getzero_excepting_IndexError_or_KeyError'
779-
assert 'getzero docstring' in excepting.__doc__
780-
assert 'return_none' in excepting.__doc__
781-
assert 'Returns None' in excepting.__doc__
790+
if not IS_PYPY_GE_39: # pypy >=3.9 doesn't like __doc__ property
791+
assert 'getzero docstring' in excepting.__doc__
792+
assert 'return_none' in excepting.__doc__
793+
assert 'Returns None' in excepting.__doc__
782794

783795
def raise_(a):
784796
"""A function that raises an instance of the exception type given.

Diff for: cytoolz/tests/test_itertoolz.py

+25
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,34 @@ def test_unique():
106106

107107

108108
def test_isiterable():
109+
# objects that have a __iter__() or __getitem__() method are iterable
110+
# https://docs.python.org/3/library/functions.html#iter
111+
class IterIterable:
112+
def __iter__(self):
113+
return iter(["a", "b", "c"])
114+
115+
class GetItemIterable:
116+
def __getitem__(self, item):
117+
return ["a", "b", "c"][item]
118+
119+
# "if a class sets __iter__() to None, the class is not iterable"
120+
# https://docs.python.org/3/reference/datamodel.html#special-method-names
121+
class NotIterable:
122+
__iter__ = None
123+
124+
class NotIterableEvenWithGetItem:
125+
__iter__ = None
126+
127+
def __getitem__(self, item):
128+
return ["a", "b", "c"][item]
129+
109130
assert isiterable([1, 2, 3]) is True
110131
assert isiterable('abc') is True
132+
assert isiterable(IterIterable()) is True
133+
assert isiterable(GetItemIterable()) is True
111134
assert isiterable(5) is False
135+
assert isiterable(NotIterable()) is False
136+
assert isiterable(NotIterableEvenWithGetItem()) is False
112137

113138

114139
def test_isdistinct():

Diff for: setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@
115115
'Programming Language :: Cython',
116116
'Programming Language :: Python',
117117
'Programming Language :: Python :: 3',
118-
'Programming Language :: Python :: 3.6',
119118
'Programming Language :: Python :: 3.7',
120119
'Programming Language :: Python :: 3.8',
121120
'Programming Language :: Python :: 3.9',
122121
'Programming Language :: Python :: 3.10',
123122
'Programming Language :: Python :: 3.11',
123+
'Programming Language :: Python :: 3.12',
124124
'Programming Language :: Python :: Implementation :: CPython',
125125
'Programming Language :: Python :: Implementation :: PyPy',
126126
'Topic :: Scientific/Engineering',
@@ -132,6 +132,6 @@
132132
],
133133
install_requires=['toolz >= 0.8.0'],
134134
extras_require={'cython': ['cython']},
135-
python_requires=">=3.6",
135+
python_requires=">=3.7",
136136
zip_safe=False,
137137
)

0 commit comments

Comments
 (0)