diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 44ab23faa..15ce3419b 100755 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -563,7 +563,7 @@ tasks: commands: - func: "fetch source" - func: "build python release" - vars: { PYTHON: /opt/python/3.8/bin/python3 } + vars: { PYTHON: /opt/python/3.9/bin/python3 } - func: "upload python release" - name: "release-python-windows" @@ -572,7 +572,7 @@ tasks: commands: - func: "fetch source" - func: "build python release" - vars: { PYTHON: C:/python/Python38/python.exe } + vars: { PYTHON: C:/python/Python39/python.exe } - func: "upload python release" - name: "release-python-combine" diff --git a/.github/workflows/dist-python.yml b/.github/workflows/dist-python.yml index b25b84c18..554c0f357 100644 --- a/.github/workflows/dist-python.yml +++ b/.github/workflows/dist-python.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.9" cache: 'pip' cache-dependency-path: 'bindings/python/pyproject.toml' allow-prereleases: true diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index b818692be..c4356e7a2 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.13"] + python-version: ["3.9", "3.13", "3.14"] steps: - uses: actions/checkout@v4 @@ -57,7 +57,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Build and test dist files run: | - if [ "${{ matrix.python-version }}" == "3.13" ]; then + if [ "${{ matrix.python-version }}" == "3.14" ]; then export PIP_PRE=1 fi export LIBMONGOCRYPT_VERSION=$(cat ./scripts/libmongocrypt-version.txt) diff --git a/bindings/python/.evergreen/test.sh b/bindings/python/.evergreen/test.sh index e49577c6f..ccc916481 100755 --- a/bindings/python/.evergreen/test.sh +++ b/bindings/python/.evergreen/test.sh @@ -18,11 +18,12 @@ if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin PYMONGOCRYPT_LIB=${MONGOCRYPT_DIR}/nocrypto/bin/mongocrypt.dll PYMONGOCRYPT_LIB_CRYPTO=$(cygpath -m ${MONGOCRYPT_DIR}/bin/mongocrypt.dll) export PYMONGOCRYPT_LIB=$(cygpath -m $PYMONGOCRYPT_LIB) - PYTHONS=("C:/python/Python38/python.exe" - "C:/python/Python39/python.exe" + PYTHONS=("C:/python/Python39/python.exe" "C:/python/Python310/python.exe" "C:/python/Python311/python.exe" - "C:/python/Python312/python.exe") + "C:/python/Python312/python.exe" + "C:/python/Python313/python.exe" + "C:/python/Python314/python.exe") export CRYPT_SHARED_PATH=../crypt_shared/bin/mongo_crypt_v1.dll C:/python/Python310/python.exe drivers-evergreen-tools/.evergreen/mongodl.py --component crypt_shared \ --version latest --out ../crypt_shared/ @@ -34,6 +35,9 @@ elif [ "Darwin" = "$(uname -s)" ]; then "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3" "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3" "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3" + "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3" + # TODO: PYTHON-5466 + #"/Library/Frameworks/Python.framework/Versions/3.14/bin/python3" ) export CRYPT_SHARED_PATH="../crypt_shared/lib/mongo_crypt_v1.dylib" @@ -55,12 +59,13 @@ else "/opt/mongodbtoolchain/v4/bin/python3" ) else - PYTHONS=("/opt/python/3.8/bin/python3" + PYTHONS=( "/opt/python/3.9/bin/python3" "/opt/python/3.10/bin/python3" "/opt/python/3.11/bin/python3" "/opt/python/3.12/bin/python3" "/opt/python/3.13/bin/python3" + "/opt/python/3.14/bin/python3" ) fi /opt/mongodbtoolchain/v3/bin/python3 drivers-evergreen-tools/.evergreen/mongodl.py --component \ @@ -72,7 +77,7 @@ for PYTHON_BINARY in "${PYTHONS[@]}"; do $PYTHON_BINARY -c 'import sys; print(sys.version)' git clean -dffx createvirtualenv $PYTHON_BINARY .venv - python -m pip install --prefer-binary -v -e ".[test]" + python -m pip install --prefer-binary -v -e ".[test]" || python -m pip install --pre --prefer-binary -v -e ".[test]" echo "Running tests with crypto enabled libmongocrypt..." PYMONGOCRYPT_LIB=$PYMONGOCRYPT_LIB_CRYPTO python -c 'from pymongocrypt.binding import lib;assert lib.mongocrypt_is_crypto_available(), "mongocrypt_is_crypto_available() returned False"' PYMONGOCRYPT_LIB=$PYMONGOCRYPT_LIB_CRYPTO python -m pytest -v --ignore=test/performance . diff --git a/bindings/python/.evergreen/utils.sh b/bindings/python/.evergreen/utils.sh index 57055fb1e..b96521e98 100755 --- a/bindings/python/.evergreen/utils.sh +++ b/bindings/python/.evergreen/utils.sh @@ -36,47 +36,41 @@ createvirtualenv () { # PYTHON = find_python3 find_python3() { PYTHON="" - # Add a fallback system python3 if it is available and Python 3.8+. - if is_python_38 "$(command -v python3)"; then + # Add a fallback system python3 if it is available and Python 3.9+. + if is_python_39 "$(command -v python3)"; then PYTHON="$(command -v python3)" fi # Find a suitable toolchain version, if available. if [ "$(uname -s)" = "Darwin" ]; then - # macos 11.00 - if [ -d "/Library/Frameworks/Python.Framework/Versions/3.10" ]; then - PYTHON="/Library/Frameworks/Python.Framework/Versions/3.10/bin/python3" - # macos 10.14 - elif [ -d "/Library/Frameworks/Python.Framework/Versions/3.8" ]; then - PYTHON="/Library/Frameworks/Python.Framework/Versions/3.8/bin/python3" - fi + PYTHON="/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3" elif [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin - PYTHON="C:/python/Python38/python.exe" + PYTHON="C:/python/Python39/python.exe" else - # Prefer our own toolchain, fall back to mongodb toolchain if it has Python 3.8+. - if [ -f "/opt/python/3.8/bin/python3" ]; then - PYTHON="/opt/python/3.8/bin/python3" - elif is_python_38 "$(command -v /opt/mongodbtoolchain/v4/bin/python3)"; then + # Prefer our own toolchain, fall back to mongodb toolchain if it has Python 3.9+. + if [ -f "/opt/python/3.9/bin/python3" ]; then + PYTHON="/opt/python/3.9/bin/python3" + elif is_python_39 "$(command -v /opt/mongodbtoolchain/v4/bin/python3)"; then PYTHON="/opt/mongodbtoolchain/v4/bin/python3" - elif is_python_38 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then + elif is_python_39 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then PYTHON="/opt/mongodbtoolchain/v3/bin/python3" fi fi if [ -z "$PYTHON" ]; then - echo "Cannot run pre-commit without python3.8+ installed!" + echo "Cannot run pre-commit without python3.9+ installed!" exit 1 fi echo "$PYTHON" } -# Function that returns success if the provided Python binary is version 3.8 or later +# Function that returns success if the provided Python binary is version 3.9 or later # Usage: -# is_python_38 /path/to/python +# is_python_39 /path/to/python # * param1: Python binary -is_python_38() { +is_python_39() { if [ -z "$1" ]; then return 1 - elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 8))"; then - # runs when sys.version_info[:2] >= (3, 8) + elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 9))"; then + # runs when sys.version_info[:2] >= (3, 9) return 0 else return 1 diff --git a/bindings/python/CHANGELOG.rst b/bindings/python/CHANGELOG.rst index e7fb9bf8a..b1349361f 100644 --- a/bindings/python/CHANGELOG.rst +++ b/bindings/python/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +Changes in Version 1.15.0 +------------------------- + +- Add support for Python 3.14. +- Drop support for Python 3.8. + Changes in Version 1.14.1 ------------------------- diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index f69cf3c57..5859d13bf 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -8,7 +8,7 @@ dynamic = ["version", "dependencies", "optional-dependencies"] description = "Python bindings for libmongocrypt" readme = "README.rst" license = {file="LICENSE"} -requires-python = ">=3.8" +requires-python = ">=3.9" authors = [ { name = "Shane Harvey", email = "mongodb-user@googlegroups.com" }, ] @@ -29,14 +29,14 @@ classifiers = [ "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", + "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", + "Programming Language :: Python :: 3.14", "Topic :: Database", ] diff --git a/bindings/python/requirements.txt b/bindings/python/requirements.txt index f95140da6..c64bcb573 100644 --- a/bindings/python/requirements.txt +++ b/bindings/python/requirements.txt @@ -1,4 +1,4 @@ -cffi>=1.12.0,<2 +cffi>=1.12.0,<3 cryptography>=40 packaging>=21.0 httpx>=0.25.0 diff --git a/bindings/python/test/performance/perf_test.py b/bindings/python/test/performance/perf_test.py index 2d66063d7..8a11a7c3a 100644 --- a/bindings/python/test/performance/perf_test.py +++ b/bindings/python/test/performance/perf_test.py @@ -20,7 +20,6 @@ import time import unittest from concurrent.futures import ThreadPoolExecutor -from typing import List try: import simplejson as json @@ -52,7 +51,7 @@ OUTPUT_FILE = os.environ.get("OUTPUT_FILE") -result_data: List = [] +result_data: list = [] def read(filename, **kwargs):