Skip to content

Python: Add redis[asyncio] to requirements.txt for streaming samples#5509

Open
moonbox3 wants to merge 4 commits intomicrosoft:mainfrom
moonbox3:agent/fix-5396-1
Open

Python: Add redis[asyncio] to requirements.txt for streaming samples#5509
moonbox3 wants to merge 4 commits intomicrosoft:mainfrom
moonbox3:agent/fix-5396-1

Conversation

@moonbox3
Copy link
Copy Markdown
Contributor

Motivation and Context

Two Python streaming samples (azure_functions/03_reliable_streaming and durabletask/03_single_agent_streaming) import redis.asyncio in their redis_stream_response_handler.py, but neither listed redis as a dependency. A fresh pip install -r requirements.txt followed by running the sample immediately raised ModuleNotFoundError: No module named 'redis'.

Fixes #5396

Description

The root cause is that redis[asyncio] was never included in either sample's requirements.txt, leaving the import of redis.asyncio as aioredis unsatisfied at runtime. The fix adds redis[asyncio] to both requirements files so that installing from them provides the redis package along with its async (hiredis/asyncio) extras, matching what the handler code already requires.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Note: PR autogenerated by moonbox3's agent

Copilot and others added 2 commits April 27, 2026 08:00
Both streaming samples import redis.asyncio in redis_stream_response_handler.py
but neither included redis in their requirements.txt, causing ModuleNotFoundError
on fresh installs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 08:10
@moonbox3 moonbox3 self-assigned this Apr 27, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 4 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by moonbox3's agents

@moonbox3
Copy link
Copy Markdown
Contributor Author

moonbox3 commented Apr 27, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL29865347988% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
6026 30 💤 0 ❌ 0 🔥 1m 37s ⏱️

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the missing Redis client dependency needed by the Python streaming hosting samples so redis.asyncio imports succeed after a fresh install from the sample requirements.txt.

Changes:

  • Add a Redis dependency to the two streaming sample requirements.txt files.
  • Minor formatting-only edits in a couple of Python samples.
  • Small cleanup in core tests/init (unused import removal / __all__ ordering tweak).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/samples/04-hosting/durabletask/03_single_agent_streaming/requirements.txt Adds Redis dependency for the durabletask streaming sample.
python/samples/04-hosting/azure_functions/03_reliable_streaming/requirements.txt Adds Redis dependency for the Azure Functions streaming sample.
python/samples/04-hosting/a2a/agent_framework_to_a2a.py Formatting-only change (trailing comma).
python/samples/01-get-started/06_functional_workflow_basics.py Adds blank lines (formatting).
python/samples/01-get-started/05_functional_workflow_with_agents.py Adds blank lines (formatting).
python/packages/core/tests/core/test_exceptions.py Removes unused pytest import.
python/packages/core/agent_framework/init.py Minor reordering within __all__.

Comment thread python/samples/04-hosting/a2a/agent_framework_to_a2a.py
Copy link
Copy Markdown
Contributor Author

@moonbox3 moonbox3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 4 | Confidence: 97% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by moonbox3's agents

Copilot and others added 2 commits April 27, 2026 08:14
Revert formatting-only edits in sample files and unrelated cleanup
(unused import removal, __all__ reordering) that were accidentally
included in the redis dependency fix (issue microsoft#5396).

The only intended changes for this PR are the Redis dependency
additions to requirements.txt files for the streaming samples.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… redis package missing from requirements.txt in streaming samples
Copy link
Copy Markdown
Contributor Author

@moonbox3 moonbox3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 4 | Confidence: 97% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by moonbox3's agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Samples][Python] redis package missing from requirements.txt in streaming samples

3 participants