Skip to content

Commit

Permalink
feat: adding support for python3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
bcm-at-zama committed Aug 27, 2024
1 parent dffbfa3 commit 6e3d8da
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 13 deletions.
52 changes: 48 additions & 4 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ on:
- pr

linux_python_versions:
description: "Space separated list of python versions (3.8, 3.9, 3.10 are supported) to launch on linux"
description: "Space separated list of python versions (3.8, 3.9, 3.10, 3.11 are supported) to launch on linux"
required: false
type: string
default: "3.8"

macos_python_versions:
description: "Space separated list of python versions (3.8, 3.9, 3.10 are supported) to launch on macos (intel)"
description: "Space separated list of python versions (3.8, 3.9, 3.10, 3.11 are supported) to launch on macos (intel)"
required: false
type: string
default: "3.8"
Expand Down Expand Up @@ -109,6 +109,7 @@ jobs:
needs-38-linux-runner: ${{ steps.set-matrix.outputs.needs-38-linux-runner }}
needs-39-linux-runner: ${{ steps.set-matrix.outputs.needs-39-linux-runner }}
needs-310-linux-runner: ${{ steps.set-matrix.outputs.needs-310-linux-runner }}
needs-311-linux-runner: ${{ steps.set-matrix.outputs.needs-311-linux-runner }}
instance-type: ${{ steps.set-matrix.outputs.instance-type }}
linux-python-versions: ${{ steps.set-matrix.outputs.linux-python-versions }}
macos-python-versions: ${{ steps.set-matrix.outputs.macos-python-versions }}
Expand Down Expand Up @@ -157,10 +158,10 @@ jobs:
LINUX_PYTHON_VERSIONS="3.8"
MACOS_PYTHON_VERSIONS=""
elif [[ "${BUILD_TYPE}" == "weekly" ]]; then
LINUX_PYTHON_VERSIONS="3.8 3.9 3.10"
LINUX_PYTHON_VERSIONS="3.8 3.9 3.10 3.11"
MACOS_PYTHON_VERSIONS="3.9"
elif [[ "${BUILD_TYPE}" == "release" ]] || [[ "${BUILD_TYPE}" == "published_release" ]]; then
LINUX_PYTHON_VERSIONS="3.8 3.9 3.10"
LINUX_PYTHON_VERSIONS="3.8 3.9 3.10 3.11"
MACOS_PYTHON_VERSIONS=""
elif [[ "${BUILD_TYPE}" == "push_to_main" ]]; then
LINUX_PYTHON_VERSIONS="3.8"
Expand Down Expand Up @@ -208,6 +209,8 @@ jobs:
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.9")) | length > 0')
NEEDS_LINUX_310_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.10")) | length > 0')
NEEDS_LINUX_311_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.11")) | length > 0')
echo "Needs Linux 3.8 runner:"
echo "${NEEDS_LINUX_38_RUNNER}"
Expand All @@ -218,9 +221,13 @@ jobs:
echo "Needs Linux 3.10 runner:"
echo "${NEEDS_LINUX_310_RUNNER}"
echo "Needs Linux 3.11 runner:"
echo "${NEEDS_LINUX_311_RUNNER}"
echo "needs-38-linux-runner=${NEEDS_LINUX_38_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-39-linux-runner=${NEEDS_LINUX_39_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-310-linux-runner=${NEEDS_LINUX_310_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-311-linux-runner=${NEEDS_LINUX_311_RUNNER}" >> $GITHUB_OUTPUT
echo "instance-type=${INSTANCE_TYPE}" >> $GITHUB_OUTPUT
start-runner-linux:
Expand All @@ -235,6 +242,8 @@ jobs:
ec2-instance-id-39: ${{ steps.start-ec2-runner-39.outputs.ec2-instance-id || '' }}
label-310: ${{ steps.start-ec2-runner-310.outputs.label }}
ec2-instance-id-310: ${{ steps.start-ec2-runner-310.outputs.ec2-instance-id || '' }}
label-311: ${{ steps.start-ec2-runner-311.outputs.label }}
ec2-instance-id-311: ${{ steps.start-ec2-runner-311.outputs.ec2-instance-id || '' }}
matrix: ${{ steps.update-linux-matrix.outputs.linux-matrix }}
steps:
- name: Checkout Code
Expand Down Expand Up @@ -319,6 +328,30 @@ jobs:
{"Key": "Team", "Value": "CML"}
]
- name: Start EC2 runner python 3.11
id: start-ec2-runner-311
if: ${{ !cancelled() && fromJSON(needs.matrix-preparation.outputs.needs-311-linux-runner) }}
uses: machulav/ec2-github-runner@fcfb31a5760dad1314a64a0e172b78ec6fc8a17e
with:
mode: start
github-token: ${{ secrets.EC2_RUNNER_BOT_TOKEN }}
ec2-image-id: ${{ secrets.AWS_EC2_AMI }}
ec2-instance-type: ${{ needs.matrix-preparation.outputs.instance-type }}
subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID }}
security-group-id: ${{ secrets.AWS_EC2_SECURITY_GROUP_ID }}
aws-resource-tags: >
[
{"Key": "Name", "Value": "cml-ci-ec2-github-runner-py311"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"},
{"Key": "Python version", "Value": "3.11"},
{"Key": "Actor", "Value": "${{ github.actor }}"},
{"Key": "Action", "Value": "${{ github.action }}"},
{"Key": "GitHash", "Value": "${{ github.sha }}"},
{"Key": "RefName", "Value": "${{ github.ref_name }}"},
{"Key": "RunId", "Value": "${{ github.run_id }}"},
{"Key": "Team", "Value": "CML"}
]
- name: Update Linux runs_on Matrix
id: update-linux-matrix
Expand All @@ -331,6 +364,8 @@ jobs:
'(. | map(select(.os_kind=="linux" and .python_version=="3.9") |= . + {"runs_on": "${{ steps.start-ec2-runner-39.outputs.label }}"}) )')
MATRIX=$(echo "${MATRIX}" | jq -rc \
'(. | map(select(.os_kind=="linux" and .python_version=="3.10") |= . + {"runs_on": "${{ steps.start-ec2-runner-310.outputs.label }}"}) )')
MATRIX=$(echo "${MATRIX}" | jq -rc \
'(. | map(select(.os_kind=="linux" and .python_version=="3.11") |= . + {"runs_on": "${{ steps.start-ec2-runner-311.outputs.label }}"}) )')
echo "Updated matrix:"
echo "${MATRIX}"
Expand Down Expand Up @@ -1002,6 +1037,15 @@ jobs:
ec2-instance-id: ${{ needs.start-runner-linux.outputs.ec2-instance-id-310 }}
mode: stop

