Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1f2c616
Move to uv
AsafMah Jan 8, 2025
84f8faf
Merge branch 'master' into uv
AsafMah May 18, 2025
e881cfd
Bump version
AsafMah May 18, 2025
8450137
Formatting
AsafMah May 18, 2025
108a7de
Ruff fixes
AsafMah May 18, 2025
7546c72
Ruff fixes
AsafMah May 18, 2025
ae8a141
Typing fixes
AsafMah May 18, 2025
597b572
poe
AsafMah May 19, 2025
dd89702
Move to new namespace packages
AsafMah Jun 8, 2025
d868752
Merge remote-tracking branch 'origin/master' into uv-fixes
AsafMah Aug 13, 2025
27ea229
Updates
AsafMah Aug 13, 2025
8a6b874
release.yml
AsafMah Aug 13, 2025
3afbe14
Update version retrieval and simplify test command in CI configuration
AsafMah Aug 13, 2025
102b2ac
Update version retrieval and simplify test command in CI configuration
AsafMah Aug 13, 2025
81401a4
Revert external changes
AsafMah Aug 13, 2025
81ef0dc
Test
AsafMah Aug 13, 2025
85b8dff
Test
AsafMah Aug 13, 2025
44dfb02
Test
AsafMah Aug 13, 2025
a2cdbee
Test
AsafMah Aug 13, 2025
d9e32c0
Test
AsafMah Aug 13, 2025
fef5f84
Test
AsafMah Aug 13, 2025
659f5af
Test
AsafMah Aug 13, 2025
fb48599
Restore build
AsafMah Aug 13, 2025
f36273c
Try parallelize tests
AsafMah Aug 13, 2025
cff933a
Try parallelize tests
AsafMah Aug 13, 2025
d43c81d
Remove failing test
AsafMah Aug 13, 2025
b5f78d9
Added docs and tasks
AsafMah Aug 13, 2025
58d647e
Upgrade yml
AsafMah Aug 13, 2025
64f9137
Add to azure-kusto-data
AsafMah Aug 14, 2025
ea79bd8
Docs
AsafMah Aug 17, 2025
965092b
Docs
AsafMah Aug 17, 2025
7d0c079
Test commiting docs dir
AsafMah Aug 17, 2025
74c16ff
Fix
AsafMah Aug 17, 2025
d122e22
Fix
AsafMah Aug 17, 2025
01c8997
Fixadd aio
AsafMah Aug 17, 2025
b6e3605
Fixadd aio
AsafMah Aug 17, 2025
c04faf1
Update changelog
AsafMah Aug 18, 2025
b4f97b6
Update changelog
AsafMah Aug 18, 2025
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
22 changes: 22 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# For e2e tests:
ENGINE_CONNECTION_STRING= # Format: https://<cluster_name>.<region>.kusto.windows.net
DM_CONNECTION_STRING= # Optional - if not set, will infer from ENGINE_CONNECTION_STRING. Format: https://ingest-<cluster_name>.<region>.kusto.windows.net
TEST_DATABASE=

# For credential tests:

# app key provider:
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_TENANT_ID=
# certificate provider:
CERT_THUMBPRINT=
CERT_PUBLIC_CERT_PATH=
CERT_PEM_KEY_PATH=
# managed identity provider:
MSI_OBJECT_ID=
MSI_CLIENT_ID=
# user password provider:
USER_NAME=
USER_PASS=
USER_AUTH_ID=
42 changes: 18 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment: build

strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
env:
PYTHON: ${{ matrix.python-version }}

Expand All @@ -31,44 +30,39 @@ jobs:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip --user
pip install -r dev_requirements.txt --user
pip install pytest-cov --user
pip install ./azure-kusto-data[aio,pandas] ./azure-kusto-ingest[aio,pandas] --user
pip freeze
# We have to use an old version of this plugin, as the new one assumes python 3.8
- uses: psf/black@c8f1a5542c257491e1e093b1404481ece7f7e02c
with:
options: "--check --diff --line-length 160"
version: "23.3.0"
enable-cache: true
- name: Install Poe
run: uv tool install poethepoet
- name: EtoE Test with pytest
env:
TEST_DATABASE: ${{ secrets.TEST_DATABASE }}
TEST_BLOB: ${{ secrets.TEST_BLOB }}
ENGINE_CONNECTION_STRING: ${{ secrets.ENGINE_CONNECTION_STRING }}
APPLICATION_INSIGHTS_ENGINE_CONNECTION_STRING: https://ade.applicationinsights.io/subscriptions/12534eb3-8109-4d84-83ad-576c0d5e1d06/resourcegroups/clients_e2e_test/providers/microsoft.insights/components/kusto-e2e-app-insights
APPLICATION_INSIGHTS_TEST_DATABASE: kusto-e2e-app-insights
run: |
pytest -v . --junit-xml pytest.xml --cov=/home/runner/.local/lib/python${{ matrix.python-version }}/site-packages/azure/kusto --cov-report=xml:coverage2.xml
run: poe test --ci

