Skip to content

Commit

Permalink
Support Python 3.13 and introduce pypa/cibuildwheel (#509)
Browse files Browse the repository at this point in the history
* CI: use cibuildwheel to build wheels across all supported platforms

* CI: delete old PyPI publish workflows

* CI: Remove unused scripts

* CI: Drop Python 3.8 support and add Python 3.13

* CI: Lint and format workflows YAML files

* CI: Upgrade used Actions

* bump version to 0.3.16

* CI: Rename the job name to 'publish' in publish_wheels workflow
  • Loading branch information
philomath213 authored Feb 19, 2025
1 parent 2c9cc34 commit e8731d2
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 159 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/bazel_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ on:
pull_request:
types: [opened, synchronize, reopened]


jobs:
BAZEL:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.9']
python-version: ["3.9"]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Run gtest
timeout-minutes: 40
run: bazel test --test_output=all --spawn_strategy=standalone --test_timeout=1500 //tests/cpp/...
run:
bazel test --test_output=all --spawn_strategy=standalone --test_timeout=1500 //tests/cpp/...
# - name: Run SEALAPI tests
# timeout-minutes: 30
# run: bazel test --test_output=all --spawn_strategy=standalone --test_timeout=1500 --jobs 1 //tests/python/sealapi/...
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: Benchmarks
on:
push:
branches: [main]
branches: [main]

jobs:
benchmark:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.12]
python-version: ["3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Prepare ENV
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Install dependencies Ubuntu
run: .github/workflows/scripts/install_req_ubuntu.sh
Expand All @@ -44,7 +44,7 @@ jobs:
run: |
pytest tests/python/benchmarks/ --cov-fail-under 0 --benchmark-json pytest_benchmarks_output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
with:
name: Python-Benchmarks
tool: "pytest"
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: OSSAR

on:
push:
branches: [ main ]
branches: [main]

jobs:
OSSAR-Scan:
Expand All @@ -14,16 +14,16 @@ jobs:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

# Run open source static analysis tools
- name: Run OSSAR
uses: github/ossar-action@4e96c4f6e591eb4b991abfd459e40b136a317aea # v2.0.0
id: ossar
# Run open source static analysis tools
- name: Run OSSAR
uses: github/ossar-action@4e96c4f6e591eb4b991abfd459e40b136a317aea # v2.0.0
id: ossar

# Upload results to the Security tab
- name: Upload OSSAR results
uses: github/codeql-action/upload-sarif@5618c9fc1e675841ca52c1c6b1304f5255a905a0 # v2.19.0
with:
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
# Upload results to the Security tab
- name: Upload OSSAR results
uses: github/codeql-action/upload-sarif@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2.28.1
with:
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
54 changes: 54 additions & 0 deletions .github/workflows/publish_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Publish

on:
workflow_dispatch:

jobs:
publish:
runs-on: ${{ matrix.target[0] }}
strategy:
fail-fast: false
matrix:
target:
- [ubuntu-latest, manylinux_x86_64]
- [windows-latest, win_amd64]
- [macos-13, macosx_x86_64]
- [macos-14, macosx_arm64]
python:
- cp39
- cp310
- cp311
- cp312
- cp313

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true

- name: Setup msbuild
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
if: matrix.target[0] == 'windows-latest'

- name: Build wheels using cibuildwheel
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.target[1] }}
CIBW_BUILD_VERBOSITY: 1
with:
package-dir: .
output-dir: wheelhouse

- name: Upload Artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: TenSEAL-${{ matrix.python }}-${{ matrix.target[0] }}
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
packages-dir: ./wheelhouse/
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
35 changes: 0 additions & 35 deletions .github/workflows/pythonpublish-linux.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/pythonpublish-macos.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/pythonpublish-windows.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/scripts/install_req_manylinux.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/scripts/release_macos.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/scripts/release_manylinux.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/scripts/release_windows.bat

This file was deleted.

34 changes: 17 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.12']
python-version: ["3.13"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -34,25 +34,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Check LongPathsEnabled
run: |
git config --system core.longpaths true
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
git config --system core.longpaths true
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
if: ${{ matrix.os == 'windows-latest' }}
- name: Prepare ENV
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Install dependencies Ubuntu
run: .github/workflows/scripts/install_req_ubuntu.sh
Expand Down Expand Up @@ -86,25 +86,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Prepare ENV
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Check LongPathsEnabled
run: |
git config --system core.longpaths true
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
git config --system core.longpaths true
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
if: ${{ matrix.os == 'windows-latest' }}
- name: Install dependencies Ubuntu
run: .github/workflows/scripts/install_req_ubuntu.sh
Expand Down
2 changes: 1 addition & 1 deletion tenseal/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.15"
__version__ = "0.3.16"

1 comment on commit e8731d2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Python-Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: e8731d2 Previous: 2c9cc34 Ratio
tests/python/benchmarks/test_ops.py::test_perf_bfv[4096-bfv_test-add] 6777.593276636239 iter/sec (stddev: 0.00006142457129160372) 14342.399547931303 iter/sec (stddev: 0.0000023282726278802457) 2.12
tests/python/benchmarks/test_ops.py::test_perf_bfv[8192-bfv_test-add] 5295.300928695376 iter/sec (stddev: 0.000033200738437369426) 13927.898611586093 iter/sec (stddev: 0.000004039110197419975) 2.63
tests/python/benchmarks/test_ops.py::test_perf_ckks_ops[4096-ckks_test-sub] 9584.052137840763 iter/sec (stddev: 0.00003541492490755972) 26720.092604236892 iter/sec (stddev: 0.0000010384824284185962) 2.79
tests/python/benchmarks/test_ops.py::test_perf_ckks_ops[8192-ckks_test-sub] 6295.247088528151 iter/sec (stddev: 0.00005884553786093269) 13652.029959605636 iter/sec (stddev: 0.0000010996720353690867) 2.17
tests/python/benchmarks/test_ops.py::test_perf_ckks_ops[16384-ckks_test-negate] 3263.7250407919983 iter/sec (stddev: 0.00007459335870498781) 8935.220189872176 iter/sec (stddev: 0.0000018209600090250767) 2.74
tests/python/benchmarks/test_ops.py::test_perf_ckks_plain_ops[256-ckks_test-add] 1328.9993071156193 iter/sec (stddev: 0.00011866249868013332) 2802.92641218396 iter/sec (stddev: 0.000009699243673678022) 2.11
tests/python/benchmarks/test_ops.py::test_perf_ckks_plain_ops[1024-ckks_test-multiply] 490.22832296071755 iter/sec (stddev: 0.0010966134255353819) 1249.543167027641 iter/sec (stddev: 0.000012104272419031728) 2.55
tests/python/benchmarks/test_ops.py::test_perf_ckks_plain_ops[4096-ckks_test-add] 622.2859155363265 iter/sec (stddev: 0.0007353925650605825) 1930.8218952726036 iter/sec (stddev: 0.000010506707612611429) 3.10

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.