- name: Stop EC2 runner python 3.11
uses: machulav/ec2-github-runner@fcfb31a5760dad1314a64a0e172b78ec6fc8a17e
if: ${{ always() && needs.start-runner-linux.outputs.ec2-instance-id-311 }}
with:
github-token: ${{ secrets.EC2_RUNNER_BOT_TOKEN }}
label: ${{ needs.start-runner-linux.outputs.label-311 }}
ec2-instance-id: ${{ needs.start-runner-linux.outputs.ec2-instance-id-311 }}
mode: stop

build-macos-intel:
name: Python ${{ matrix.python_version }} (macOS, intel)
needs: [matrix-preparation]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Depending on your OS, Concrete ML may be installed with Docker or with pip:
| macOS 11+ (Intel) | Yes | Yes |
| macOS 11+ (Apple Silicon: M1, M2, etc.) | Coming soon | Yes |

Note: Concrete ML only supports Python `3.8`, `3.9` and `3.10`.
Note: Concrete ML only supports Python `3.8`, `3.9`, `3.10` and `3.11`.
Concrete ML can be installed on Kaggle ([see this question on the community for more details](https://community.zama.ai/t/how-do-we-use-concrete-ml-on-kaggle/332)) and on Google Colab.

#### Docker
Expand Down
4 changes: 4 additions & 0 deletions deps_licenses/licenses_linux_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
f07036c8072f32a26aa79e5e4bbd9c32
=======
ead3663b936227b3d224dc480933b084
>>>>>>> 8de97ea7 (feat: adding support for python3.11)
4 changes: 4 additions & 0 deletions deps_licenses/licenses_mac_intel_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
f07036c8072f32a26aa79e5e4bbd9c32
=======
ead3663b936227b3d224dc480933b084
>>>>>>> 8de97ea7 (feat: adding support for python3.11)
4 changes: 4 additions & 0 deletions deps_licenses/licenses_mac_silicon_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
f07036c8072f32a26aa79e5e4bbd9c32
=======
ead3663b936227b3d224dc480933b084
>>>>>>> 8de97ea7 (feat: adding support for python3.11)
2 changes: 1 addition & 1 deletion docs/getting-started/pip_installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Depending on your OS/HW, Concrete ML may be installed with Docker or with pip:

### Python support

- **Version**: In the current release, Concrete ML supports only `3.8`, `3.9` and `3.10` versions of `python`.
- **Version**: In the current release, Concrete ML supports only `3.8`, `3.9`, `3.10` and `3.11` versions of `python`.
- **Linux requirement**: The Concrete ML Python package requires `glibc >= 2.28`. On Linux, you can check your `glibc` version by running `ldd --version`.
- **Kaggle installation**: Concrete ML can be installed on Kaggle ([see question on community for more details](https://community.zama.ai/t/how-do-we-use-concrete-ml-on-kaggle/332)) and on Google Colab.

Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ readme = "README.md"
"Bug Tracker" = "https://github.com/zama-ai/concrete-ml/issues"

[tool.poetry.dependencies]
# Investigate if it is better to fix specific versions or use lower and upper bounds
# Investigate if it is better to fix specific versions or use lower and upper bounds
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/2665
python = ">=3.8.1,<3.11"
python = ">=3.8.1,<3.12"
# Based on the following link, explicitly indicating the source makes poetry only look for that
# source, so we should only use this for Concrete Python's non-public releases
# https://python-poetry.org/docs/1.7/repositories#project-configuration
Expand All @@ -52,7 +52,7 @@ typing-extensions = "^4.5.0"
brevitas = "0.10.2"
onnx = "1.16.1"
onnxoptimizer = "0.3.13"
# onnxruntime versions supported by onnx versions and opsets can be found here :
# onnxruntime versions supported by onnx versions and opsets can be found here :
# https://onnxruntime.ai/docs/reference/compatibility.html#onnx-opset-support
onnxruntime = "1.18"
hummingbird-ml = {version="0.4.11", extras = ["onnx"]}
Expand Down Expand Up @@ -98,7 +98,7 @@ pip-audit = "^2.1.0"
types-requests = "^2.32.0"
requests="^2.32.1"
jupyter = "^1.0.0"
py-progress-tracker = "0.6.0"
py-progress-tracker = "0.7.0"
nbqa = "^1.3.1"
darglint = "^1.8.1"
linkcheckmd = "^1.4.0"
Expand Down Expand Up @@ -167,4 +167,3 @@ line-length = 100

# Add a setuptools_scm section to avoid warnings
[tool.setuptools_scm]

1 change: 1 addition & 0 deletions script/actions_utils/generate_test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class PythonVersion(enum.Enum):
V_3_8 = "3.8"
V_3_9 = "3.9"
V_3_10 = "3.10"
V_3_11 = "3.11"


class OS(enum.Enum):
Expand Down
4 changes: 2 additions & 2 deletions script/make_utils/check_installation_with_all_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ do
;;

"--all" )
VERSION_LIST="3.8 3.9 3.10"
VERSION_LIST="3.8 3.9 3.10 3.11"
;;

"--version" )
Expand All @@ -44,7 +44,7 @@ done

if [ "${VERSION_LIST}" == "" ]
then
VERSION_LIST="3.8 3.9 3.10"
VERSION_LIST="3.8 3.9 3.10 3.11"
fi

for VERSION in $VERSION_LIST
Expand Down
2 changes: 2 additions & 0 deletions script/make_utils/licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ then
IS_CORRECT_PYTHON=1
elif [[ "${CHECK_VERSION}" == *"3.10"* ]]; then
IS_CORRECT_PYTHON=1
elif [[ "${CHECK_VERSION}" == *"3.11"* ]]; then
IS_CORRECT_PYTHON=1
fi

if [ $IS_CORRECT_PYTHON -eq 0 ]
Expand Down

0 comments on commit 6e3d8da

Please sign in to comment.