Skip to content
Closed
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
45 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
481b677
Formatting
AsafMah Aug 13, 2025
976dedb
Safe lint fixes
AsafMah Aug 13, 2025
61abe0b
Safe lint fixes
AsafMah Aug 13, 2025
ac17eb2
More lint fixes
AsafMah Aug 13, 2025
bfee7fa
Final lints
AsafMah Aug 13, 2025
d82dd7a
Fix test
AsafMah Aug 14, 2025
8c7338d
Fix test
AsafMah Aug 14, 2025
6223767
Fix test
AsafMah Aug 14, 2025
f2b3db5
Fix test
AsafMah Aug 14, 2025
8036905
Update baseline
AsafMah Aug 14, 2025
f75195f
Try fix
AsafMah Aug 14, 2025
29f1458
Update helpers.py
AsafMah Aug 14, 2025
e812898
Try fix
AsafMah Aug 14, 2025
86f246a
test
AsafMah Aug 14, 2025
1835ed7
Update azure-kusto-data/azure/kusto/data/helpers.py
AsafMah Aug 14, 2025
f698638
Update azure-kusto-data/azure/kusto/data/helpers.py
AsafMah Aug 14, 2025
c4930ea
Try fix
AsafMah Aug 14, 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
36,880 changes: 36,880 additions & 0 deletions .basedpyright/baseline.json

Large diffs are not rendered by default.

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=
57 changes: 33 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:
push:
branches: [ master ]
pull_request:

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 +31,53 @@ 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

- name: "Run Ruff Formatter"
run: poe check-format
id: ruff-formatter
continue-on-error: true

- name: "Run Ruff Linter"
run: poe lint
id: ruff-linter
continue-on-error: true

- name: "Run Ruff Fixes"
id: fix-ruff
if: steps.ruff-formatter.outcome != 'success' || steps.ruff-linter.outcome != 'success'
run: poe fix

- uses: parkerbxyz/suggest-changes@v2
if: steps.fix-ruff.outcome == 'success'
with:
comment: 'Please commit the suggested changes from markdownlint.'
event: 'REQUEST_CHANGES'

- name: "Run Type Checking"
run: poe types

- 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.

107 changes: 87 additions & 20 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,43 +78,75 @@ 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
pip install -r dev_requirements.txt
poe
```

These including testing related packages as well as styling ([black](https://black.readthedocs.io/en/stable/))
### Setup

## Building and Testing
Setup the project by syncing `uv`:

```bash
poe sync
```

This will install the dependencies, set up the virtual environment, and install the tools needed for development.

### 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

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

Just run:
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
Also make sure to lint the code:

We use black, and allow for line-length of 160, so please run:
```bash
poe lint

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

### Types

This project uses [basedpyright](https://docs.basedpyright.com/) for type checking.

To check the types, run:

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

Note that we have a `baseline.json` file that is used to ignore old type errors, as we gradually add types to the codebase.

## PRs
We welcome contributions. In order to make the PR process efficient, please follow the below checklist:

Expand All @@ -90,7 +157,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).
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ 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
cd ../azure-kusto-ingest
python3 setup.py install
```

### Option 3: Source Zip
Expand All @@ -33,10 +29,13 @@ Download a zip of the code via GitHub or PyPi. Then follow the same instructions
* [_Pandas_](http://pandas.pydata.org/) - Package provides extra functionality for use with pandas. Since these are optional dependencies, install with pandas:
* `pip install azure-kusto-data[pandas]`
* `pip install azure-kusto-ingest[pandas]`
* [_aio_](http://pandas.pydata.org/) - Package provides async interfaces.
* `pip install azure-kusto-data[aio]`
* `pip install azure-kusto-ingest[aio]`

## Minimum Requirements
* Python 3.5 and above
* See setup.py for dependencies
* Python 3.9 and above
* See `pyproject.toml` files 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>
Loading
Loading