Python: [BREAKING] updated structure and samples (#875)

* updated structure and samples

* updated names and removed cross tests

* updated projects etc

* updated tests

* updated test

* test fixes

* removed devui for now

* updated all-tests task

* removed old style configs

* remove coverage from tests

* updated to unit tests with all-tests

* updated foundry everywhere

* fix azure ai tests

* fix merge tests

* fix mypy
This commit is contained in:
Eduard van Valkenburg
2025-09-25 09:02:53 +02:00
committed by GitHub
Unverified
parent 366a7f7d47
commit 9355329dfd
169 changed files with 1159 additions and 1761 deletions
+17 -75
View File
@@ -61,6 +61,9 @@ jobs:
OPENAI_RESPONSES_MODEL_ID: ${{ vars.OPENAI__RESPONSESMODELID }}
OPENAI_API_KEY: ${{ secrets.OPENAI__APIKEY }}
LOCAL_MCP_URL: ${{ vars.LOCAL_MCP__URL }}
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }}
AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }}
PACKAGE_NAME: "main"
defaults:
run:
@@ -76,6 +79,13 @@ jobs:
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Test with pytest
timeout-minutes: 10
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
@@ -104,8 +114,8 @@ jobs:
fail-on-empty: true
title: Test results
python-tests-azure:
name: Python Tests - Azure
python-tests-azure-ai:
name: Python Tests - AzureAI
needs: paths-filter
if: github.event_name != 'pull_request' && needs.paths-filter.outputs.pythonChanges == 'true'
runs-on: ${{ matrix.os }}
@@ -118,10 +128,9 @@ jobs:
environment: ["integration"]
env:
UV_PYTHON: ${{ matrix.python-version }}
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }}
AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }}
PACKAGE_NAME: "azure"
AZURE_AI_PROJECT_ENDPOINT: ${{ secrets.AZUREAI__ENDPOINT }}
AZURE_AI_MODEL_DEPLOYMENT_NAME: ${{ vars.AZUREAI__DEPLOYMENTNAME }}
PACKAGE_NAME: "azure-ai"
defaults:
run:
working-directory: python
@@ -150,7 +159,7 @@ jobs:
- name: Test azure samples
timeout-minutes: 10
if: env.RUN_SAMPLES_TESTS == 'true'
run: uv run pytest tests/samples/ -m "azure"
run: uv run pytest tests/samples/ -m "azure-ai"
working-directory: ./python
- name: Move coverage file
run: |
@@ -171,72 +180,6 @@ jobs:
fail-on-empty: true
title: Test results
python-tests-foundry:
name: Python Tests - Foundry
needs: paths-filter
if: github.event_name != 'pull_request' && needs.paths-filter.outputs.pythonChanges == 'true'
runs-on: ${{ matrix.os }}
environment: ${{ matrix.environment }}
strategy:
fail-fast: true
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
environment: ["integration"]
env:
UV_PYTHON: ${{ matrix.python-version }}
FOUNDRY_PROJECT_ENDPOINT: ${{ secrets.AZUREAI__ENDPOINT }}
FOUNDRY_MODEL_DEPLOYMENT_NAME: ${{ vars.AZUREAI__DEPLOYMENTNAME }}
PACKAGE_NAME: "foundry"
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v5
- name: Set up python and install the project
id: python-setup
uses: ./.github/actions/python-setup
with:
python-version: ${{ matrix.python-version }}
os: ${{ runner.os }}
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Test with pytest
timeout-minutes: 10
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
working-directory: ./python
- name: Test foundry samples
timeout-minutes: 10
if: env.RUN_SAMPLES_TESTS == 'true'
run: uv run pytest tests/samples/ -m "foundry"
working-directory: ./python
- name: Move coverage file
run: |
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ env.PACKAGE_NAME }}.xml
working-directory: ./python
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ env.PACKAGE_NAME }}
path: ./python/coverage_${{ env.PACKAGE_NAME }}.xml
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@v0.7.2
with:
path: ./python/**.xml
summary: true
display-options: fEX
fail-on-empty: true
title: Test results
# TODO: Add python-tests-lab
python-integration-tests-check:
@@ -245,8 +188,7 @@ jobs:
needs:
[
python-tests-main,
python-tests-azure,
python-tests-foundry
python-tests-azure-ai
]
steps:
+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
- name: Run all tests with coverage report
run: uv run poe all-tests -n logical --dist loadfile --dist worksteal --cov-report=xml:python-coverage.xml -q --junitxml=pytest.xml
run: uv run poe all-tests-cov --cov-report=xml:python-coverage.xml -q --junitxml=pytest.xml
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
+4 -94
View File
@@ -36,100 +36,10 @@ jobs:
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
# Main package tests
- name: Set environment variables - main - win
if: ${{ matrix.os == 'windows-latest' }}
run: |
echo "PACKAGE_NAME=main" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set environment variables - main
if: ${{ matrix.os != 'windows-latest' }}
run: |
echo "PACKAGE_NAME=main" >> $GITHUB_ENV
- name: Test with pytest - main
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
# Unit tests
- name: Run all tests
run: uv run poe all-tests
working-directory: ./python
- name: Move coverage file - main
run: |
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
working-directory: ./python
- name: Upload coverage artifact - main
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
# Azure package tests
- name: Set environment variables - azure - win
if: ${{ matrix.os == 'windows-latest' }}
run: |
echo "PACKAGE_NAME=azure" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set environment variables - azure
if: ${{ matrix.os != 'windows-latest' }}
run: |
echo "PACKAGE_NAME=azure" >> $GITHUB_ENV
- name: Test with pytest - azure
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
working-directory: ./python
- name: Move coverage file - azure
run: |
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
working-directory: ./python
- name: Upload coverage artifact - azure
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
# Foundry package tests
- name: Set environment variables - foundry - win
if: ${{ matrix.os == 'windows-latest' }}
run: |
echo "PACKAGE_NAME=foundry" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set environment variables - foundry
if: ${{ matrix.os != 'windows-latest' }}
run: |
echo "PACKAGE_NAME=foundry" >> $GITHUB_ENV
- name: Test with pytest - foundry
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
working-directory: ./python
- name: Move coverage file - foundry
run: |
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
working-directory: ./python
- name: Upload coverage artifact - foundry
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
# Lab package tests
- name: Set environment variables - lab - win
if: ${{ matrix.os == 'windows-latest' }}
run: |
echo "PACKAGE_NAME=lab" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set environment variables - lab
if: ${{ matrix.os != 'windows-latest' }}
run: |
echo "PACKAGE_NAME=lab" >> $GITHUB_ENV
- name: Test with pytest - lab - gaia
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/gaia test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
working-directory: ./python
- name: Test with pytest - lab - tau2
run: |
uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/tau2 setup-data
uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/tau2 test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/tau2 purge-data
working-directory: ./python
- name: Move coverage file - lab
run: |
mv ./packages/${{ env.PACKAGE_NAME }}/gaia/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}_gaia.xml
mv ./packages/${{ env.PACKAGE_NAME }}/tau2/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}_tau2.xml
working-directory: ./python
- name: Upload coverage artifact - lab
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}_*.xml
# Surface failing tests
- name: Surface failing tests
@@ -139,5 +49,5 @@ jobs:
path: ./python/**.xml
summary: true
display-options: fEX
fail-on-empty: true
fail-on-empty: false
title: Test results