Skip to content

Commit

Permalink
Add Python 3.12 release (#807)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Tombana authored Jun 20, 2024
1 parent 75e1d37 commit 44f66a9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12
- uses: actions/cache@v4
id: cache
with:
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12
- uses: actions/cache@v4
id: cache
with:
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
runs-on: macos-13
strategy:
matrix:
python-version: ["3.10", 3.11]
python-version: ["3.10", 3.11, 3.12]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand All @@ -151,7 +151,9 @@ jobs:
- name: Build macOS wheels
run: |
python --version
python -m pip install delocate wheel setuptools numpy six --no-cache-dir
python -m pip install delocate wheel setuptools numpy six pip-tools --no-cache-dir
# This is needed because the requirements are different on every OS and Python version
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
./configure.py
# This matches `release_macox_x86` in .tensorflow.bazelrc
Expand Down Expand Up @@ -182,7 +184,7 @@ jobs:
runs-on: macos-14
strategy:
matrix:
python-version: ["3.10", 3.11]
python-version: ["3.10", 3.11, 3.12]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand All @@ -196,7 +198,9 @@ jobs:
- name: Build macOS wheels
run: |
python --version
python -m pip install delocate wheel setuptools numpy six --no-cache-dir
python -m pip install delocate wheel setuptools numpy six pip-tools --no-cache-dir
# This is needed because the requirements are different on every OS and Python version
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
./configure.py
# This matches `release_macox_arm64` in .tensorflow.bazelrc
Expand Down Expand Up @@ -227,7 +231,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", 3.11]
python-version: ["3.10", 3.11, 3.12]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand All @@ -238,6 +242,11 @@ jobs:
continue-on-error: true
with:
credentials_json: ${{ secrets.gcs_bazel_cache }}
- name: Generate requirements.txt
run: |
python -m pip install pip-tools --no-cache-dir
# This is needed because the requirements are different on every OS and Python version
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
- name: Build manylinux2014 wheels
run: |
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
Expand Down Expand Up @@ -272,7 +281,7 @@ jobs:
runs-on: windows-2019
strategy:
matrix:
python-version: ["3.10", 3.11]
python-version: ["3.10", 3.11, 3.12]
fail-fast: false
steps:
- name: Configure Pagefile
Expand Down Expand Up @@ -301,7 +310,7 @@ jobs:
python --version
python -m pip install wheel setuptools numpy six pip-tools --no-cache-dir
# This is needed because the requirements on windows are different than on other systems
# This is needed because the requirements are different on every OS and Python version
pip-compile --strip-extras --no-emit-index-url --allow-unsafe larq_compute_engine/requirements.in
# Fix for path length limit: replace workspace name by 'lce'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true

env:
TF_PYTHON_VERSION: "3.11"
TF_PYTHON_VERSION: "3.12"

jobs:
TFLite:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
fi
shell: bash
- name: Run Interpreter test
run: bazelisk test larq_compute_engine/tflite/tests:interpreter_test --test_output=all
run: bazelisk test larq_compute_engine/tflite/tests:interpreter_test --test_output=all --test_env=TF_USE_LEGACY_KERAS=1
- name: Run FileCheck tests
run: bazelisk test larq_compute_engine/mlir/tests:all --test_output=all
- name: Run End2End tests
Expand All @@ -76,8 +76,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
tf-version: [2.5.3, 2.6.5, 2.7.4, 2.8.4, 2.9.3, 2.10.1, 2.11.0]
python-version: [3.9]
tf-version: [2.8.4, 2.9.3, 2.10.1, 2.11.0]
python-version: ["3.10"]
flatbuffers-version: [2.0]
protobuf-version: [3.19.6]
include:
Expand All @@ -86,7 +86,7 @@ jobs:
flatbuffers-version: 23.1.21
protobuf-version: 4.23.4
- tf-version: 2.16.1
python-version: 3.11
python-version: 3.12
flatbuffers-version: 24.3.25
protobuf-version: 4.25.3
if: "!contains(github.event.head_commit.message, 'ci-skip')"
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12
- uses: actions/cache@v4
id: cache
with:
Expand Down
16 changes: 6 additions & 10 deletions larq_compute_engine/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --allow-unsafe --no-emit-index-url --strip-extras larq_compute_engine/requirements.in
Expand Down Expand Up @@ -27,12 +27,10 @@ dm-tree==0.1.8
# via tensorflow-datasets
docstring-parser==0.16
# via simple-parsing
etils==1.7.0
etils==1.9.2
# via
# array-record
# tensorflow-datasets
exceptiongroup==1.2.1
# via pytest
flatbuffers==24.3.25
# via tensorflow
fsspec==2024.6.0
Expand All @@ -42,7 +40,9 @@ gast==0.5.4
google-pasta==0.2.0
# via tensorflow
googleapis-common-protos==1.63.1
# via -r larq_compute_engine/requirements.in
# via
# -r larq_compute_engine/requirements.in
# tensorflow-metadata
grpcio==1.64.1
# via
# tensorboard
Expand Down Expand Up @@ -104,7 +104,7 @@ pluggy==1.5.0
# via pytest
promise==2.3
# via tensorflow-datasets
protobuf==3.20.3
protobuf==4.25.3
# via
# googleapis-common-protos
# tensorboard
Expand Down Expand Up @@ -144,8 +144,6 @@ tensorflow==2.16.1
# tf-keras
tensorflow-datasets==4.9.6
# via -r larq_compute_engine/requirements.in
tensorflow-io-gcs-filesystem==0.37.0
# via tensorflow
tensorflow-metadata==1.15.0
# via tensorflow-datasets
termcolor==2.4.0
Expand All @@ -158,8 +156,6 @@ tf-keras==2.16.0
# via -r larq_compute_engine/requirements.in
toml==0.10.2
# via tensorflow-datasets
tomli==2.0.1
# via pytest
tqdm==4.66.4
# via
# -r larq_compute_engine/requirements.in
Expand Down
1 change: 1 addition & 0 deletions larq_compute_engine/tflite/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ py_test(
tf_requirement("numpy"),
lce_requirement("pytest"),
lce_requirement("tensorflow"),
lce_requirement("tf-keras"),
],
)

Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Setup for pip package."""

import os
from sys import platform

Expand Down Expand Up @@ -30,7 +31,7 @@ def get_version_number(default):
setup(
name="larq-compute-engine",
version=get_version_number(default="0.13.0"),
python_requires=">=3.9",
python_requires=">=3.10",
description="Highly optimized inference engine for binarized neural networks.",
long_description=readme(),
long_description_content_type="text/markdown",
Expand All @@ -41,8 +42,8 @@ def get_version_number(default):
url="https://larq.dev/",
install_requires=["flatbuffers>=2.0", "tqdm>=4"],
extras_require={
"tensorflow": ["tensorflow>=1.14"],
"tensorflow_gpu": ["tensorflow-gpu>=1.14"],
"tensorflow": ["tensorflow>=2.8"],
"tensorflow_gpu": ["tensorflow-gpu>=2.8"],
},
include_package_data=True,
zip_safe=False,
Expand All @@ -55,9 +56,9 @@ def get_version_number(default):
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
Expand Down

0 comments on commit 44f66a9

Please sign in to comment.