# todo: re-enable on a different PR
# - name: "Run Ruff Formatter"
# id: ruff-formatter
# uses: astral-sh/ruff-action@v3
# with:
# args: "format --diff"
#
# - name: "Run Ruff Linter"
# run: ruff check --diff

- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (Python ${{ matrix.python-version }})
path: pytest*.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
env_vars: PYTHON


publish-test-results:
name: "Publish Unit Tests Results"
needs: build
Expand Down
33 changes: 10 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,20 @@ jobs:
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build azure-kusto-data
working-directory: ./azure-kusto-data
run: |
python setup.py sdist bdist_wheel
- name: Build azure-kusto-ingest
working-directory: ./azure-kusto-ingest
run: |
python setup.py sdist bdist_wheel
- name: Publish azure-kusto-data
uses: pypa/gh-action-pypi-publish@release/v1
python-version: '3.9'
enable-cache: true
- name: Build
run: uv build --all-packages
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
packages-dir: azure-kusto-data/dist
- name: Publish azure-kusto-ingest
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: azure-kusto-ingest/dist
packages-dir: dist
- name: Release
uses: docker://antonyurchenko/git-release:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: azure-kusto-data/dist/*.tar.gz azure-kusto-ingest/dist/*.tar.gz azure-kusto-data/dist/*.whl azure-kusto-ingest/dist/*.whl
args: dist/*.tar.gz dist/*.whl
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,6 @@ build/
.mypy*


*/.tox/
*/.tox/

.env
3 changes: 0 additions & 3 deletions .pylintrc

This file was deleted.

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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.9, to align with other Azure SDKs.
- The project's infrastructure has been updated:
- `uv` is used to manage packages
- `ruff` is used for linting and formatting
- `basedpyright` is used for type checking
- `poe` is used to manage tasks
- `pdoc` is used to generate documentation

## [5.0.5] - 2025-07-20

