Skip to content

Commit ba6e0f5

Browse files
Snow-2043523: windows support for Python 3.13 (#2275)
1 parent 2f346e4 commit ba6e0f5

File tree

7 files changed

+24
-32
lines changed

7 files changed

+24
-32
lines changed

.github/workflows/build_test.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,7 @@ jobs:
133133
download_name: win_amd64
134134
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
135135
cloud-provider: [aws, azure, gcp]
136-
# TODO: When there are prebuilt wheels accessible for our dependencies (i.e. numpy)
137-
# for Python 3.13 windows runs can be re-enabled. Currently, according to numpy:
138-
# "Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for
139-
# testing. You are advised not to use it for production."
140-
exclude:
141-
- os:
142-
image_name: windows-latest
143-
download_name: win_amd64
144-
python-version: "3.13"
136+
145137
steps:
146138
- uses: actions/checkout@v4
147139
- name: Set up Python
@@ -179,12 +171,17 @@ jobs:
179171
- name: Install tox
180172
run: python -m pip install tox>=4
181173
- name: Run tests
174+
# To run a single test on GHA use the below command:
175+
# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
182176
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit,integ,pandas,sso}-ci | sed 's/ /,/g'`
177+
183178
env:
184179
PYTHON_VERSION: ${{ matrix.python-version }}
185180
cloud_provider: ${{ matrix.cloud-provider }}
186181
PYTEST_ADDOPTS: --color=yes --tb=short
187182
TOX_PARALLEL_NO_SPINNER: 1
183+
# To specify the test name (in single test mode) pass this env variable:
184+
# SINGLE_TEST_NAME: test/file/path::test_name
188185
shell: bash
189186
- name: Combine coverages
190187
run: python -m tox run -e coverage --skip-missing-interpreters false

DESCRIPTION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ https://docs.snowflake.com/
77
Source code is also available at: https://github.com/snowflakedb/snowflake-connector-python
88

99
# Release Notes
10+
- v3.16(TBD)
11+
- Bumped numpy dependency from <2.1.0 to <=2.2.4
12+
- Added Windows support for Python 3.13.
13+
1014
- v3.15.1(May 20, 2025)
1115
- Added basic arrow support for Interval types.
1216
- Fix `write_pandas` special characters usage in the location name.

ci/docker/connector_test/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ FROM $BASE_IMAGE
33

44
RUN yum install -y java-11-openjdk
55

6-
# TODO: When there are prebuilt wheels accessible for our dependencies (i.e. numpy)
7-
# for Python 3.13 this rust cargo install command can be removed.
6+
# Our dependencies rely on the Rust toolchain being available in the build-time environment (https://github.com/pyca/cryptography/issues/5771)
87
RUN yum -y install rust cargo
98

109
# This is to solve permission issue, read https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

ci/docker/connector_test_lambda/Dockerfile313

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,13 @@ FROM public.ecr.aws/lambda/python:3.13-x86_64
22

33
WORKDIR /home/user/snowflake-connector-python
44

5-
# TODO: When there are prebuilt wheels accessible for our dependencies (i.e. numpy)
6-
# for Python 3.13 all dnf ... commands installing building kits can be removed.
7-
8-
# Install necessary packages and compilers - we need to build numpy for newer version
9-
# Update dnf and install development tools
105
RUN dnf -y update && \
11-
dnf -y install \
12-
gcc \
13-
gcc-c++ \
14-
make \
15-
python3-devel \
16-
openblas-devel \
17-
lapack-devel && \
186
dnf clean all
7+
8+
# Our dependencies rely on the Rust toolchain being available in the build-time environment (https://github.com/pyca/cryptography/issues/5771)
199
RUN dnf -y install rust cargo
2010
RUN dnf -y upgrade
2111

22-
2312
RUN chmod 777 /home/user/snowflake-connector-python
2413
ENV PATH="${PATH}:/opt/python/cp313-cp313/bin/"
2514
ENV PYTHONPATH="${PYTHONPATH}:/home/user/snowflake-connector-python/ci/docker/connector_test_lambda/"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ development =
8383
Cython
8484
coverage
8585
more-itertools
86-
numpy<2.1.0
86+
numpy<=2.2.4
8787
pendulum!=2.1.1
8888
pexpect
8989
pytest<7.5.0

src/snowflake/connector/file_transfer_agent.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from typing import IO, TYPE_CHECKING, Any, Callable, TypeVar
1717

1818
from .azure_storage_client import SnowflakeAzureRestClient
19-
from .compat import GET_CWD, IS_WINDOWS
19+
from .compat import IS_WINDOWS
2020
from .constants import (
2121
AZURE_CHUNK_SIZE,
2222
AZURE_FS,
@@ -839,17 +839,17 @@ def _expand_filenames(self, locations: list[str]) -> list[str]:
839839
for file_name in locations:
840840
if self._command_type == CMD_TYPE_UPLOAD:
841841
file_name = os.path.expanduser(file_name)
842-
if not os.path.isabs(file_name):
843-
file_name = os.path.join(GET_CWD(), file_name)
844842
if (
845843
IS_WINDOWS
846844
and len(file_name) > 2
847845
and file_name[0] == "/"
848846
and file_name[2] == ":"
849847
):
850-
# Windows path: /C:/data/file1.txt where it starts with slash
851-
# followed by a drive letter and colon.
848+
# Since python 3.13 os.path.isabs returns different values for URI or paths starting with a '/' etc. on Windows (https://github.com/python/cpython/issues/125283)
849+
# Windows path: /C:/data/file1.txt is not treated as absolute - could be prefixed with another Windows driver's letter and colon.
852850
file_name = file_name[1:]
851+
if not os.path.isabs(file_name):
852+
file_name = os.path.abspath(file_name)
853853
files = glob.glob(file_name)
854854
canonical_locations += files
855855
else:

tox.ini

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ source = src/snowflake/connector
1818
[tox]
1919
minversion = 4
2020
envlist = fix_lint,
21-
py{39,310,311,312,313}-{extras,unit-parallel,integ,pandas,sso},
21+
py{39,310,311,312,313}-{extras,unit-parallel,integ,pandas,sso,single},
2222
coverage
2323
skip_missing_interpreters = true
2424

@@ -38,6 +38,7 @@ setenv =
3838
auth: SNOWFLAKE_TEST_TYPE = auth
3939
unit: SNOWFLAKE_TEST_TYPE = unit
4040
integ: SNOWFLAKE_TEST_TYPE = integ
41+
single: SNOWFLAKE_TEST_TYPE = single
4142
parallel: SNOWFLAKE_PYTEST_OPTS = {env:SNOWFLAKE_PYTEST_OPTS:} -n auto
4243
# Add common parts into pytest command
4344
SNOWFLAKE_PYTEST_COV_LOCATION = {env:JUNIT_REPORT_DIR:{toxworkdir}}/junit.{envname}-{env:cloud_provider:dev}.xml
@@ -53,6 +54,7 @@ passenv =
5354
# Github Actions provided environmental variables
5455
GITHUB_ACTIONS
5556
JENKINS_HOME
57+
SINGLE_TEST_NAME
5658
# This is required on windows. Otherwise pwd module won't be imported successfully,
5759
# see https://github.com/tox-dev/tox/issues/1455
5860
USERNAME
@@ -61,11 +63,12 @@ passenv =
6163
commands =
6264
# Test environments
6365
# Note: make sure to have a default env and all the other special ones
64-
!pandas-!sso-!lambda-!extras: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and not sso and not pandas and not lambda" {posargs:} test
66+
!pandas-!sso-!lambda-!extras-!single: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and not sso and not pandas and not lambda" {posargs:} test
6567
pandas: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and pandas" {posargs:} test
6668
sso: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and sso" {posargs:} test
6769
lambda: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and lambda" {posargs:} test
6870
extras: python -m test.extras.run {posargs:}
71+
single: {env:SNOWFLAKE_PYTEST_CMD} -s "{env:SINGLE_TEST_NAME}" {posargs:}
6972

7073
[testenv:olddriver]
7174
basepython = python3.9

0 commit comments

Comments
 (0)