Skip to content

Commit 4bb4280

Browse files
pieternrauchy
andauthored
Drop support for Python 3.8 and 3.9 (#1367)
## Summary * Raise minimum Python version to 3.10, matching the oldest supported Databricks Runtime LTS (DBR 13.3). * Bump pinned dependencies to resolve Dependabot security alerts. * Remove version-guarded code paths for Python <3.10. ## Test plan - [ ] CI passes on Python 3.10, 3.11, 3.12 (Ubuntu + Windows) This pull request was AI-assisted by Isaac. --------- Co-authored-by: Omer Lachish <rauchy@users.noreply.github.com>
1 parent 165b3ec commit 4bb4280

8 files changed

Lines changed: 178 additions & 2300 deletions

File tree

.github/workflows/push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
pyVersion: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
15+
pyVersion: [ '3.10', '3.11', '3.12' ]
1616
with:
1717
os: ubuntu-latest
1818
pyVersion: ${{ matrix.pyVersion }}
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
pyVersion: [ '3.9', '3.10', '3.11', '3.12' ]
25+
pyVersion: [ '3.10', '3.11', '3.12' ]
2626
with:
2727
os: windows-latest
2828
pyVersion: ${{ matrix.pyVersion }}

NEXT_CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
### Documentation
1313

14+
### Breaking Changes
15+
* Drop support for Python 3.8 and 3.9. The minimum supported Python version is now 3.10, in line with the oldest supported Databricks Runtime LTS (DBR 13.3).
16+
1417
### Internal Changes
1518
* Replace the async-disabling mechanism on token refresh failure with a 1-minute retry backoff. Previously, a single failed async refresh would disable proactive token renewal until the token expired. Now, the SDK waits a short cooldown period and retries, improving resilience to transient errors.
1619
* Extract `_resolve_profile` to simplify config file loading and improve `__settings__` error messages.

databricks/sdk/config.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import pathlib
77
import re
8-
import sys
98
import urllib.parse
109
from typing import Dict, Iterable, List, Optional
1110

@@ -614,15 +613,9 @@ def attributes(cls) -> Iterable[ConfigAttribute]:
614613
"""Returns a list of Databricks SDK configuration metadata"""
615614
if hasattr(cls, "_attributes"):
616615
return cls._attributes
617-
if sys.version_info[1] >= 10:
618-
import inspect
616+
import inspect
619617

620-
anno = inspect.get_annotations(cls)
621-
else:
622-
# Python 3.7 compatibility: getting type hints require extra hop, as described in
623-
# "Accessing The Annotations Dict Of An Object In Python 3.9 And Older" section of
624-
# https://docs.python.org/3/howto/annotations.html
625-
anno = cls.__dict__["__annotations__"]
618+
anno = inspect.get_annotations(cls)
626619
attrs = []
627620
for name, v in cls.__dict__.items():
628621
if type(v) != ConfigAttribute:

databricks/sdk/mixins/files.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import platform
1010
import re
1111
import shutil
12-
import sys
1312
import xml.etree.ElementTree as ET
1413
from abc import ABC, abstractmethod
1514
from collections import deque
@@ -430,10 +429,7 @@ def delete(self, *, recursive=False):
430429
_LocalPath(leaf.path).delete()
431430
self._path.rmdir()
432431
else:
433-
kw = {}
434-
if sys.version_info[:2] > (3, 7):
435-
kw["missing_ok"] = True
436-
self._path.unlink(**kw)
432+
self._path.unlink(missing_ok=True)
437433

438434
def __repr__(self) -> str:
439435
return f"<_LocalPath {self._path}>"

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ name = "databricks-sdk"
77
dynamic = ["version"]
88
description = "Databricks SDK for Python (Beta)"
99
readme = "README.md"
10-
requires-python = ">=3.8"
10+
requires-python = ">=3.10"
1111
keywords = ["databricks", "sdk"]
1212
classifiers = [
1313
"Development Status :: 4 - Beta",
1414
"Intended Audience :: Developers",
1515
"Intended Audience :: Science/Research",
1616
"Intended Audience :: System Administrators",
1717
"License :: OSI Approved :: Apache Software License",
18-
"Programming Language :: Python :: 3.8",
19-
"Programming Language :: Python :: 3.9",
2018
"Programming Language :: Python :: 3.10",
2119
"Programming Language :: Python :: 3.11",
2220
"Programming Language :: Python :: 3.12",
@@ -52,7 +50,7 @@ dev = [
5250
"databricks-connect",
5351
"pytest-rerunfailures",
5452
"openai",
55-
'langchain-openai; python_version >= "3.9"',
53+
"langchain-openai",
5654
"httpx",
5755
"build", # some integration tests depend on the databricks-sdk-py wheel
5856
"check-manifest",
@@ -63,7 +61,7 @@ notebook = [
6361
]
6462
openai = [
6563
"openai",
66-
'langchain-openai; python_version >= "3.9"',
64+
"langchain-openai",
6765
"httpx",
6866
]
6967

@@ -78,11 +76,11 @@ include = ["databricks", "databricks.*"]
7876

7977
[tool.black]
8078
line-length = 120
81-
target-version = ['py38', 'py39', 'py310', 'py311','py312','py313']
79+
target-version = ['py310', 'py311','py312','py313']
8280

8381
[tool.pyright]
8482
include = ["."]
8583
exclude = ["**/node_modules", "**/__pycache__"]
8684
reportMissingImports = true
8785
reportMissingTypeStubs = false
88-
pythonVersion = "3.8"
86+
pythonVersion = "3.10"

tests/integration/test_auth.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ def test_runtime_auth_from_jobs_volumes(ucws, files_api, fresh_wheel_file, env_o
123123

124124

125125
def test_runtime_auth_from_jobs_dbfs(w, fresh_wheel_file, env_or_skip, random):
126-
# Library installation from DBFS is not supported past DBR 14.3
127-
dbr_versions = [v for v in _get_lts_versions(w) if int(v.key.split(".")[0]) < 15]
126+
# Library installation from DBFS is not supported past DBR 14.3.
127+
# DBR < 13 ships Python < 3.10 which is below our requires-python.
128+
dbr_versions = [v for v in _get_lts_versions(w) if 13 <= int(v.key.split(".")[0]) < 15]
128129

129130
dbfs_wheel = f"/tmp/wheels/{random(10)}/{fresh_wheel_file.name}"
130131
with fresh_wheel_file.open("rb") as f:

tests/test_open_ai_mixin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
import warnings
32
from io import BytesIO
43

@@ -80,7 +79,6 @@ def test_open_ai_client_prevents_reserved_param_override(monkeypatch):
8079
w.serving_endpoints.get_open_ai_client(base_url="https://custom-host", api_key="custom-key")
8180

8281

83-
@pytest.mark.skipif(sys.version_info < (3, 8), reason="Requires Python > 3.7")
8482
def test_langchain_open_ai_client(monkeypatch):
8583
from unittest.mock import MagicMock, Mock
8684

@@ -163,7 +161,6 @@ def test_get_open_ai_client_deprecation_warning(monkeypatch):
163161
assert client.api_key == "no-token"
164162

165163

166-
@pytest.mark.skipif(sys.version_info < (3, 8), reason="Requires Python > 3.7")
167164
def test_get_langchain_chat_open_ai_client_deprecation_warning(monkeypatch):
168165
"""Test that get_langchain_chat_open_ai_client raises a DeprecationWarning."""
169166
from unittest.mock import MagicMock, Mock

0 commit comments

Comments
 (0)