Azure / Azure/azure-sdk-for-python

azure-ai-projects async AIProjectClient should install aiohttp transport dependency

Open
#47,539 0 comments 0 reactions 1 assignee Claimed by @dargilco View on GitHub
AI Projects Client customer-reported needs-team-attention question
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

### Library name

azure-ai-projects

### Library version

2.2.0

### Description

Installing `azure-ai-projects` by itself does not install `aiohttp`, but constructing the async `azure.ai.projects.aio.AIProjectClient` requires the Azure Core aio transport and fails with `ModuleNotFoundError: No module named 'aiohttp'`.

`azure-ai-projects==2.2.0` declares dependencies on plain `azure-core`, `azure-identity`, `azure-storage-blob`, `isodate`, `openai`, and `typing-extensions`. `aiohttp` is only provided by the optional `azure-core[aio]` extra, so users of the async Projects client do not receive the transport dependency transitively.

Microsoft Agent Framework depends on `azure-ai-projects` and exposes async Foundry clients (`FoundryChatClient`, `FoundryAgent`, memory provider) that construct `azure.ai.projects.aio.AIProjectClient`. We are adding a defensive direct `aiohttp` dependency in Agent Framework, but the Azure SDK package should also make its own async install surface complete.

### Expected behavior

A user who installs `azure-ai-projects` should be able to construct `azure.ai.projects.aio.AIProjectClient` without separately knowing to install `aiohttp` or `azure-core[aio]`.

Possible fixes include depending on `azure-core[aio]` or otherwise declaring the async transport dependency needed by `azure.ai.projects.aio`.

### Actual behavior

Constructing `AIProjectClient` from `azure.ai.projects.aio` raises:

```text
ModuleNotFoundError: No module named 'aiohttp'
```

### Reproduction steps

```bash
python -m venv .venv
. .venv/bin/activate
pip install azure-ai-projects==2.2.0
python - <<'PY'
from azure.ai.projects.aio import AIProjectClient
from azure.core.credentials_async import AsyncTokenCredential

class Cred(AsyncTokenCredential):
async def get_token(self, *scopes, **kwargs):
raise RuntimeError("not expected")

async def close(self):
pass

AIProjectClient(
endpoint="https://example.services.ai.azure.com/api/projects/project",
credential=Cred(),
)
PY
```

### Environment

Reproduced in a clean Python 3.12 environment. Package metadata inspection showed `aiohttp` was not installed and was not listed in `azure-ai-projects==2.2.0` requirements.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.