Skip to content

Python: docs(python/samples): recommend uv venv and document Windows ensurepip hang workaround#5508

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

Python: docs(python/samples): recommend uv venv and document Windows ensurepip hang workaround#5508
moonbox3 wants to merge 4 commits intomicrosoft:mainfrom
moonbox3:agent/fix-5401-1

Conversation

@moonbox3
Copy link
Copy Markdown
Contributor

Motivation and Context

On Windows with Microsoft Store Python 3.13, python -m venv .venv hangs indefinitely during the ensurepip step, blocking beginers at the very first setup instruction. The azure_functions and foundry-hosted-agents sample READMEs both recommended this command with no guidance on alternatives.

Fixes #5401

Description

The READMEs for python/samples/04-hosting/azure_functions and python/samples/04-hosting/foundry-hosted-agents are updated to replace python -m venv .venv with uv venv .venv as the primary (recommended) venv creation command, consistent with the a2a sample which already used uv run exclusively. A note is added explaining that python -m venv still works on other platforms but can hang on Windows/Microsoft Store Python due to a known ensurepip issue, directing users to uv venv as the reliable alternative.

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 06:58
Replace bare 'python -m venv .venv' with 'uv venv .venv' as the
recommended approach in azure_functions and foundry-hosted-agents
READMEs. Add a note explaining that python -m venv can hang
indefinitely on Windows with Microsoft Store Python due to a known
ensurepip issue.

This matches the pattern already used in a2a/README.md which uses
uv run exclusively.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 07:07
@moonbox3 moonbox3 self-assigned this Apr 27, 2026
@moonbox3 moonbox3 added documentation Improvements or additions to documentation python labels Apr 27, 2026
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

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: 95% | 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 44s ⏱️

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

Updates Python sample documentation to recommend uv venv as the primary virtual environment creation method, addressing a Windows/Microsoft Store Python ensurepip hang that can block initial setup for new users.

Changes:

  • Update azure_functions and foundry-hosted-agents sample READMEs to recommend uv venv .venv and document the Windows ensurepip hang workaround.
  • Minor formatting/cleanup tweaks in Python samples and core package (string formatting, extra blank lines, import removal, __all__ ordering).

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/foundry-hosted-agents/README.md Switches venv creation guidance to uv venv and adds note about Windows ensurepip hang.
python/samples/04-hosting/azure_functions/README.md Switches venv creation guidance to uv venv and adds note about Windows ensurepip hang.
python/samples/04-hosting/a2a/agent_framework_to_a2a.py Adds trailing comma in Agent(...) call for formatting consistency.
python/samples/01-get-started/06_functional_workflow_basics.py Adds extra blank lines around snippet boundary.
python/samples/01-get-started/05_functional_workflow_with_agents.py Adds extra blank lines around snippet boundary.
python/packages/core/tests/core/test_exceptions.py Removes unused pytest import.
python/packages/core/agent_framework/init.py Reorders AgentFrameworkException export within __all__.

Comment thread python/samples/04-hosting/foundry-hosted-agents/README.md Outdated
Copilot and others added 2 commits April 27, 2026 07:10
…s README (microsoft#5401)

Split the Windows activation section into separate PowerShell (.venv\Scripts\Activate.ps1)
and Command Prompt (.venv\Scripts\activate.bat) instructions, replacing the incorrect
extensionless `Activate` path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… `python -m venv` hangs on Windows — READMEs should recommend uv or document workaround
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: 100% | Result: All clear

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


Automated review by moonbox3's agents

Comment on lines +40 to +41


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I know that this is done by the formatter, but these empty lines make comments (# </create_workflow>) even more confusing. Could we set a rule or save without auto formatting?

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

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Samples][Python] python -m venv hangs on Windows — READMEs should recommend uv or document workaround

3 participants