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

SNOW-1763673 Python3.13 support #2105

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
32 changes: 16 additions & 16 deletions .github/workflows/build_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@v4
with:
python-version: '3.8'
python-version: '3.9'
- name: Display Python version
run: python -c "import sys; import os; print(\"\n\".join(os.environ[\"PATH\"].split(os.pathsep))); print(sys.version); print(sys.executable);"
- name: Upgrade setuptools, pip and wheel
Expand All @@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
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"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -74,13 +74,13 @@ jobs:
id: manylinux_x86_64
- image: ubuntu-20.04
id: manylinux_aarch64
- image: windows-2019
- image: windows-2022
id: win_amd64
- image: macos-latest
id: macosx_x86_64
- image: macos-latest
id: macosx_arm64
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
name: Build ${{ matrix.os.id }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.os.image }}
steps:
Expand All @@ -96,7 +96,7 @@ jobs:
platforms: all
- uses: actions/checkout@v4
- name: Building wheel
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: cp${{ env.shortver }}-${{ matrix.os.id }}
MACOSX_DEPLOYMENT_TARGET: 10.14 # Should be kept in sync with ci/build_darwin.sh
Expand All @@ -123,9 +123,9 @@ jobs:
download_name: manylinux_x86_64
- image_name: macos-latest
download_name: macosx_x86_64
- image_name: windows-2019
- image_name: windows-2022
download_name: win_amd64
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
cloud-provider: [aws, azure, gcp]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- name: Install tox
run: python -m pip install tox>=4
- name: Run tests
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit,integ,pandas,sso}-ci | sed 's/ /,/g'`
run: python -m tox run --installpkg dist/*.whl -e `echo py${PYTHON_VERSION/\./}-{extras,unit,integ,pandas,sso}-ci | sed 's/ /,/g'`
env:
PYTHON_VERSION: ${{ matrix.python-version }}
cloud_provider: ${{ matrix.cloud-provider }}
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
os:
- image_name: ubuntu-latest
download_name: linux
python-version: [3.8]
python-version: [3.9]
cloud-provider: [aws]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
os:
- image_name: ubuntu-latest
download_name: linux
python-version: [3.8]
python-version: [3.9]
cloud-provider: [aws]
steps:
- uses: actions/checkout@v4
Expand All @@ -245,7 +245,7 @@ jobs:
shell: bash

test-fips:
name: Test FIPS linux-3.8-${{ matrix.cloud-provider }}
name: Test FIPS linux-3.9-${{ matrix.cloud-provider }}
needs: build
runs-on: ubuntu-latest
strategy:
Expand All @@ -264,23 +264,23 @@ jobs:
- name: Download wheel(s)
uses: actions/download-artifact@v4
with:
name: manylinux_x86_64_py3.8
name: manylinux_x86_64_py3.9
path: dist
- name: Show wheels downloaded
run: ls -lh dist
shell: bash
- name: Run tests
run: ./ci/test_fips_docker.sh
env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
cloud_provider: ${{ matrix.cloud-provider }}
PYTEST_ADDOPTS: --color=yes --tb=short
TOX_PARALLEL_NO_SPINNER: 1
shell: bash
- uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: coverage_linux-fips-3.8-${{ matrix.cloud-provider }}
name: coverage_linux-fips-3.9-${{ matrix.cloud-provider }}
path: |
.coverage
coverage.xml
Expand All @@ -292,7 +292,7 @@ jobs:
strategy:
fail-fast: false
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"]
cloud-provider: [aws]
steps:
- name: Set shortver
Expand Down Expand Up @@ -345,7 +345,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Upgrade setuptools and pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_req_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
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"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: >
Expand All @@ -24,7 +24,7 @@ repos:
- id: debug-statements
- id: check-ast
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.1
rev: v1.5.5
hooks:
- id: insert-license
name: insert-py-license
Expand Down Expand Up @@ -61,7 +61,7 @@ repos:
hooks:
- id: yesqa
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.50"
hooks:
- id: check-manifest
- repo: https://github.com/PyCQA/isort
Expand All @@ -76,18 +76,18 @@ repos:
- --append-only
files: ^src/snowflake/connector/.*\.py$
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
rev: 'v1.13.0'
hooks:
- id: mypy
files: |
Expand Down Expand Up @@ -120,14 +120,14 @@ repos:
- types-pyOpenSSL
- types-setuptools
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
args:
- --safe
language_version: python3
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v19.1.3
hooks:
- id: clang-format
types_or: [c++, c]
Expand Down
1 change: 1 addition & 0 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
- v3.12.4(TBD)
- Fixed a bug where multipart uploads to Azure would be missing their MD5 hashes.
- Fixed a bug where OpenTelemetry header injection would sometimes cause Exceptions to be thrown.
- Added support for Python 3.12.

- v3.12.3(October 25,2024)
- Improved the error message for SSL-related issues to provide clearer guidance when an SSL error occurs.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using the Snowflake JDBC or ODBC drivers.

The connector has **no** dependencies on JDBC or ODBC.
It can be installed using ``pip`` on Linux, Mac OSX, and Windows platforms
where Python 3.8.0 (or higher) is installed.
where Python 3.9.0 (or higher) is installed.

Snowflake Documentation is available at:
https://docs.snowflake.com/
Expand All @@ -27,7 +27,7 @@ https://community.snowflake.com/s/article/How-To-Submit-a-Support-Case-in-Snowfl

### Locally

Install Python 3.8.0 or higher. Clone the Snowflake Connector for Python repository, then run the following commands
Install a supported Python version. Clone the Snowflake Connector for Python repository, then run the following commands
to create a wheel package using PEP-517 build:

```shell
Expand All @@ -42,7 +42,7 @@ Find the `snowflake_connector_python*.whl` package in the `./dist` directory.
### In Docker
Or use our Dockerized build script `ci/build_docker.sh` and find the built wheel files in `dist/repaired_wheels`.

