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
14 changes: 0 additions & 14 deletions .pre-commit-config.yaml

This file was deleted.

52 changes: 40 additions & 12 deletions eng/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
#!/bin/bash
set -e

# Install uv for faster dependency resolution / installation.
python -m pip install --upgrade pip
python -m pip install "setuptools>=62,<82.0"
python -m pip install -e runtimes/v2
python -m pip install -e runtimes/v1
python -m pip install -U azure-functions --pre
python -m pip install -U -e $2/[dev]

python -m pip install --pre -U -e $2/[test-http-v2]
python -m pip install --pre -U -e $2/[test-deferred-bindings]

SERVICEBUS_DIR="./servicebus_dir"
python -m pip install --pre -U --target "$SERVICEBUS_DIR" azurefunctions-extensions-bindings-servicebus==1.0.0b2
python -c "import sys; sys.path.insert(0, '$SERVICEBUS_DIR'); import azurefunctions.extensions.bindings.servicebus as sb; print('servicebus version:', sb.__version__)"
python -m pip install uv

# Use uv as a drop-in replacement for pip. `--system` installs into the active
# Python environment (the agent's Python), matching previous `pip install` behavior.
UV_PIP="python -m uv pip install --system"

# Setuptools is needed up front for editable installs of legacy packages.
$UV_PIP "setuptools>=62,<82.0"

# runtimes/v1 and runtimes/v2 require Python >= 3.13. Old pip would silently
# install them on lower versions; uv (correctly) refuses, so install them
# conditionally. They are only consumed by proxy_worker (Python >= 3.13).
PY_VER="$1"
PY_MINOR="${PY_VER#*.}"
EXTRA_ARGS=()
if [ "${PY_MINOR:-0}" -ge 13 ]; then
EXTRA_ARGS+=(-e runtimes/v2 -e runtimes/v1)
fi

# Install everything else in a single uv invocation so the resolver runs once
# and all wheels are downloaded in parallel.
$UV_PIP -U --prerelease=allow \
azure-functions \
-e "$2/[dev]" \
-e "$2/[test-http-v2]" \
-e "$2/[test-deferred-bindings]" \
"${EXTRA_ARGS[@]}"

# The servicebus binding extension depends on uamqp, which is deprecated and
# ships no wheels for Python 3.14 (source builds fail). Install it only on
# Python < 3.14, mirroring the eventhub binding gate in pyproject.toml.
if [ "${PY_MINOR:-0}" -lt 14 ]; then
SERVICEBUS_DIR="./servicebus_dir"
python -m uv pip install --prerelease=allow -U --target "$SERVICEBUS_DIR" azurefunctions-extensions-bindings-servicebus==1.0.0b2
python -c "import sys; sys.path.insert(0, '$SERVICEBUS_DIR'); import azurefunctions.extensions.bindings.servicebus as sb; print('servicebus version:', sb.__version__)"
else
echo "Skipping servicebus binding extension on Python $PY_VER (uamqp has no 3.14 wheels)."
fi
14 changes: 9 additions & 5 deletions eng/scripts/test-extensions.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash
set -e

python -m pip install --upgrade pip
python -m pip install uv

python -m pip install "setuptools>=62,<82.0"
python -m pip install -e $1/PythonExtensionArtifact/$3
python -m pip install --pre -e workers/[test-http-v2]
python -m pip install --pre -U -e workers/[test-deferred-bindings]
UV_PIP="python -m uv pip install --system"

python -m pip install -U -e workers/[dev]
$UV_PIP "setuptools>=62,<82.0"
$UV_PIP -e $1/PythonExtensionArtifact/$3
$UV_PIP --prerelease=allow -e workers/[test-http-v2]
$UV_PIP -U --prerelease=allow -e workers/[test-deferred-bindings]

$UV_PIP -U -e workers/[dev]
15 changes: 10 additions & 5 deletions eng/scripts/test-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/bin/bash
set -e

python -m pip install --upgrade pip
python -m pip install "setuptools>=62,<82.0"
python -m pip install -e $1/PythonSdkArtifact
python -m pip install -e workers/[dev]
python -m pip install uv