### Added
Expand Down
97 changes: 76 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,60 @@ If you would like to become an active contributor to this project please
follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](https://azure.github.io/azure-sdk/python_documentation.html).

## Prerequisites

### Cluster
In order to run E2E tests, you need a Kusto database you have admin rights on.
A Kusto free cluster is the easiest way to acquire one.
You can cerate a free Kusto cluster here: https://dataexplorer.azure.com/home

Make sure you set streaming ingestion to enabled in the cluster's configuration:
https://learn.microsoft.com/en-us/azure/data-explorer/ingest-data-streaming?tabs=azure-portal%2Ccsharp

You should set then following environment vars where you run E2Es (in IDE run config, shell window, computer, etc).

### Tools

The project uses [uv](https://docs.astral.sh/uv/) as the project manager.
You will need to install it in order to develop on this project.

See [Installing uv](https://docs.astral.sh/uv/getting-started/installation/).

Additionally, the project uses [poethepoet](https://poethepoet.natn.io/index.html) as the task runner.

You can install it with uv:

```bash
uv tool install poethepoet

poe <command>
```

Or you can use `uvx` to use it directly without installing:

```bash
uvx poe <command>
```


### Environment Variables

Some tests require you to set environment variables to run.

The project supports a .env file, which you can create in the root of the project.
See [.env.example](./.env.example) for an example of a .env file.

#### E2E Tests Environment Variables

```shell
ENGINE_CONNECTION_STRING=<Your cluster URI>
DM_CONNECTION_STRING=<Your ingest cluster URI> # Optional - if not set, will infer from ENGINE_CONNECTION_STRING
ENGINE_CONNECTION_STRING=<Your cluster URI> # Format: https://<cluster_name>.<region>.kusto.windows.net
DM_CONNECTION_STRING=<Your ingest cluster URI> # Optional - if not set, will infer from ENGINE_CONNECTION_STRING. Format: https://ingest-<cluster_name>.<region>.kusto.windows.net
TEST_DATABASE=<The name of the database>
```

The E2E tests authenticate with DefaultAzureCredential, and will fall back to interactive login if needed.
The E2E tests authenticate with [DefaultAzureCredential](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python).

It is recommended to use the [azure cli](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) command `az login` to authenticate with your Azure account to run the tests.

For more information on DefaultAzureCredential, see:
https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python
#### Token Provider Tests

To run the optional `token_provider` tests, you will need to set the booleans at the top of the file `test_token_providers.py` and the following environment variables in addition to the previous ones:
```shell
Expand All @@ -43,41 +78,61 @@ USER_PASS=<Your user password>
USER_AUTH_ID=<Your user auth ID> # optional
```

## Requirements

In order to work on this project, we recommend using the dev requirements:
## Development

As mentioned before, this project uses `uv` and `poe` to manage the development environment and tasks.

To see the tasks available, you can run:

```bash
poe
```

### Setup

Setup the project by syncing `uv`:

```bash
pip install -r dev_requirements.txt
poe sync
```

These including testing related packages as well as styling ([black](https://black.readthedocs.io/en/stable/))
This will install the dependencies, set up the virtual environment, and install the tools needed for development.

## Building and Testing
### Testing

This project uses [pytest](https://docs.pytest.org/en/latest/).

To test the project, simply run:

```bash
poe test
```

Since the tests use the package as a third-party, the easiest way to set it up is installing it in edit mode:
To test without E2E tests, you can run:

```bash
pip install -e ./azure-kusto-data ./azure-kusto-ingest
poe test --no-e2e
```

After which, running tests is simple.
### Style

Just run:
This project uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting.

Before commiting your changes, make sure the code is properly formatted, or the commit will be rejected.

```bash
pytest ./azure-kusto-data ./azure-kusto-ingest
poe format # formats the code directly
poe check-format # returns a diff of what needs to be formatted
```

## Style

We use black, and allow for line-length of 160, so please run:
Also make sure to lint the code:

```bash
black --line-length=160 ./azure-kusto-data ./azure-kusto-ingest
poe lint

# You can auto-fix some issues with:
poe lint --fix
```

## PRs
Expand All @@ -90,7 +145,7 @@ We welcome contributions. In order to make the PR process efficient, please foll
* **Please provide any related information needed to understand the change** - docs, guidelines, use-case, best practices and so on. Opinions are accepted, but have to be backed up.
* **Checks should pass** - these including linting with black and running tests.

## Code of Conduct
# Code of Conduct
This project's code of conduct can be found in the
[CODE_OF_CONDUCT.md file](https://github.com/Azure/azure-sdk-for-python/blob/master/CODE_OF_CONDUCT.md)
(v1.4.0 of the http://contributor-covenant.org/ CoC).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To install via the Python Package Index (PyPI), type:
### Option 2: Source Via Git
To get the source code of the SDK via git just type:

```python
```bash
git clone https://github.com/Azure/azure-kusto-python
cd ./azure-kusto-python/azure-kusto-data
python3 setup.py install
Expand All @@ -35,7 +35,7 @@ Download a zip of the code via GitHub or PyPi. Then follow the same instructions
* `pip install azure-kusto-ingest[pandas]`

## Minimum Requirements
* Python 3.5 and above
* Python 3.9 and above
* See setup.py for dependencies

## Authentication methods:
Expand Down
5 changes: 0 additions & 5 deletions azure-kusto-data/MANIFEST.in

This file was deleted.

10 changes: 2 additions & 8 deletions azure-kusto-data/azure-kusto-data.iml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/azure" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/azure/kusto/data" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/azure_kusto_data.egg-info" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PackageRequirementsSettings">
<option name="requirementsPath" value="" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>
4 changes: 0 additions & 4 deletions azure-kusto-data/azure/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions azure-kusto-data/azure/kusto/__init__.py

This file was deleted.

4 changes: 3 additions & 1 deletion azure-kusto-data/azure/kusto/data/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
VERSION = "5.0.5"
import importlib.metadata

VERSION = importlib.metadata.version("azure-kusto-data")
2 changes: 2 additions & 0 deletions azure-kusto-data/azure/kusto/data/aio/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .client import KustoClient

__all__ = ["KustoClient"]
Loading
Loading