Python: replace pre-commit with prek, add PEP 723 script deps, clean up dev dependencies#3748
Open
eavanvalkenburg wants to merge 15 commits intomicrosoft:mainfrom
Open
Python: replace pre-commit with prek, add PEP 723 script deps, clean up dev dependencies#3748eavanvalkenburg wants to merge 15 commits intomicrosoft:mainfrom
eavanvalkenburg wants to merge 15 commits intomicrosoft:mainfrom
Conversation
…up dev dependencies - Replace pre-commit with prek (Rust-native, faster pre-commit alternative) - Move supported hooks to repo: builtin for zero-clone speed - Add new builtin hooks: trailing-whitespace, check-merge-conflict, detect-private-key, check-added-large-files - Update all hook versions to latest (pre-commit-hooks v6, pyupgrade v3.21.2, bandit 1.9.3, uv-pre-commit 0.10.0) - Add PEP 723 inline script metadata to 34 samples with external deps - Remove autogen-agentchat/autogen-ext from dev deps (now declared per-sample) - Remove unused dev deps: pytest-env, tomli-w - Add agent-framework-core>=1.0.0b260130 lower bound to all 21 packages - Update CI workflow to use j178/prek-action - Update docs: DEV_SETUP.md, AGENTS.md, CODING_STANDARD.md, SAMPLE_GUIDELINES.md
Member
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes the Python developer tooling for the monorepo by switching from pre-commit to prek, cleaning up workspace dev dependencies, and making samples self-contained via PEP 723 inline metadata.
Changes:
- Replace
pre-commitwithprekacross local tooling and CI, and update hook versions/config. - Add PEP 723 inline script metadata to samples that require external dependencies and document new sample guidelines.
- Normalize non-core packages to depend on
agent-framework-core>=1.0.0b260130and remove unused dev dependencies.
Reviewed changes
Copilot reviewed 64 out of 65 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Removes pre-commit and other no-longer-needed deps; adds prek; updates resolved dependency graph accordingly. |
| python/pyproject.toml | Updates dev dependency group (adds prek, removes pre-commit/unused deps) and renames Poe tasks from pre-commit-* to prek-*. |
| python/.pre-commit-config.yaml | Moves several hooks to repo: builtin, updates hook revisions, and points the Poe hook at prek-check. |
| .github/workflows/python-code-quality.yml | Switches CI job from pre-commit to prek using j178/prek-action@v1 and updates caching paths/keys. |
| python/devsetup.sh | Updates dev setup script to install prek hooks via Poe. |
| python/DEV_SETUP.md | Updates documentation to refer to prek instead of pre-commit and adjusts the suggested commands. |
| python/CODING_STANDARD.md | Documents policy for bumping agent-framework-core lower bounds in non-core packages. |
| python/AGENTS.md | Replaces embedded sample guidance with a link to samples/SAMPLE_GUIDELINES.md. |
| python/.vscode/tasks.json | Updates VS Code task to run prek instead of pre-commit. |
| python/samples/SAMPLE_GUIDELINES.md | Adds explicit sample file structure + PEP 723 dependency guidance and notes on samples syntax checking. |
| python/samples/semantic-kernel-migration/processes/nested_process.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/processes/fan_out_fan_in_process.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/orchestrations/sequential.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/orchestrations/magentic.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/orchestrations/handoff.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/orchestrations/group_chat.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/orchestrations/concurrent_basic.py | Adds PEP 723 metadata and adjusts imports in the orchestration sample. |
| python/samples/semantic-kernel-migration/openai_responses/01_basic_responses_agent.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/openai_responses/02_responses_agent_with_tool.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/openai_responses/03_responses_agent_structured_output.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/openai_assistant/01_basic_openai_assistant.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/openai_assistant/02_openai_assistant_with_code_interpreter.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/openai_assistant/03_openai_assistant_function_tool.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/copilot_studio/01_basic_copilot_studio_agent.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/copilot_studio/02_copilot_studio_streaming.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/chat_completion/01_basic_chat_completion.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/chat_completion/02_chat_completion_with_tool.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/chat_completion/03_chat_completion_thread_and_stream.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/azure_ai_agent/01_basic_azure_ai_agent.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/azure_ai_agent/02_azure_ai_agent_with_code_interpreter.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/semantic-kernel-migration/azure_ai_agent/03_azure_ai_agent_threads_and_followups.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/getting_started/observability/agent_with_foundry_tracing.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/getting_started/evaluation/self_reflection/self_reflection.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/getting_started/agents/copilotstudio/copilotstudio_with_explicit_settings.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/demos/chatkit-integration/app.py | Adds PEP 723 metadata to make the demo runnable standalone. |
| python/samples/demos/m365-agent/m365_agent_demo/app.py | Adds PEP 723 metadata at top of file (but currently results in duplicated metadata blocks). |
| python/samples/autogen-migration/single_agent/01_basic_assistant_agent.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/single_agent/02_assistant_agent_with_tool.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/single_agent/03_assistant_agent_thread_and_stream.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/single_agent/04_agent_as_tool.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/orchestrations/01_round_robin_group_chat.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/orchestrations/02_selector_group_chat.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/orchestrations/03_swarm.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/samples/autogen-migration/orchestrations/04_magentic_one.py | Adds PEP 723 metadata to make the sample runnable standalone. |
| python/packages/a2a/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/ag-ui/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/anthropic/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/azure-ai-search/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/azure-ai/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/azurefunctions/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/bedrock/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/chatkit/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/claude/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/copilotstudio/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/declarative/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/devui/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/durabletask/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/foundry_local/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/github_copilot/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/lab/pyproject.toml | Adds core lower bound and replaces pre-commit with prek in the package’s dev group. |
| python/packages/mem0/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/ollama/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/orchestrations/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/purview/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
| python/packages/redis/pyproject.toml | Adds agent-framework-core>=1.0.0b260130 lower bound. |
Comments suppressed due to low confidence (1)
python/samples/semantic-kernel-migration/orchestrations/concurrent_basic.py:22
ConcurrentBuilderis used later in this sample (ConcurrentBuilder(participants=[...]).build()), but it is no longer imported after this change. Add the appropriate import (e.g.,from agent_framework.orchestrations import ConcurrentBuilder) or adjust the code to use the correct symbol that is already imported.
Remove global 'files: ^python/' filter and strip python/ prefix from all path patterns in .pre-commit-config.yaml so prek finds files when run from the python/ directory. Update CI workflow to use --cd python instead of --config path. Include trailing whitespace fixes and dev dependency cleanup.
Write a temp pyrightconfig.json matching pyrightconfig.samples.json rules (typeCheckingMode=off, only reportMissingImports and reportAttributeAccessIssue). Filter output to only fail on these rules since syntax-level errors (top-level await, undefined vars) are expected in README documentation snippets.
…list The prek-markdown-code-lint task received all changed files including non-README markdown and files with pre-existing broken imports. Replace with the standard markdown-code-lint task which uses the correct glob patterns (README.md, packages/**/README.md, samples/**/*.md).
- ag-ui: replace TextContent (removed) with content.type == 'text' - durabletask: fix import path to durabletask.worker.TaskHubGrpcWorker - orchestrations: use constructor params instead of .participants() method - observability: mark deprecated code blocks as plain text, filter reportMissingImports to agent_framework modules only - remove README excludes from markdown-code-lint task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes the Python tooling and dependency management across the monorepo.
Changes
Replace pre-commit with prek
repo: builtinfor zero-clone, Rust-native execution: check-toml, check-yaml, check-json, end-of-file-fixer, mixed-line-endingPEP 723 inline script metadata for samples
Dev dependency cleanup
Core version lower bounds
Documentation updates
Files changed: 65