Skip to content
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

Test Multiple Python Versions (+3.13 Support) #20

Merged
merged 10 commits into from
Dec 20, 2024
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
55 changes: 28 additions & 27 deletions .github/workflows/release_python.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was autogenerated by maturin v1.6.0 using:
# maturin generate-ci github -o ../../.github/workflows/release_pyton_pytest.yml --pytest
#
#
# Then adapted to the project
#
name: CI
Expand All @@ -10,7 +10,7 @@ on:
branches:
- main
tags:
- '*'
- "*"
pull_request:
workflow_dispatch:

Expand All @@ -31,23 +31,24 @@ jobs:
target: x86_64
#- runner: self-hosted-arm64
# target: aarch64
python-version: ["3.8", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: ${{ matrix.python-version }}

# On linux we don't use graalvm/[email protected] action to install graalvm because it will install it
# on the runner machine and on linux the build will happen inside a manylinux docker.
# on the runner machine and on linux the build will happen inside a manylinux docker.
# Instead, we use a script to install graalvm inside the docker container
# the script is launched by setting the before-script-linux config option of the maturin action
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
#working-directory: "bindings/extractous-python" # dont use working dir with docker fails to reapply permission on target dir
args: --manifest-path bindings/extractous-python/Cargo.toml --release --out bindings/extractous-python/dist -i python3.8 --compatibility manylinux_2_28
sccache: 'false'
args: --manifest-path bindings/extractous-python/Cargo.toml --release --out bindings/extractous-python/dist -i python${{ matrix.python-version }} --compatibility manylinux_2_28
sccache: "false"
target: ${{ matrix.platform.target }}
container: quay.io/pypa/manylinux_2_28_${{ matrix.platform.target }}:latest
before-script-linux: .github/workflows/install-graalvm-sdkman.sh 23.0.1-graalce
Expand All @@ -56,11 +57,12 @@ jobs:

# On linux we don't need to patch the wheel as the RPATH is set by the rustc compiler
- name: Upload wheels
if: ${{ matrix.python-version == '3.8' }}
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: bindings/extractous-python/dist

- name: pytest
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
shell: bash
Expand Down Expand Up @@ -92,7 +94,6 @@ jobs:
cd bindings/extractous-python
pytest -s


windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
Expand All @@ -104,20 +105,20 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: "3.8"
architecture: ${{ matrix.platform.target }}
- uses: graalvm/[email protected]
with:
java-version: '23'
distribution: 'graalvm-community'
set-java-home: 'true'
java-version: "23"
distribution: "graalvm-community"
set-java-home: "true"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
working-directory: "bindings/extractous-python"
args: --release --out dist --find-interpreter
sccache: 'true'
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -146,25 +147,25 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: "3.8"

# - uses: graalvm/[email protected]
# with:
# java-version: '23'
# distribution: 'liberica'
# set-java-home: 'true'
# - name: Install graalvm
# run: |
# set -e
# bash .github/workflows/install-graalvm-sdkman-macos.sh 24.1.1.r23-nik
# - uses: graalvm/[email protected]
# with:
# java-version: '23'
# distribution: 'liberica'
# set-java-home: 'true'
# - name: Install graalvm
# run: |
# set -e
# bash .github/workflows/install-graalvm-sdkman-macos.sh 24.1.1.r23-nik

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
working-directory: "bindings/extractous-python"
args: --release --out dist --find-interpreter
sccache: 'true'
sccache: "true"

- name: Patch wheel lib
run: |
Expand Down Expand Up @@ -206,7 +207,7 @@ jobs:
name: wheels-sdist
path: bindings/extractous-python/dist

# Follows the guide on https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# Follows the guide on https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# We use 2 actions one to publish on PyPi on tag pushes to main brnach and the other to publish on TestPyPi on any push
publish-to-testpypi:
name: Publish to TestPyPI
Expand All @@ -218,7 +219,7 @@ jobs:
url: https://pypi.org/p/extractous
permissions:
contents: read
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -242,7 +243,7 @@ jobs:
name: pypi
url: https://pypi.org/p/extractous
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions bindings/extractous-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ doc = false

[dependencies]
# "abi3-py310" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.10
pyo3 = { version = "0.22.2", features = ["abi3", "abi3-py38", "gil-refs"] }
extractous = { path = "../../extractous-core" }
pyo3 = { version = "0.23.3", features = ["abi3", "abi3-py38"] }
extractous = { path = "../../extractous-core" }
3 changes: 1 addition & 2 deletions bindings/extractous-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ classifiers = [
description = "Extractous Python Binding"
license = { text = "Apache-2.0" }
readme = "README.md"
# PyO3 doesn't support python 3.13 yet.
requires-python = ">=3.8,<3.13"
requires-python = ">=3.8,<3.14"

[project.optional-dependencies]
# To generate python docs using pdoc we need to run:
Expand Down
Loading