Skip to content

Commit 5ff1207

Browse files
mayeutrenovate-bot
andauthored
feat: Add support for python 3.12 (#177)
* chore(deps): update all dependencies * fix: replace pkg_resources with importlib.resources pkg_resources is deprecated and would require setuptools to be installed which is not the default with python 3.12. Replace its usage with `importlib.resources` (Python 3.9+) or `importlib_resources` (Python 3.7 & 3.8). * fix: ignore importlib_resources for mypy check * chore: add Python 3.12 trove classifier * chore: add Python 3.12 to noxfile --------- Co-authored-by: Mend Renovate <[email protected]>
1 parent c1cafab commit 5ff1207

File tree

7 files changed

+55
-49
lines changed

7 files changed

+55
-49
lines changed

.github/workflows/presubmit.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88
jobs:
99

1010
mypy:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Set up Python
1515
uses: actions/setup-python@v4
1616
with:
@@ -35,12 +35,12 @@ jobs:
3535
runs-on: ${{ matrix.os }}
3636

3737
steps:
38-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3939
with:
4040
submodules: 'recursive'
4141

4242
- name: Build Wheels
43-
uses: pypa/cibuildwheel@v2.14.1
43+
uses: pypa/cibuildwheel@v2.16.1
4444
env:
4545
# For presubmit, just build / test the most common arch
4646
CIBW_ARCHS: native
@@ -82,7 +82,7 @@ jobs:
8282
runs-on: ${{ matrix.os }}
8383
steps:
8484

85-
- uses: actions/checkout@v3
85+
- uses: actions/checkout@v4
8686
with:
8787
submodules: 'recursive'
8888

@@ -116,7 +116,7 @@ jobs:
116116
make -C build all install
117117
118118
- name: Build Wheels
119-
uses: pypa/cibuildwheel@v2.14.1
119+
uses: pypa/cibuildwheel@v2.16.1
120120
env:
121121
# For presubmit, just build / test the most common arch
122122
CIBW_ARCHS: native
@@ -150,7 +150,7 @@ jobs:
150150

151151
steps:
152152

153-
- uses: actions/checkout@v3
153+
- uses: actions/checkout@v4
154154
with:
155155
submodules: 'recursive'
156156

@@ -203,7 +203,7 @@ jobs:
203203
fi
204204
205205
- name: Build Wheels
206-
uses: pypa/cibuildwheel@v2.14.1
206+
uses: pypa/cibuildwheel@v2.16.1
207207
env:
208208
CIBW_ARCHS_WINDOWS: ${{ steps.platform-arch.outputs.arch }}
209209
# For presubmit, skip build / test for pypy

.github/workflows/python-publish.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
build-source-distribution:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: Set up Python
1818
uses: actions/setup-python@v4
1919
- name: Build
@@ -29,15 +29,15 @@ jobs:
2929
# See: https://github.com/pypa/manylinux/issues/994
3030
name: Build wheels on ubuntu-20.04 - x86_64 - manylinux1
3131

32-
runs-on: ubuntu-20.04
32+
runs-on: ubuntu-22.04
3333

3434
steps:
35-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3636
with:
3737
submodules: 'recursive'
3838

3939
- name: Build Wheels
40-
uses: pypa/cibuildwheel@v2.14.1
40+
uses: pypa/cibuildwheel@v2.16.1
4141
env:
4242
CIBW_ARCHS_LINUX: x86_64
4343
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
@@ -81,17 +81,17 @@ jobs:
8181
runs-on: ${{ matrix.os }}
8282

8383
steps:
84-
- uses: actions/checkout@v3
84+
- uses: actions/checkout@v4
8585
with:
8686
submodules: 'recursive'
8787

8888
- name: Set up QEMU for ARM64 cross compile
8989
if: ${{ matrix.arch }} == 'aarch64'
9090
id: qemu
91-
uses: docker/setup-qemu-action@v2
91+
uses: docker/setup-qemu-action@v3
9292

9393
- name: Build Wheels
94-
uses: pypa/cibuildwheel@v2.14.1
94+
uses: pypa/cibuildwheel@v2.16.1
9595
env:
9696
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
9797
CIBW_ENVIRONMENT: >
@@ -131,7 +131,7 @@ jobs:
131131
runs-on: ${{ matrix.os }}
132132
steps:
133133

134-
- uses: actions/checkout@v3
134+
- uses: actions/checkout@v4
135135
with:
136136
submodules: 'recursive'
137137

@@ -164,7 +164,7 @@ jobs:
164164
make -C build all install
165165
166166
- name: Build Wheels
167-
uses: pypa/cibuildwheel@v2.14.1
167+
uses: pypa/cibuildwheel@v2.16.1
168168
env:
169169
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
170170
CIBW_ENVIRONMENT: >
@@ -194,7 +194,7 @@ jobs:
194194

195195
steps:
196196

197-
- uses: actions/checkout@v3
197+
- uses: actions/checkout@v4
198198
with:
199199
submodules: 'recursive'
200200

@@ -238,7 +238,7 @@ jobs:
238238
fi
239239
240240
- name: Build Wheels
241-
uses: pypa/cibuildwheel@v2.14.1
241+
uses: pypa/cibuildwheel@v2.16.1
242242
env:
243243
CIBW_ARCHS_WINDOWS: ${{ steps.platform-arch.outputs.arch }}
244244
CIBW_ENVIRONMENT: >

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
HERE = os.path.dirname(__file__)
2626

27-
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
27+
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
2828
def build_libcrc32c(session):
2929
session.env["PY_BIN"] = f"python{session.python}"
3030
session.env["REPO_ROOT"] = HERE
@@ -39,7 +39,7 @@ def build_libcrc32c(session):
3939
raise Exception("Unsupported")
4040

4141

42-
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
42+
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
4343
def check(session):
4444
session.install("pytest")
4545
session.install("--no-index", f"--find-links={HERE}/wheels", "google-crc32c")

scripts/requirements.txt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@
44
#
55
# pip-compile --allow-unsafe --generate-hashes requirements.in
66
#
7-
cmake==3.27.0 \
8-
--hash=sha256:073e4f196d0888216e6794c08cd984ddabc108c0e4e66f48fbd7610d1e6d726d \
9-
--hash=sha256:199bfaefb752e82d8067aeee5d6a6e0414fe0d60e9a3fd08e95d537a97e0db16 \
10-
--hash=sha256:1b3189171665f5c8d748ae7fe10a29fff1ebeedeaef57b16f1ea54b1ec0fe514 \
11-
--hash=sha256:1f38d87b2c65763a0113f4a6c652e6f4b5adf90b384c1e1d69e4f8a3104a57d6 \
12-
--hash=sha256:35a8d397ce883e93b5e6561e2803ce9470df52283862264093c1078530f98189 \
13-
--hash=sha256:48be3afe62c9513a49be007896a4058fafec512cb1f269a50126da30aacad97f \
14-
--hash=sha256:5561aca62b65aac844f3931e74cfeb696e4534de145e3307bf942e735736541e \
15-
--hash=sha256:58a3f39d3d1bc897f05e531bfa676246a2b25d424c6a47e4b6bbc193fb560db7 \
16-
--hash=sha256:6f46a170b0c9c552d52da4346534570f818195dfc4f1d0c03264e24cc348fc60 \
17-
--hash=sha256:8745eff805f36762d3e8e904698b853cb4a9da8b4b07d1c12bcd1e1a6c4a1709 \
18-
--hash=sha256:9740ed9f61a3bd8708a41cadd5c057c04f38e5b89bd773e369df2e210a1c55a3 \
19-
--hash=sha256:9ccab4cd93578d3c2df32e66b44b313b75a7484032645040431dc06a583ca4aa \
20-
--hash=sha256:b470ccd3f86cf19a63f6b221c9cceebcc58e32d3787d0d5f9f43d1d91a095090 \
21-
--hash=sha256:b9d5811954dcedcaa6c915c4a9bb6d64b55ac189e9cbc74be726307d9d084804 \
22-
--hash=sha256:c4c968c188e7518deb463a14e64f3a19f242c9dcf7f24e1dbcc1419690cd54e0 \
23-
--hash=sha256:d03f0a76a2b96805044ad1178b92aeeb5f695caa6776a32522bb5c430a55b4e8 \
24-
--hash=sha256:e58e48643903e6fad76274337f9a4d3c575b8e21cd05c6214780b2c98bb0c706
7+
cmake==3.27.5 \
8+
--hash=sha256:000efab194567cbd5c7f1cb0e839c57b44db01f218f4d318ee5eac0ec72dbd90 \
9+
--hash=sha256:014badd3ad7b0bd55ed81d8b60bf435ef2a382e9ad0f03340fea2bb41620b9af \
10+
--hash=sha256:101d4e56154658c974e9425acd31f0fedde3ce68b47263fd14f789b028f8a13a \
11+
--hash=sha256:14acb1954b1ec0b398fb5265bc9e9b8785dffc6c3686d031bd1758ca23293162 \
12+
--hash=sha256:256ba48b86bb63bcb61db6de27a5458d66857b10902d8f942e8d3432a58939b4 \
13+
--hash=sha256:3c93abd817848f81f992cd2c53c9397a353625de2af27b14b23761e5cce99c5d \
14+
--hash=sha256:49307970589b2202bd528317a7a4a52bb6e6debca4f4c28e192a6b4965f47687 \
15+
--hash=sha256:49385eda22f5b94ffb00c2251a76f4c1d5b5aedf737767e7c44f75b4a1fdd426 \
16+
--hash=sha256:9229170107c5bfadba32cd25c7c6ee5b936649a36c53247d41a39bcdfdcd55d6 \
17+
--hash=sha256:9ef2b45834e3777ddbb477d21784ffdbe4f09a3d0e0883b55fea0c4cadd6038e \
18+
--hash=sha256:a941c9dc0fda65e2b7cf2657f87802702fd28e677991d629b58a00cced3bed08 \
19+
--hash=sha256:bc784f6a0f07f517323e1fa2b005302ed8e90d3044a89a1b4b9b1962df2053ed \
20+
--hash=sha256:ec338a489a80feaf8adfe9bb92eaba93318407ae6088a6dad7896aba0dd698cf \
21+
--hash=sha256:f47117376ccea3189628a911666a7e23e09efae26c124aebe8f0aa139000dc73 \
22+
--hash=sha256:f510aa3bc6b2c0b8fb51f22209359a6da7544f668629b01544a5b991cdec82ee \
23+
--hash=sha256:fa55547922e5dbe0f1edb6d4d23d78feab39366a0507e9eb5f9300f5d6010ab6 \
24+
--hash=sha256:fc15d514587e6bae7c3b6616d1eb2792548d34e6910490e20065378b3cd1019e
2525
# via -r requirements.in
26-
wheel==0.41.0 \
27-
--hash=sha256:55a0f0a5a84869bce5ba775abfd9c462e3a6b1b7b7ec69d72c0b83d673a5114d \
28-
--hash=sha256:7e9be3bbd0078f6147d82ed9ed957e323e7708f57e134743d2edef3a7b7972a9
26+
wheel==0.41.2 \
27+
--hash=sha256:0c5ac5ff2afb79ac23ab82bab027a0be7b5dbcf2e54dc50efe4bf507de1f7985 \
28+
--hash=sha256:75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8
2929
# via -r requirements.in
3030

3131
# The following packages are considered to be unsafe in a requirements file:
3232
pip==23.3 \
3333
--hash=sha256:bb7d4f69f488432e4e96394612f43ab43dd478d073ef7422604a570f7157561e \
3434
--hash=sha256:bc38bb52bc286514f8f7cb3a1ba5ed100b76aaef29b521d48574329331c5ae7b
3535
# via -r requirements.in
36-
setuptools==68.0.0 \
37-
--hash=sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f \
38-
--hash=sha256:baf1fdb41c6da4cd2eae722e135500da913332ab3f2f5c7d33af9b492acb5235
36+
setuptools==68.2.2 \
37+
--hash=sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87 \
38+
--hash=sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a
3939
# via -r requirements.in

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ classifiers =
3535
Programming Language :: Python :: 3.9
3636
Programming Language :: Python :: 3.10
3737
Programming Language :: Python :: 3.11
38+
Programming Language :: Python :: 3.12
3839

3940
[options]
4041
zip_safe = True

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def build_c_extension():
107107
package_dir={"": "src"},
108108
ext_modules=[module],
109109
cmdclass={"build_ext": BuildExtWithDLL},
110+
install_requires=["importlib_resources>=1.3 ; python_version < '3.9' and os_name == 'nt'"],
110111
)
111112

112113

src/google_crc32c/__config__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
import os
1616
import sys
1717

18-
import pkg_resources
19-
2018

2119
def modify_path():
2220
"""Modify the module search path."""
@@ -29,9 +27,15 @@ def modify_path():
2927
return
3028

3129
try:
32-
extra_dll_dir = pkg_resources.resource_filename("google_crc32c", "extra-dll")
30+
try:
31+
# Python 3.9+
32+
from importlib.resources import files as _resources_files
33+
except ImportError:
34+
# Python 3.7 & 3.8
35+
from importlib_resources import files as _resources_files # type: ignore
36+
extra_dll_dir = str(_resources_files("google_crc32c") / "extra-dll")
3337
if os.path.isdir(extra_dll_dir):
34-
# Python 3.6, 3.7 use path
38+
# Python 3.7 use path
3539
os.environ["PATH"] = path + os.pathsep + extra_dll_dir
3640
# Python 3.8+ uses add_dll_directory.
3741
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:

0 commit comments

Comments
 (0)