Skip to content

Commit 44f66a9

Browse files
authored
Add Python 3.12 release (#807)
* Add Python 3.12 release Use Python 3.12 in regular CI * Fix test with TF_USE_LEGACY_KERAS * Use Python 3.12 to generate requirements.txt * Generate requirements.txt for each platform
1 parent 75e1d37 commit 44f66a9

File tree

5 files changed

+36
-29
lines changed

5 files changed

+36
-29
lines changed

.github/workflows/release.yml

+18-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-python@v5
2424
with:
25-
python-version: 3.9
25+
python-version: 3.12
2626
- uses: actions/cache@v4
2727
id: cache
2828
with:
@@ -94,7 +94,7 @@ jobs:
9494
fetch-depth: 0
9595
- uses: actions/setup-python@v5
9696
with:
97-
python-version: 3.9
97+
python-version: 3.12
9898
- uses: actions/cache@v4
9999
id: cache
100100
with:
@@ -137,7 +137,7 @@ jobs:
137137
runs-on: macos-13
138138
strategy:
139139
matrix:
140-
python-version: ["3.10", 3.11]
140+
python-version: ["3.10", 3.11, 3.12]
141141
fail-fast: false
142142
steps:
143143
- uses: actions/checkout@v4
@@ -151,7 +151,9 @@ jobs:
151151
- name: Build macOS wheels
152152
run: |
153153
python --version
154-
python -m pip install delocate wheel setuptools numpy six --no-cache-dir
154+
python -m pip install delocate wheel setuptools numpy six pip-tools --no-cache-dir
155+
# This is needed because the requirements are different on every OS and Python version
156+
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
155157
156158
./configure.py
157159
# This matches `release_macox_x86` in .tensorflow.bazelrc
@@ -182,7 +184,7 @@ jobs:
182184
runs-on: macos-14
183185
strategy:
184186
matrix:
185-
python-version: ["3.10", 3.11]
187+
python-version: ["3.10", 3.11, 3.12]
186188
fail-fast: false
187189
steps:
188190
- uses: actions/checkout@v4
@@ -196,7 +198,9 @@ jobs:
196198
- name: Build macOS wheels
197199
run: |
198200
python --version
199-
python -m pip install delocate wheel setuptools numpy six --no-cache-dir
201+
python -m pip install delocate wheel setuptools numpy six pip-tools --no-cache-dir
202+
# This is needed because the requirements are different on every OS and Python version
203+
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
200204
201205
./configure.py
202206
# This matches `release_macox_arm64` in .tensorflow.bazelrc
@@ -227,7 +231,7 @@ jobs:
227231
runs-on: ubuntu-latest
228232
strategy:
229233
matrix:
230-
python-version: ["3.10", 3.11]
234+
python-version: ["3.10", 3.11, 3.12]
231235
fail-fast: false
232236
steps:
233237
- uses: actions/checkout@v4
@@ -238,6 +242,11 @@ jobs:
238242
continue-on-error: true
239243
with:
240244
credentials_json: ${{ secrets.gcs_bazel_cache }}
245+
- name: Generate requirements.txt
246+
run: |
247+
python -m pip install pip-tools --no-cache-dir
248+
# This is needed because the requirements are different on every OS and Python version
249+
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
241250
- name: Build manylinux2014 wheels
242251
run: |
243252
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
@@ -272,7 +281,7 @@ jobs:
272281
runs-on: windows-2019
273282
strategy:
274283
matrix:
275-
python-version: ["3.10", 3.11]
284+
python-version: ["3.10", 3.11, 3.12]
276285
fail-fast: false
277286
steps:
278287
- name: Configure Pagefile
@@ -301,7 +310,7 @@ jobs:
301310
302311
python --version
303312
python -m pip install wheel setuptools numpy six pip-tools --no-cache-dir
304-
# This is needed because the requirements on windows are different than on other systems
313+
# This is needed because the requirements are different on every OS and Python version
305314
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
306315
307316
# Fix for path length limit: replace workspace name by 'lce'

.github/workflows/unittests.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
env:
14-
TF_PYTHON_VERSION: "3.11"
14+
TF_PYTHON_VERSION: "3.12"
1515

1616
jobs:
1717
TFLite:
@@ -64,7 +64,7 @@ jobs:
6464
fi
6565
shell: bash
6666
- name: Run Interpreter test
67-
run: bazelisk test larq_compute_engine/tflite/tests:interpreter_test --test_output=all
67+
run: bazelisk test larq_compute_engine/tflite/tests:interpreter_test --test_output=all --test_env=TF_USE_LEGACY_KERAS=1
6868
- name: Run FileCheck tests
6969
run: bazelisk test larq_compute_engine/mlir/tests:all --test_output=all
7070
- name: Run End2End tests
@@ -76,8 +76,8 @@ jobs:
7676
runs-on: ubuntu-latest
7777
strategy:
7878
matrix:
79-
tf-version: [2.5.3, 2.6.5, 2.7.4, 2.8.4, 2.9.3, 2.10.1, 2.11.0]
80-
python-version: [3.9]
79+
tf-version: [2.8.4, 2.9.3, 2.10.1, 2.11.0]
80+
python-version: ["3.10"]
8181
flatbuffers-version: [2.0]
8282
protobuf-version: [3.19.6]
8383
include:
@@ -86,7 +86,7 @@ jobs:
8686
flatbuffers-version: 23.1.21
8787
protobuf-version: 4.23.4
8888
- tf-version: 2.16.1
89-
python-version: 3.11
89+
python-version: 3.12
9090
flatbuffers-version: 24.3.25
9191
protobuf-version: 4.25.3
9292
if: "!contains(github.event.head_commit.message, 'ci-skip')"
@@ -119,7 +119,7 @@ jobs:
119119
fetch-depth: 0
120120
- uses: actions/setup-python@v5
121121
with:
122-
python-version: 3.9
122+
python-version: 3.12
123123
- uses: actions/cache@v4
124124
id: cache
125125
with:

larq_compute_engine/requirements.txt

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.10
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile --allow-unsafe --no-emit-index-url --strip-extras larq_compute_engine/requirements.in
@@ -27,12 +27,10 @@ dm-tree==0.1.8
2727
# via tensorflow-datasets
2828
docstring-parser==0.16
2929
# via simple-parsing
30-
etils==1.7.0
30+
etils==1.9.2
3131
# via
3232
# array-record
3333
# tensorflow-datasets
34-
exceptiongroup==1.2.1
35-
# via pytest
3634
flatbuffers==24.3.25
3735
# via tensorflow
3836
fsspec==2024.6.0
@@ -42,7 +40,9 @@ gast==0.5.4
4240
google-pasta==0.2.0
4341
# via tensorflow
4442
googleapis-common-protos==1.63.1
45-
# via -r larq_compute_engine/requirements.in
43+
# via
44+
# -r larq_compute_engine/requirements.in
45+
# tensorflow-metadata
4646
grpcio==1.64.1
4747
# via
4848
# tensorboard
@@ -104,7 +104,7 @@ pluggy==1.5.0
104104
# via pytest
105105
promise==2.3
106106
# via tensorflow-datasets
107-
protobuf==3.20.3
107+
protobuf==4.25.3
108108
# via
109109
# googleapis-common-protos
110110
# tensorboard
@@ -144,8 +144,6 @@ tensorflow==2.16.1
144144
# tf-keras
145145
tensorflow-datasets==4.9.6
146146
# via -r larq_compute_engine/requirements.in
147-
tensorflow-io-gcs-filesystem==0.37.0
148-
# via tensorflow
149147
tensorflow-metadata==1.15.0
150148
# via tensorflow-datasets
151149
termcolor==2.4.0
@@ -158,8 +156,6 @@ tf-keras==2.16.0
158156
# via -r larq_compute_engine/requirements.in
159157
toml==0.10.2
160158
# via tensorflow-datasets
161-
tomli==2.0.1
162-
# via pytest
163159
tqdm==4.66.4
164160
# via
165161
# -r larq_compute_engine/requirements.in

larq_compute_engine/tflite/tests/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ py_test(
8787
tf_requirement("numpy"),
8888
lce_requirement("pytest"),
8989
lce_requirement("tensorflow"),
90+
lce_requirement("tf-keras"),
9091
],
9192
)
9293

