Skip to content

Python: Refresh coding standards and Copilot review guidance - #9637

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 3 commits into
mainfrom
python-coding-standards
Oct 23, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 3 commits into
mainfrom
python-coding-standards

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Member

Motivation & Context

Python engineering guidance had grown into multiple partially conflicting copies, while the path-specific Copilot instruction lived outside GitHub's documented repository-root discovery location. This made it unclear which rules were authoritative and reduced the likelihood that Copilot code review would apply them consistently.

This change establishes one canonical standard, separates durable engineering rules from task-specific workflow guidance, and wires Python review instructions into the supported root .github/instructions location.

Description & Review Guide

  • What are the major changes? Rewrites python/CODING_STANDARD.md around explicit MUST/SHOULD/MAY levels; adds guidance for import-light APIs, TypedDict extensibility, typing suppressions, Protocols and inheritance, compatibility, async/resource ownership, exceptions, documentation, performance, and behavior-focused testing. Moves the Python path-specific Copilot instruction to .github/instructions/python.instructions.md, simplifies the python-development skill to reference the canonical standard, and aligns testing and sample guidance.
  • What is the impact of these changes? Runtime behavior and public APIs are unchanged. Contributors and automated reviewers receive clearer, non-duplicated Python guidance. Follow-up implementation gaps found during the audit are tracked separately in Python: [Feature]: Add import-light factories for code-defined skills #9621 through Python: Add string alternatives at stable enum input boundaries #9635.
  • What do you want reviewers to focus on? Whether the requirement levels accurately distinguish mandatory rules from preferences, whether the public API ergonomics guidance reflects intended Python design, and whether the Copilot review instruction is concise enough to load reliably without becoming another copy of the standard.

Related Issue

Fixes #9636

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Documentation restructuring, standards synthesis, Copilot instruction wiring, repository audit, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 09:54
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 23, 2026

Copilot AI left a comment

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.

🟢 Approval recommended

The changes affect guidance only, and the remaining documentation corrections are minor and non-blocking.

2 open issues
What changed in this PR

This documentation-only PR establishes a canonical Python coding standard and moves Copilot’s Python review guidance to the repository-root discovery location, addressing #9636. Runtime behavior and public APIs are unchanged.

Changes:

  • Consolidates engineering and API-design rules using explicit MUST/SHOULD/MAY levels.
  • Replaces duplicated development guidance with links to the canonical standard and task-specific skills.
  • Aligns testing practices and sample file-layout guidance.
File Description
python/​samples/​SAMPLE_GUIDELINES.md Updates sample layout, examples, and environment-variable inventory guidance.
python/​samples/​AGENTS.md Aligns sample layout and inventory instructions.
python/​CODING_STANDARD.md Establishes canonical engineering, API, and testing requirements.
python/​AGENTS.md Updates descriptions of the standard and development skill.
python/​.github/​skills/​python-testing/​SKILL.md Clarifies fixtures, behavior-focused tests, and integration markers.
python/​.github/​skills/​python-development/​SKILL.md Replaces duplicated standards with workflow guidance.
python/​.github/​instructions/​python.instructions.md Removes the nested Copilot instruction file.
.github/​instructions/​python.instructions.md Adds root-level Python review instructions.

Review effort: Balanced

Comment thread python/CODING_STANDARD.md Outdated
Comment thread python/samples/SAMPLE_GUIDELINES.md
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@github-actions github-actions Bot left a comment

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.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 40c0f5704d08
Model: gpt-5.6-sol

Overview

The PR successfully centralizes Python guidance, preserves explicit compatibility and lifecycle guardrails, and moves path-specific review instructions to the supported repository-root location. Two internal contract conflicts remain: automated review is told to report grandfathered violations, and the universal annotation requirement contradicts the deliberately relaxed test/sample typing policy. Both can create systematic false review findings for otherwise compliant changes.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
2 verified findings remained after source verification (2 medium) across 2 files. Details are attached to the affected lines below.

Affected areas: .github/instructions/python.instructions.md, python/CODING_STANDARD.md

Comment thread .github/instructions/python.instructions.md Outdated
Comment thread python/CODING_STANDARD.md Outdated
Comment thread .github/instructions/python.instructions.md
Comment thread python/.github/skills/python-testing/SKILL.md Outdated
Comment thread python/samples/AGENTS.md
Comment thread python/samples/AGENTS.md Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merged via the queue into main with commit 9c53b5f Oct 23, 2026
51 checks passed
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) deleted the python-coding-standards branch October 23, 2026 11:20

This branch was successfully deployed

1 active deployment
github-app-auth — 7992e73f Deployed Oct 23, 2026 by eavanvalkenburg via add_label #26010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Establish canonical coding standards and Copilot review guidance

3 participants