Skip to content

feat: Add support for python 3.12 #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
jobs:

mypy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -35,12 +35,12 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
# For presubmit, just build / test the most common arch
CIBW_ARCHS: native
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
make -C build all install

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
# For presubmit, just build / test the most common arch
CIBW_ARCHS: native
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
fi

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
CIBW_ARCHS_WINDOWS: ${{ steps.platform-arch.outputs.arch }}
# For presubmit, skip build / test for pypy
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build-source-distribution:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
- name: Build
Expand All @@ -29,15 +29,15 @@ jobs:
# See: https://github.com/pypa/manylinux/issues/994
name: Build wheels on ubuntu-20.04 - x86_64 - manylinux1

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
Expand Down Expand Up @@ -81,17 +81,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

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

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ENVIRONMENT: >
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
make -C build all install

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_ENVIRONMENT: >
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down Expand Up @@ -238,7 +238,7 @@ jobs:
fi

- name: Build Wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.1
env:
CIBW_ARCHS_WINDOWS: ${{ steps.platform-arch.outputs.arch }}
CIBW_ENVIRONMENT: >
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

HERE = os.path.dirname(__file__)

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


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
def check(session):
session.install("pytest")
session.install("--no-index", f"--find-links={HERE}/wheels", "google-crc32c")
Expand Down
48 changes: 24 additions & 24 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@
#
# pip-compile --allow-unsafe --generate-hashes requirements.in
#
cmake==3.27.0 \
--hash=sha256:073e4f196d0888216e6794c08cd984ddabc108c0e4e66f48fbd7610d1e6d726d \
--hash=sha256:199bfaefb752e82d8067aeee5d6a6e0414fe0d60e9a3fd08e95d537a97e0db16 \
--hash=sha256:1b3189171665f5c8d748ae7fe10a29fff1ebeedeaef57b16f1ea54b1ec0fe514 \
--hash=sha256:1f38d87b2c65763a0113f4a6c652e6f4b5adf90b384c1e1d69e4f8a3104a57d6 \
--hash=sha256:35a8d397ce883e93b5e6561e2803ce9470df52283862264093c1078530f98189 \
--hash=sha256:48be3afe62c9513a49be007896a4058fafec512cb1f269a50126da30aacad97f \
--hash=sha256:5561aca62b65aac844f3931e74cfeb696e4534de145e3307bf942e735736541e \
--hash=sha256:58a3f39d3d1bc897f05e531bfa676246a2b25d424c6a47e4b6bbc193fb560db7 \
--hash=sha256:6f46a170b0c9c552d52da4346534570f818195dfc4f1d0c03264e24cc348fc60 \
--hash=sha256:8745eff805f36762d3e8e904698b853cb4a9da8b4b07d1c12bcd1e1a6c4a1709 \
--hash=sha256:9740ed9f61a3bd8708a41cadd5c057c04f38e5b89bd773e369df2e210a1c55a3 \
--hash=sha256:9ccab4cd93578d3c2df32e66b44b313b75a7484032645040431dc06a583ca4aa \
--hash=sha256:b470ccd3f86cf19a63f6b221c9cceebcc58e32d3787d0d5f9f43d1d91a095090 \
--hash=sha256:b9d5811954dcedcaa6c915c4a9bb6d64b55ac189e9cbc74be726307d9d084804 \
--hash=sha256:c4c968c188e7518deb463a14e64f3a19f242c9dcf7f24e1dbcc1419690cd54e0 \
--hash=sha256:d03f0a76a2b96805044ad1178b92aeeb5f695caa6776a32522bb5c430a55b4e8 \
--hash=sha256:e58e48643903e6fad76274337f9a4d3c575b8e21cd05c6214780b2c98bb0c706
cmake==3.27.5 \
--hash=sha256:000efab194567cbd5c7f1cb0e839c57b44db01f218f4d318ee5eac0ec72dbd90 \
--hash=sha256:014badd3ad7b0bd55ed81d8b60bf435ef2a382e9ad0f03340fea2bb41620b9af \
--hash=sha256:101d4e56154658c974e9425acd31f0fedde3ce68b47263fd14f789b028f8a13a \
--hash=sha256:14acb1954b1ec0b398fb5265bc9e9b8785dffc6c3686d031bd1758ca23293162 \
--hash=sha256:256ba48b86bb63bcb61db6de27a5458d66857b10902d8f942e8d3432a58939b4 \
--hash=sha256:3c93abd817848f81f992cd2c53c9397a353625de2af27b14b23761e5cce99c5d \
--hash=sha256:49307970589b2202bd528317a7a4a52bb6e6debca4f4c28e192a6b4965f47687 \
--hash=sha256:49385eda22f5b94ffb00c2251a76f4c1d5b5aedf737767e7c44f75b4a1fdd426 \
--hash=sha256:9229170107c5bfadba32cd25c7c6ee5b936649a36c53247d41a39bcdfdcd55d6 \
--hash=sha256:9ef2b45834e3777ddbb477d21784ffdbe4f09a3d0e0883b55fea0c4cadd6038e \
--hash=sha256:a941c9dc0fda65e2b7cf2657f87802702fd28e677991d629b58a00cced3bed08 \
--hash=sha256:bc784f6a0f07f517323e1fa2b005302ed8e90d3044a89a1b4b9b1962df2053ed \
--hash=sha256:ec338a489a80feaf8adfe9bb92eaba93318407ae6088a6dad7896aba0dd698cf \
--hash=sha256:f47117376ccea3189628a911666a7e23e09efae26c124aebe8f0aa139000dc73 \
--hash=sha256:f510aa3bc6b2c0b8fb51f22209359a6da7544f668629b01544a5b991cdec82ee \
--hash=sha256:fa55547922e5dbe0f1edb6d4d23d78feab39366a0507e9eb5f9300f5d6010ab6 \
--hash=sha256:fc15d514587e6bae7c3b6616d1eb2792548d34e6910490e20065378b3cd1019e
# via -r requirements.in
wheel==0.41.0 \
--hash=sha256:55a0f0a5a84869bce5ba775abfd9c462e3a6b1b7b7ec69d72c0b83d673a5114d \
--hash=sha256:7e9be3bbd0078f6147d82ed9ed957e323e7708f57e134743d2edef3a7b7972a9
wheel==0.41.2 \
--hash=sha256:0c5ac5ff2afb79ac23ab82bab027a0be7b5dbcf2e54dc50efe4bf507de1f7985 \
--hash=sha256:75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8
# via -r requirements.in