setup.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Setup for pip package."""
2+
23
import os
34
from sys import platform
45

@@ -30,7 +31,7 @@ def get_version_number(default):
3031
setup(
3132
name="larq-compute-engine",
3233
version=get_version_number(default="0.13.0"),
33-
python_requires=">=3.9",
34+
python_requires=">=3.10",
3435
description="Highly optimized inference engine for binarized neural networks.",
3536
long_description=readme(),
3637
long_description_content_type="text/markdown",
@@ -41,8 +42,8 @@ def get_version_number(default):
4142
url="https://larq.dev/",
4243
install_requires=["flatbuffers>=2.0", "tqdm>=4"],
4344
extras_require={
44-
"tensorflow": ["tensorflow>=1.14"],
45-
"tensorflow_gpu": ["tensorflow-gpu>=1.14"],
45+
"tensorflow": ["tensorflow>=2.8"],
46+
"tensorflow_gpu": ["tensorflow-gpu>=2.8"],
4647
},
4748
include_package_data=True,
4849
zip_safe=False,
@@ -55,9 +56,9 @@ def get_version_number(default):
5556
"License :: OSI Approved :: Apache Software License",
5657
"Programming Language :: Python :: 3",
5758
"Programming Language :: Python :: 3 :: Only",
58-
"Programming Language :: Python :: 3.9",
5959
"Programming Language :: Python :: 3.10",
6060
"Programming Language :: Python :: 3.11",
61+
"Programming Language :: Python :: 3.12",
6162
"Topic :: Scientific/Engineering",
6263
"Topic :: Scientific/Engineering :: Mathematics",
6364
"Topic :: Scientific/Engineering :: Artificial Intelligence",

0 commit comments

Comments
 (0)