python -m pip install --pre -U -e workers/[test-http-v2]
python -m pip install --pre -U -e workers/[test-deferred-bindings]
UV_PIP="python -m uv pip install --system"

$UV_PIP "setuptools>=62,<82.0"
$UV_PIP -e $1/PythonSdkArtifact
$UV_PIP -e workers/[dev]

$UV_PIP -U --prerelease=allow -e workers/[test-http-v2]
$UV_PIP -U --prerelease=allow -e workers/[test-deferred-bindings]
1 change: 1 addition & 0 deletions eng/scripts/test-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

cd workers/tests
python -m invoke -c test_setup build-protos
Expand Down
18 changes: 13 additions & 5 deletions eng/templates/jobs/ci-dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jobs:
- bash: |
echo "Checking azure_functions_worker (Python < 3.13)..."
cd workers
pip install "setuptools<82.0"
pip install . invoke
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install --system "setuptools<82.0"
python -m uv pip install --system . invoke
cd tests
python -m invoke -c test_setup build-protos
cd ..
Expand All @@ -66,7 +68,9 @@ jobs:
- bash: |
echo "Checking proxy_worker (Python >= 3.13)..."
cd workers
pip install . invoke
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install --system . invoke
cd tests
python -m invoke -c test_setup build-protos
cd ..
Expand All @@ -76,14 +80,18 @@ jobs:
- bash: |
echo "Checking V1 Library Worker (Python >= 3.13)..."
cd runtimes/v1
pip install .
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install --system .
python -c "import pkgutil, importlib; [importlib.import_module(f'azure_functions_runtime_v1.{name}') for _, name, _ in pkgutil.walk_packages(['azure_functions_runtime_v1'])]"
displayName: 'Python Library V1: check for missing dependencies'
condition: eq(variables['proxyWorker'], true)
- bash: |
echo "Checking V2 Library Worker (Python >= 3.13)..."
cd runtimes/v2
pip install .
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install --system .
python -c "import pkgutil, importlib; [importlib.import_module(f'azure_functions_runtime.{name}') for _, name, _ in pkgutil.walk_packages(['azure_functions_runtime'])]"
displayName: 'Python Library V2: check for missing dependencies'
condition: eq(variables['proxyWorker'], true)
28 changes: 24 additions & 4 deletions eng/templates/jobs/ci-emulator-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ jobs:
displayName: 'Configure NuGet feed for current organization'
- bash: |
chmod +x eng/scripts/install-dependencies.sh
chmod +x eng/scripts/test-setup.sh

eng/scripts/install-dependencies.sh $(PYTHON_VERSION) ${{ parameters.PROJECT_DIRECTORY }}
displayName: 'Install Python dependencies (uv)'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- bash: |
chmod +x eng/scripts/test-setup.sh
eng/scripts/test-setup.sh
displayName: 'Install dependencies and the worker'
displayName: 'Build webhost and extensions (dotnet)'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- task: DownloadPipelineArtifact@2
displayName: 'Download Python SDK Artifact'
Expand Down Expand Up @@ -128,7 +130,7 @@ jobs:
docker compose -f ${{ parameters.PROJECT_DIRECTORY }}/tests/emulator_tests/utils/eventhub/docker-compose.yml up -d
displayName: 'Install Azurite and Start EventHub Emulator'
- bash: |
python -m pytest -q --dist loadfile --reruns 4 --ignore=tests/emulator_tests/test_servicebus_functions.py tests/emulator_tests
python -m pytest -q -n 2 --dist loadfile --reruns 4 --ignore=tests/emulator_tests/test_servicebus_functions.py tests/emulator_tests
Comment thread
hallvictoria marked this conversation as resolved.
env:
AzureWebJobsStorage: $(AzureWebJobsStorage)
AZURE_STORAGE_CONNECTION_STRING: $(AZURE_STORAGE_CONNECTION_STRING)
Expand All @@ -144,6 +146,24 @@ jobs:
docker container rm --force eventhubs-emulator
docker compose -f ${{ parameters.PROJECT_DIRECTORY }}/tests/emulator_tests/utils/servicebus/docker-compose.yml pull
docker compose -f ${{ parameters.PROJECT_DIRECTORY }}/tests/emulator_tests/utils/servicebus/docker-compose.yml up -d