# The following packages are considered to be unsafe in a requirements file:
pip==23.3 \
--hash=sha256:bb7d4f69f488432e4e96394612f43ab43dd478d073ef7422604a570f7157561e \
--hash=sha256:bc38bb52bc286514f8f7cb3a1ba5ed100b76aaef29b521d48574329331c5ae7b
# via -r requirements.in
setuptools==68.0.0 \
--hash=sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f \
--hash=sha256:baf1fdb41c6da4cd2eae722e135500da913332ab3f2f5c7d33af9b492acb5235
setuptools==68.2.2 \
--hash=sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87 \
--hash=sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a
# via -r requirements.in
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12

[options]
zip_safe = True
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def build_c_extension():
package_dir={"": "src"},
ext_modules=[module],
cmdclass={"build_ext": BuildExtWithDLL},
install_requires=["importlib_resources>=1.3 ; python_version < '3.9' and os_name == 'nt'"],
)


Expand Down
12 changes: 8 additions & 4 deletions src/google_crc32c/__config__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import os
import sys

import pkg_resources


def modify_path():
"""Modify the module search path."""
Expand All @@ -29,9 +27,15 @@ def modify_path():
return

try:
extra_dll_dir = pkg_resources.resource_filename("google_crc32c", "extra-dll")
try:
# Python 3.9+
from importlib.resources import files as _resources_files
except ImportError:
# Python 3.7 & 3.8
from importlib_resources import files as _resources_files # type: ignore
extra_dll_dir = str(_resources_files("google_crc32c") / "extra-dll")
if os.path.isdir(extra_dll_dir):
# Python 3.6, 3.7 use path
# Python 3.7 use path
os.environ["PATH"] = path + os.pathsep + extra_dll_dir
# Python 3.8+ uses add_dll_directory.
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
Expand Down