Note: `ci/build_docker.sh` can be used to compile only certain versions, like this: `ci/build_docker.sh "3.8 3.9"`
Note: `ci/build_docker.sh` can be used to compile only certain versions, like this: `ci/build_docker.sh "3.9 3.10"`

## Code hygiene and other utilities
These tools are integrated into `tox` to allow us to easily set them up universally on any computer.
Expand Down
8 changes: 2 additions & 6 deletions ci/build_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
#
# Build Snowflake Python Connector on Mac
# NOTES:
# - To compile only a specific version(s) pass in versions like: `./build_darwin.sh "3.8 3.9"`
# - To compile only a specific version(s) pass in versions like: `./build_darwin.sh "3.9 3.10"`
arch=$(uname -m)
if [[ "$arch" == "arm64" ]]; then
PYTHON_VERSIONS="${1:-3.8 3.9 3.10 3.11 3.12}"
else
PYTHON_VERSIONS="${1:-3.8 3.9 3.10 3.11 3.12}"
fi
PYTHON_VERSIONS="${1:-3.9 3.10 3.11 3.12, 3.13}"

THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONNECTOR_DIR="$(dirname "${THIS_DIR}")"
Expand Down
2 changes: 1 addition & 1 deletion ci/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Build Snowflake Python Connector in Docker
# NOTES:
# - To compile only a specific version(s) pass in versions like: `./build_docker.sh "3.8 3.9"`
# - To compile only a specific version(s) pass in versions like: `./build_docker.sh "3.9 3.10"`
set -o pipefail

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
4 changes: 2 additions & 2 deletions ci/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Build Snowflake Python Connector on Linux
# NOTES:
# - This is designed to ONLY be called in our build docker image
# - To compile only a specific version(s) pass in versions like: `./build_linux.sh "3.8 3.9"`
# - To compile only a specific version(s) pass in versions like: `./build_linux.sh "3.9 3.10"`
set -o pipefail

U_WIDTH=16
PYTHON_VERSIONS="${1:-3.8 3.9 3.10 3.11 3.12}"
PYTHON_VERSIONS="${1:-3.9 3.10 3.11 3.12 3.13}"
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONNECTOR_DIR="$(dirname "${THIS_DIR}")"
DIST_DIR="${CONNECTOR_DIR}/dist"
Expand Down
4 changes: 2 additions & 2 deletions ci/build_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
SET SCRIPT_DIR=%~dp0
SET CONNECTOR_DIR=%~dp0\..\

set python_versions= 3.8 3.9 3.10 3.11 3.12
set python_versions= 3.9 3.10 3.11 3.12 3.13

cd %CONNECTOR_DIR%

set venv_dir=%WORKSPACE%\venv-flake8
if %errorlevel% neq 0 goto :error

py -3.8 -m venv %venv_dir%
py -3.9 -m venv %venv_dir%
if %errorlevel% neq 0 goto :error

call %venv_dir%\scripts\activate
Expand Down
2 changes: 0 additions & 2 deletions ci/docker/connector_build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ WORKDIR /home/user
RUN chmod 777 /home/user
RUN git clone https://github.com/matthew-brett/multibuild.git && cd /home/user/multibuild && git checkout bfc6d8b82d8c37b8ca1e386081fd800e81c6ab4a

ENV PATH="${PATH}:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin:/opt/python/cp310-cp310/bin:/opt/python/cp311-cp311/bin:/opt/python/cp312-cp312/bin"

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
1 change: 0 additions & 1 deletion ci/docker/connector_test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ RUN chmod +x /usr/local/bin/entrypoint.sh

