Skip to content
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
8 changes: 3 additions & 5 deletions .azuredevops/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ jobs:
UV_PYTHON: $(pythonVersion)
UV_CACHE_DIR: $(Pipeline.Workspace)/uv-cache
strategy:
maxParallel: '5'
maxParallel: '4'
matrix:
Python39:
pythonVersion: '3.9'
Python310:
pythonVersion: '3.10'
Python311:
Expand Down Expand Up @@ -122,7 +120,7 @@ jobs:

- bash: poe docs --ci
displayName: Generate documentation
condition: and(succeeded(), eq(variables['pythonVersion'], '3.9'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
condition: and(succeeded(), eq(variables['pythonVersion'], '3.10'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

- task: PublishPipelineArtifact@1
displayName: Upload test results
Expand All @@ -143,7 +141,7 @@ jobs:

- task: PublishPipelineArtifact@1
displayName: Publish documentation
condition: and(succeeded(), eq(variables['pythonVersion'], '3.9'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
condition: and(succeeded(), eq(variables['pythonVersion'], '3.10'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
targetPath: docs
artifact: documentation
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install uv and set the python version
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: '3.9'
python-version: '3.10'
enable-cache: true
- name: Build
run: uv build --all-packages
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
- \[BREAKING\] Minimum supported Python version is now 3.10 to use patched dependency releases.
- Prepared the SDK 7.0.0 release for the breaking Python requirement change.

### Fixed
- Updated vulnerable aiohttp, cryptography, OpenTelemetry, pytest, requests, and urllib3 dependencies.
- Enforced patched urllib3, cryptography, and data SDK minimums in published dependencies, including ingest-only upgrades.
- Aligned quick-start requirements with the workspace, including the patched tqdm minimum.

## [6.0.5] - 2026-11-24

### Added
Expand Down
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ poe test-e2e

### Continuous integration

The [Azure pipeline](.azuredevops/build.yml) uses the Python 3.9-3.13 matrix,
The [Azure pipeline](.azuredevops/build.yml) uses the Python 3.10-3.13 matrix,
uv dependency caching, formatting, linting, optional type checking,
and test/documentation artifacts.
Azure matrix jobs run in parallel, with up to five jobs at a time.
Azure matrix jobs run in parallel, with up to four jobs at a time.
Each trusted job runs unit tests with eight pytest workers, followed by E2E tests
with eight workers, allowing up to 40 E2E workers per pipeline run.
with eight workers, allowing up to 32 E2E workers per pipeline run.
E2E-only pytest fixtures retry individual Kusto requests up to five attempts with
randomized exponential backoff capped at 30 seconds, honoring a longer
`Retry-After` delay when supplied. Throttled requests are retried only when their
Expand All @@ -144,8 +144,7 @@ a further 30 seconds if needed. A hard timeout can interrupt table cleanup.
Concurrent pipeline runs still share backend capacity.
The suites write separate JUnit reports under `test-results/`, published together.
Python versions are provisioned with `uv python install`, rather than the hosted
agent's Python tool cache, so Python 3.9 does not depend on an Ubuntu-specific
package in the GitHub Actions Python registry.
agent's Python tool cache.
The GitHub Actions build workflow has been removed, including its suggested-change PR reviews
and GitHub Pages deployment. The Azure documentation artifact alone does not deploy the site.

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ Download a zip of the code via GitHub or PyPi. Then follow the same instructions
* `pip install azure-kusto-ingest[aio]`

## Minimum Requirements
* Python 3.9 and above
* Python 3.10 and above
Comment thread
Copilot marked this conversation as resolved.
Resolved
* Windows: 64-bit Python; the required `cryptography` release no longer supports 32-bit Windows.
* macOS: ARM64 Python; the required `cryptography` release no longer supports Intel macOS.
* See `pyproject.toml` files for dependencies

## Authentication methods:
Expand Down
4 changes: 2 additions & 2 deletions azure-kusto-data/azure/kusto/data/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ..response import KustoResponseDataSet

try:
from aiohttp import ClientResponse, ClientSession
from aiohttp import ClientResponse, ClientSession, ClientTimeout
except ImportError:
raise KustoAioSyntaxError()

Expand Down Expand Up @@ -183,7 +183,7 @@ async def _execute(
headers=request_headers,
json=request.json_payload,
data=request.payload,
timeout=timeout.seconds,
timeout=ClientTimeout(total=timeout.seconds),
proxy=self._proxy_url,
allow_redirects=False,
)
Expand Down
6 changes: 4 additions & 2 deletions azure-kusto-data/azure/kusto/data/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ def __init__(self, kcsb: Union[KustoConnectionStringBuilder, str]):
# Create a session object for connection pooling
self._session = requests.Session()

# urllib3's nested ClassVar/Final annotation is misread by the type checker.
adapter = HTTPAdapterWithSocketOptions(
socket_options=(HTTPConnection.default_socket_options or []) + self.compose_socket_options(), pool_maxsize=self._max_pool_size
socket_options=(HTTPConnection.default_socket_options or []) + self.compose_socket_options(), # pyright: ignore[reportOperatorIssue]
pool_maxsize=self._max_pool_size,
)
self._session.mount("http://", adapter)
self._session.mount("https://", adapter)
Expand All @@ -103,7 +105,7 @@ def set_http_retries(self, max_retries: int):
Set the number of HTTP retries to attempt
"""
adapter = HTTPAdapterWithSocketOptions(
socket_options=(HTTPConnection.default_socket_options or []) + self.compose_socket_options(),
socket_options=(HTTPConnection.default_socket_options or []) + self.compose_socket_options(), # pyright: ignore[reportOperatorIssue]
pool_maxsize=self._max_pool_size,
max_retries=max_retries,
)
Expand Down
11 changes: 6 additions & 5 deletions azure-kusto-data/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "azure-kusto-data"
version = "6.0.5"
version = "7.0.0"
description = "Kusto Data Client"
authors = [
{ name = "Microsoft Corporation", email = "kustalk@microsoft.com" },
Expand All @@ -11,17 +11,18 @@ urls = { "Repository" = "https://github.com/Azure/azure-kusto-python" }

dependencies = [
"python-dateutil>=2.9.0",
"requests>=2.32.4",
"requests>=2.33.0",
Comment thread
Copilot marked this conversation as resolved.
Resolved
"urllib3>=2.8.0",
Comment thread
Copilot marked this conversation as resolved.
Resolved
"cryptography>=50.0.2",
"azure-identity>=1.25.3,<2",
"msal>=1.35.1,<2",
"ijson>=3.4.0,<3.7.0",
"azure-core>=1.35.0,<2"
]
requires-python = ">= 3.9"
requires-python = ">= 3.10"
keywords = ["azure", "kusto", "data", "analytics"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -34,7 +35,7 @@ pandas = [
"pandas>=2.3.1",
]
aio = [
"aiohttp>=3.12.15",
"aiohttp>=3.14.4",
"asgiref>=3.9.1",
]

Expand Down
25 changes: 22 additions & 3 deletions azure-kusto-data/tests/aio/test_kusto_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for KustoClient."""

import json
from datetime import timedelta
from unittest.mock import patch

import pytest
Expand All @@ -19,6 +20,12 @@

@aio_documented_by(KustoClientTestsSync)
class TestKustoClient(KustoClientTestsMixin):
_response_class = ClientResponse

@pytest.fixture(autouse=True)
def _mock_response_class(self, aiohttp_mock_response: type[ClientResponse]):
self._response_class = aiohttp_mock_response

@aio_documented_by(KustoClientTestsSync.test_no_redirects)
@pytest.mark.asyncio
async def test_no_redirects(self, redirect_server: tuple[str, int, list[str]]) -> None:
Expand All @@ -31,10 +38,9 @@ async def test_no_redirects(self, redirect_server: tuple[str, int, list[str]]) -
assert error.value.http_response.status == code
assert requests_seen == ["/v2/rest/query"]

@staticmethod
def _mock_callback(url, **kwargs):
def _mock_callback(self, url, **kwargs):
body = json.dumps(mocked_requests_post(str(url), **kwargs).json())
return CallbackResult(status=200, body=body)
return CallbackResult(status=200, body=body, response_class=self._response_class)

def _mock_query(self, aioresponses_mock):
url = "{host}/v2/rest/query".format(host=self.HOST)
Expand Down Expand Up @@ -68,6 +74,19 @@ async def test_sanity_query(self):
self._assert_client_request_id(first_request[0].kwargs)
self._assert_sanity_query_response(response)

@pytest.mark.asyncio
@pytest.mark.parametrize("timeout, expected_seconds", [(None, 300), (timedelta(seconds=12), 42)])
async def test_request_timeout(self, timeout, expected_seconds):
properties = ClientRequestProperties()
if timeout is not None:
properties.set_option(ClientRequestProperties.request_timeout_option_name, timeout)
with aioresponses() as aioresponses_mock:
self._mock_query(aioresponses_mock)
async with KustoClient(self.HOST) as client:
await client.execute_query("PythonTest", "Deft", properties=properties)
first_request = next(iter(aioresponses_mock.requests.values()))
assert first_request[0].kwargs["timeout"].total == expected_seconds

@pytest.mark.asyncio
async def test_raise_network(self):
with aioresponses() as aioresponses_mock:
Expand Down
7 changes: 3 additions & 4 deletions azure-kusto-ingest/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
[project]
name = "azure-kusto-ingest"
version = "6.0.5"
version = "7.0.0"
description = "Kusto Ingest Client"
authors = [
{ name = "Microsoft Corporation", email = "kustalk@microsoft.com" },
]
dependencies = [
"azure-kusto-data",
"azure-kusto-data>=7.0.0",
# TODO - this has to be locked to this version due to https://github.com/Azure/azure-sdk-for-python/issues/40041
"azure-storage-blob==12.26.0",
"azure-storage-queue==12.13.0",
"tenacity>=9.1.2",
]
readme = "README.rst"
requires-python = ">= 3.9"
requires-python = ">= 3.10"
Comment thread
aasavbadera marked this conversation as resolved.
Resolved
license = "MIT"
keywords = ["azure", "kusto", "ingest", "data", "analytics"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down
10 changes: 7 additions & 3 deletions azure-kusto-ingest/tests/test_e2e_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ async def test_retry_transient_query_async(status):


@pytest.mark.asyncio
async def test_async_client_throttling_response_respects_retry_after(retry_sleeps):
async def test_async_client_throttling_response_respects_retry_after(retry_sleeps, aiohttp_mock_response):
endpoint = "https://dummy.kusto.windows.net/v1/rest/mgmt"
with aioresponses() as responses:
responses.post(endpoint, status=429, payload={}, headers={"Retry-After": "60"})
responses.post(endpoint, payload={"Tables": [{"TableName": "Table_0", "Columns": [{"ColumnName": "TableName", "DataType": "String"}], "Rows": []}]})
responses.post(endpoint, status=429, payload={}, headers={"Retry-After": "60"}, response_class=aiohttp_mock_response)
responses.post(
endpoint,
payload={"Tables": [{"TableName": "Table_0", "Columns": [{"ColumnName": "TableName", "DataType": "String"}], "Rows": []}]},
response_class=aiohttp_mock_response,
)
async with AsyncKustoClient("https://dummy.kusto.windows.net") as client:
await retry_request_async(make_request(".show tables"), lambda: client.execute_mgmt("db", ".show tables"))

Expand Down
13 changes: 13 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
from typing import Iterator, Optional
from unittest.mock import Mock

import pytest
from aiohttp import ClientResponse

from azure.kusto.data import ClientRequestProperties, KustoClient
from azure.kusto.data.aio import KustoClient as AsyncKustoClient
from azure.kusto.data.client_base import ExecuteRequestParams
from e2e_retry import retry_request, retry_request_async


@pytest.fixture
def aiohttp_mock_response() -> type[ClientResponse]:
# aioresponses does not yet supply aiohttp 3.14's required stream_writer.
class MockClientResponse(ClientResponse):
def __init__(self, *args, **kwargs):
kwargs["stream_writer"] = Mock(output_size=0)
super().__init__(*args, **kwargs)

return MockClientResponse


@pytest.fixture(scope="module", autouse=True)
def e2e_request_retries(request: pytest.FixtureRequest) -> Iterator[None]:
if request.path.name not in ("test_e2e_data.py", "test_e2e_ingest.py"):
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[project]
name = "azure-kusto-python"
version = "6.0.5"
version = "7.0.0"
description = "Microsoft Azure Kusto Python SDK"
dependencies = [
"azure-kusto-data",
"azure-kusto-ingest",
"quick-start",
]
readme = "README.md"
requires-python = ">= 3.9"
requires-python = ">= 3.10"

[[project.authors]]
name = "Microsoft Corporation"
email = "kustalk@microsoft.com"

[dependency-groups]
dev = [
"pytest>=8.4.1",
"pytest>=9.0.3",
"pytest-xdist[psutil]>=3.8.0",
"pytest-asyncio>=1.1.0",
"responses>=0.25.8",
Expand All @@ -38,7 +38,7 @@ quick-start = { workspace = true }

[tool.ruff]
line-length = 160
target-version = 'py39'
target-version = 'py310'

[tool.ruff.lint]
ignore = ["E731"] # E731 - dont assign lambdas.
Expand Down Expand Up @@ -85,7 +85,7 @@ sequence = [{ cmd = "uv version --bump $bump" }, { cmd = "uv version --bump $bum
args = { bump = { help = "Bump version [possible values: major, minor, patch, stable, alpha, beta, rc, post, dev]", positional = true, default = "patch" } }

[tool.basedpyright]
pythonVersion = "3.9"
pythonVersion = "3.10"
reportUnnecessaryTypeIgnoreComment = false
reportExplicitAny = false
reportAny = false
Expand Down
2 changes: 1 addition & 1 deletion quick-start/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can use it as a baseline to write your own first kusto client application, a

### Prerequisites

1. Set up Python version 3.8 or higher on your machine. For instructions, consult a Python environment setup tutorial, like [this](https://www.tutorialspoint.com/python/python_environment.htm).
1. Set up Python version 3.10 or higher on your machine. For instructions, consult a Python environment setup tutorial, like [this](https://www.tutorialspoint.com/python/python_environment.htm).

### Retrieving the app from GitHub

Expand Down
8 changes: 4 additions & 4 deletions quick-start/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[project]
name = "quick-start"
version = "6.0.5"
version = "7.0.0"
description = "Microsoft Azure Kusto Python SDK"
dependencies = [
"azure-kusto-data",
"azure-kusto-ingest",
"azure-core-tracing-opentelemetry ~= 1.0.0b12",
"azure-monitor-opentelemetry-exporter ~= 1.0.0b41",
"azure-monitor-opentelemetry-exporter ~= 1.0.0b59",
"inflection ~= 0.5.1",
"opentelemetry-sdk ~= 1.36.0",
"opentelemetry-sdk ~= 1.45.2",
"tqdm ~= 4.67.1",
]
readme = "README.md"
requires-python = ">= 3.8"
requires-python = ">= 3.10"

[[project.authors]]
name = "Microsoft Corporation"
Expand Down
12 changes: 6 additions & 6 deletions quick-start/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
azure-core-tracing-opentelemetry~=1.0.0b9
azure-kusto-data>=4.0.0,<7.0.0
azure-kusto-ingest>=4.0.0,<7.0.0
azure-monitor-opentelemetry-exporter~=1.0.0b7
azure-core-tracing-opentelemetry~=1.0.0b12
azure-kusto-data>=7.0.0,<8.0.0
azure-kusto-ingest>=7.0.0,<8.0.0
azure-monitor-opentelemetry-exporter~=1.0.0b59

inflection~=0.5.1
opentelemetry-sdk~=1.12.0
tqdm~=4.64.0
opentelemetry-sdk~=1.45.2
tqdm~=4.67.1
Loading