# Wait for the Service Bus emulator (and its SQL Edge dependency) to
# be ready before running tests. Starting the webhost while the
# emulator is still booting makes the ServiceBus listener fail at
# startup, so the host never binds and tests see connection refused.
echo "Waiting for the Service Bus emulator to be ready..."
for i in $(seq 1 90); do
if docker logs servicebus-emulator 2>&1 | grep -q "Emulator Service is Successfully Up"; then
echo "Service Bus emulator is ready."
break
fi
if [ "$i" -eq 90 ]; then
echo "Service Bus emulator did not become ready in time. Logs:"
docker logs servicebus-emulator || true
exit 1
fi
sleep 2
done
env:
AzureWebJobsSQLPassword: $(AzureWebJobsSQLPassword)
displayName: 'Install Azurite and Start ServiceBus Emulator'
Expand Down
2 changes: 1 addition & 1 deletion eng/templates/jobs/ci-library-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
eng/scripts/install-dependencies.sh $(PYTHON_VERSION) ${{ parameters.PROJECT_DIRECTORY }}
displayName: 'Install dependencies'
- bash: |
python -m pytest -q --dist loadfile --reruns 4 --instafail --cov=./${{ parameters.PROJECT_DIRECTORY }} --cov-report xml --cov-branch tests/unittests
python -m pytest -q -n auto --dist loadfile --reruns 4 --reruns-delay 5 --instafail --cov=./${{ parameters.PROJECT_DIRECTORY }} --cov-report xml --cov-branch tests/unittests
Comment thread
hallvictoria marked this conversation as resolved.
displayName: "Running $(PYTHON_VERSION) Unit Tests"
env:
AZURE_STORAGE_CONNECTION_STRING: $(AZURE_STORAGE_CONNECTION_STRING)
Expand Down
12 changes: 7 additions & 5 deletions eng/templates/jobs/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ jobs:
displayName: 'Configure NuGet feed for current organization'
- bash: |
chmod +x eng/scripts/install-dependencies.sh
chmod +x eng/scripts/test-setup.sh

eng/scripts/install-dependencies.sh $(PYTHON_VERSION) ${{ parameters.PROJECT_DIRECTORY }}
displayName: 'Install Python dependencies (uv)'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- bash: |
chmod +x eng/scripts/test-setup.sh
eng/scripts/test-setup.sh
displayName: 'Install dependencies'
displayName: 'Build webhost and extensions (dotnet)'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- bash: |
PY_VER="$(PYTHON_VERSION)"
Expand All @@ -87,11 +89,11 @@ jobs:

if [ "$PY_MINOR" -ge 13 ]; then
echo "Running proxy_worker tests (Python >= 3.13)..."
python -m pytest -q --dist loadfile --reruns 4 --instafail \
python -m pytest -q -n auto --dist loadfile --reruns 4 --reruns-delay 5 --instafail \
--cov=./proxy_worker --cov-report xml --cov-branch tests/unittest_proxy
else
echo "Running unittests (Python < 3.13)..."
python -m pytest -q --dist loadfile --reruns 4 --instafail \
python -m pytest -q -n auto --dist loadfile --reruns 4 --reruns-delay 5 --instafail \
--cov=./azure_functions_worker --cov-report xml --cov-branch tests/unittests
fi
displayName: "Running $(PYTHON_VERSION) Unit Tests"
Expand Down
8 changes: 5 additions & 3 deletions eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ jobs:
displayName: 'Configure NuGet feed for current organization'
- bash: |
chmod +x eng/scripts/install-dependencies.sh
chmod +x eng/scripts/test-setup.sh

eng/scripts/install-dependencies.sh $(PYTHON_VERSION) ${{ parameters.PROJECT_DIRECTORY }}
displayName: 'Install Python dependencies (uv)'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- bash: |
chmod +x eng/scripts/test-setup.sh
eng/scripts/test-setup.sh
displayName: 'Install dependencies and the worker'
displayName: 'Build webhost and extensions (dotnet)'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- task: DownloadPipelineArtifact@2
displayName: 'Download Python SDK Artifact'
Expand Down
6 changes: 4 additions & 2 deletions eng/templates/official/jobs/ci-fc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ jobs:

- bash: |
python -m pip install --upgrade pip
pip install "setuptools<82.0"
python -m pip install -U -e ${{ parameters.PROJECT_DIRECTORY }}/[dev]
python -m pip install uv
UV_PIP="python -m uv pip install --system"
$UV_PIP "setuptools<82.0"
$UV_PIP -U -e ${{ parameters.PROJECT_DIRECTORY }}/[dev]

cd ${{ parameters.PROJECT_DIRECTORY }}/tests
python -m invoke -c test_setup build-protos
Expand Down
3 changes: 0 additions & 3 deletions runtimes/v1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ dev = [
"grpcio~=1.70.0",
"grpcio-tools~=1.70.0",
"protobuf~=5.29.0",
"pytest-sugar",
"pytest-cov",
"pytest-xdist",
"pytest-randomly",
"pytest-instafail",
"pytest-rerunfailures",
"pytest-asyncio",
"pre-commit",
"invoke"
]

Expand Down
3 changes: 0 additions & 3 deletions runtimes/v2/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ dev = [
"grpcio~=1.70.0",
"grpcio-tools~=1.70.0",
"protobuf~=5.29.0",
"pytest-sugar",
"pytest-cov",
"pytest-xdist",
"pytest-randomly",
"pytest-instafail",
"pytest-rerunfailures",
"pytest-asyncio",
"pre-commit",
"invoke"
]
test-http-v2 = [
Expand Down
22 changes: 0 additions & 22 deletions runtimes/v2/tests/unittests/test_deferred_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


from azurefunctions.extensions.bindings.blob import (BlobClient,
BlobClientConverter,
ContainerClient,
StorageStreamDownloader)
from azurefunctions.extensions.bindings.eventhub import EventData, EventDataConverter
Expand All @@ -24,27 +23,6 @@ def setUp(self):
# Initialize DEFERRED_BINDING_REGISTRY
meta.load_binding_registry()

def test_mbd_deferred_bindings_enabled_decode(self):
binding = BlobClientConverter
pb = protos.ParameterBinding(name='test',
data=protos.TypedData(
string='test'))
sample_mbd = MockMBD(version="1.0",
source="AzureStorageBlobs",
content_type="application/json",
content="{\"Connection\":\"AZURE_STORAGE_CONNECTION_STRING\"," # noqa
"\"ContainerName\":"
"\"python-worker-tests\","
"\"BlobName\":"
"\"test-blobclient-trigger.txt\"}")
datum = datumdef.Datum(value=sample_mbd, type='model_binding_data')

obj = meta.deferred_bindings_decode(binding=binding, pb=pb,
pytype=BlobClient, datum=datum, metadata={},
function_name="test_function")

self.assertIsNotNone(obj)

def test_cmbd_deferred_bindings_enabled_decode(self):
binding = EventDataConverter
pb = protos.ParameterBinding(name='test',
Expand Down
6 changes: 1 addition & 5 deletions workers/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,25 @@ dev = [
"azure-monitor-opentelemetry", # Used for Azure Monitor unit tests
"azure-storage-blob~=12.27.1", # Used for Blob Emulator tests
"flask",
"fastapi~=0.103.2",
"fastapi",
"pydantic",
"flake8==6.*",
"mypy",
"pytest~=7.4.4",
"requests==2.*",
"coverage",
"pytest-sugar",
"opentelemetry-api", # Used for OpenTelemetry unit tests
"pytest-cov",
"pytest-xdist",
"pytest-randomly",
"pytest-instafail",
"pytest-rerunfailures",
"pytest-asyncio",
"ptvsd",
Comment thread
hallvictoria marked this conversation as resolved.
"python-dotenv",
"plotly",
"scikit-learn",
"opencv-python",
"pandas",
"numpy",
"pre-commit",
Comment thread
hallvictoria marked this conversation as resolved.
"invoke",
"cryptography",
"pyjwt",
Expand Down
Binary file not shown.
Loading
Loading