Skip to content

Commit

Permalink
Merge pull request #1895 from gchq/dev/BAI-1592-add-python-3.13-support
Browse files Browse the repository at this point in the history
Update Python client to support Python 3.13
  • Loading branch information
PE39806 authored Feb 12, 2025
2 parents 6797984 + df051e1 commit 54e36ae
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 73 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,10 @@ jobs:
./backend/src/scripts/waitForIt.sh localhost:27017 -t 10
# Setup python
- name: Set up Python 3.11
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"

# Install dependencies
- name: Install dependencies
Expand All @@ -525,6 +525,8 @@ jobs:
run: |
cd lib/python
python -m pytest -m integration
env:
PYTEST_RUN_PATH: "lib/python"

- name: Dump docker compose logs
if: always()
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/modelscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ jobs:
run: |
cd lib/modelscan_api
python -m pytest
env:
PYTEST_RUN_PATH: "lib/modelscan_api"

# Pytest -m integration
- name: Run integration testing
run: |
cd lib/modelscan_api
python -m pytest -m integration
env:
PYTEST_RUN_PATH: "lib/modelscan_api"
2 changes: 1 addition & 1 deletion .github/workflows/python-publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"

# Install build package
- name: Install pypa/build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"

# Install build package
- name: Install pypa/build
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -43,3 +43,5 @@ jobs:
run: |
cd lib/python
python -m pytest
env:
PYTEST_RUN_PATH: "lib/python"
2 changes: 1 addition & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.13"

- name: Install dependencies
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
autoupdate_commit_msg: 'chore: update pre-commit hooks'
autofix_commit_msg: 'style: pre-commit fixes'

files: ^lib/modelscan_api/
files: ^(backend/docs/|lib/python/|lib/modelscan_api/)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -29,14 +29,26 @@ repos:
rev: v3.19.1
hooks:
- id: pyupgrade
name: pyupgrade 3.9 (main)
args: ['--py39-plus']
# Pydantic fails check so ignore the one problematic file
exclude: lib/modelscan_api/bailo_modelscan_api/config.py
- id: pyupgrade
name: pyupgrade 3.9 (pedantic)
args: ['--py39-plus', '--keep-runtime-typing']
# scan problematic separately with extra arg to workaround problem
files: lib/modelscan_api/bailo_modelscan_api/config.py
- id: pyupgrade
name: pyupgrade 3.10 (main)
args: ['--py310-plus']
# backend/docs/ has the minimum python version 3.10
files: backend/docs/

- repo: https://github.com/hadialqattan/pycln
rev: v2.5.0
hooks:
- id: pycln
# use the same config as for /lib/python
args: [--config=../python/pyproject.toml]
args: [--config=lib/python/pyproject.toml]
stages: [manual]

- repo: https://github.com/codespell-project/codespell
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM python:3.12.9-bullseye AS sphinx-docs
FROM python:3.13.2-bullseye AS sphinx-docs

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12.9-bullseye AS sphinx-docs
FROM python:3.13.2-bullseye AS sphinx-docs

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down
1 change: 1 addition & 0 deletions lib/modelscan_api/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
black==25.1.0
pre_commit==4.1.0
pytest==8.3.4
pytest-github-actions-annotate-failures==0.3.0
62 changes: 0 additions & 62 deletions lib/python/.pre-commit-config.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions lib/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.9"
dynamic = ["version"]
Expand Down

0 comments on commit 54e36ae

Please sign in to comment.