WORKDIR /home/user
RUN chmod 777 /home/user
ENV PATH="${PATH}:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin/:/opt/python/cp39-cp39/bin/:/opt/python/cp310-cp310/bin/:/opt/python/cp311-cp311/bin/:/opt/python/cp312-cp312/bin/"

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
3 changes: 1 addition & 2 deletions ci/docker/connector_test_lambda/Dockerfile38
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ RUN yum install -y git

WORKDIR /home/user/snowflake-connector-python
RUN chmod 777 /home/user/snowflake-connector-python
ENV PATH="${PATH}:/opt/python/cp38-cp38/bin/"
ENV PYTHONPATH="${PYTHONPATH}:/home/user/snowflake-connector-python/ci/docker/connector_test_lambda/"

RUN pip3 install -U pip setuptools wheel tox>=4
RUN python3.8 -m pip install -U pip setuptools wheel tox>=4

CMD [ "app.handler" ]
4 changes: 2 additions & 2 deletions ci/test_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#
# Test Snowflake Connector on a Darwin Jenkins slave
# NOTES:
# - Versions to be tested should be passed in as the first argument, e.g: "3.8 3.9". If omitted 3.8-3.11 will be assumed.
# - Versions to be tested should be passed in as the first argument, e.g: "3.9 3.10". If omitted 3.8-3.11 will be assumed.
# - This script uses .. to download the newest wheel files from S3

PYTHON_VERSIONS="${1:-3.8 3.9 3.10 3.11 3.12}"
PYTHON_VERSIONS="${1:-3.9 3.10 3.11 3.12 3.13}"
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONNECTOR_DIR="$( dirname "${THIS_DIR}")"
PARAMETERS_DIR="${CONNECTOR_DIR}/.github/workflows/parameters/public"
Expand Down
6 changes: 3 additions & 3 deletions ci/test_docker.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash -e
# Test Snowflake Python Connector in Docker
# NOTES:
# - By default this script runs Python 3.8 tests, as these are installed in dev vms
# - To compile only a specific version(s) pass in versions like: `./test_docker.sh "3.8 3.9"`
# - By default this script runs Python 3.9 tests, as these are installed in dev vms
# - To compile only a specific version(s) pass in versions like: `./test_docker.sh "3.9 3.10"`

set -o pipefail

# In case this is ran from dev-vm
PYTHON_ENV=${1:-3.8}
PYTHON_ENV=${1:-3.9}

# Set constants
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
4 changes: 2 additions & 2 deletions ci/test_fips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck disable=SC1090
CONNECTOR_DIR="$( dirname "${THIS_DIR}")"
CONNECTOR_WHL="$(ls $CONNECTOR_DIR/dist/*cp38*manylinux2014*.whl | sort -r | head -n 1)"
CONNECTOR_WHL="$(ls $CONNECTOR_DIR/dist/*cp39*manylinux2014*.whl | sort -r | head -n 1)"

python3.8 -m venv fips_env
python3.9 -m venv fips_env
source fips_env/bin/activate
pip install -U setuptools pip
pip install "${CONNECTOR_WHL}[pandas,secure-local-storage,development]"
Expand Down
6 changes: 3 additions & 3 deletions ci/test_fips_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONNECTOR_DIR="$( dirname "${THIS_DIR}")"
# In case this is not run locally and not on Jenkins

if [[ ! -d "$CONNECTOR_DIR/dist/" ]] || [[ $(ls $CONNECTOR_DIR/dist/*cp38*manylinux2014*.whl) == '' ]]; then
if [[ ! -d "$CONNECTOR_DIR/dist/" ]] || [[ $(ls $CONNECTOR_DIR/dist/*cp39*manylinux2014*.whl) == '' ]]; then
echo "Missing wheel files, going to compile Python connector in Docker..."
$THIS_DIR/build_docker.sh 3.8
cp $CONNECTOR_DIR/dist/repaired_wheels/*cp38*manylinux2014*.whl $CONNECTOR_DIR/dist/
$THIS_DIR/build_docker.sh 3.9
cp $CONNECTOR_DIR/dist/repaired_wheels/*cp39*manylinux2014*.whl $CONNECTOR_DIR/dist/
fi

cd $THIS_DIR/docker/connector_test_fips
Expand Down
2 changes: 1 addition & 1 deletion ci/test_lambda_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONNECTOR_DIR="$( dirname "${THIS_DIR}")"
PYTHON_VERSION="${1:-3.8}"
PYTHON_VERSION="${1:-3.9}"
PYTHON_SHORT_VERSION="$(echo "$PYTHON_VERSION" | tr -d .)"
# In case this is not run locally and not on Jenkins

Expand Down
Loading
Loading