Skip to content
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
4 changes: 2 additions & 2 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dist-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
15 changes: 10 additions & 5 deletions bindings/python/.evergreen/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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"
Expand All @@ -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 \
Expand All @@ -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 .
Expand Down
36 changes: 15 additions & 21 deletions bindings/python/.evergreen/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions bindings/python/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
-------------------------

Expand Down
6 changes: 3 additions & 3 deletions bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand All @@ -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",
]

Expand Down
2 changes: 1 addition & 1 deletion bindings/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cffi>=1.12.0,<2
cffi>=1.12.0,<3
cryptography>=40
packaging>=21.0
httpx>=0.25.0
3 changes: 1 addition & 2 deletions bindings/python/test/performance/perf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import time
import unittest
from concurrent.futures import ThreadPoolExecutor
from typing import List

try:
import simplejson as json
Expand Down Expand Up @@ -52,7 +51,7 @@

OUTPUT_FILE = os.environ.get("OUTPUT_FILE")

result_data: List = []
result_data: list = []


def read(filename, **kwargs):
Expand Down
Loading