Skip to content

Python: Drop 3.10 support and expand CI coverage through 3.14 - #14708

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 12 commits into
microsoft:mainfrom
eavanvalkenburg:python-drop-310-support
Nov 4, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 12 commits into
microsoft:mainfrom
eavanvalkenburg:python-drop-310-support

Conversation

@eavanvalkenburg

@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Motivation and Context

Retire Python 3.10 support and its compatibility code. Align the SDK's supported versions, CI coverage, and developer setup with Python 3.11 through 3.14. Use Python 3.14 as the local development and integration-test default.

This intentionally raises the minimum supported Python version from 3.10 to 3.11. Python 3.14 is the highest supported and tested version. Keep the existing minimum-only requires-python = ">=3.11" policy; do not add an installation upper bound.

Description

  • Require Python 3.11+, update package classifiers through Python 3.14, and remove Python 3.10-specific ONNX pins and lockfile branches while preserving upstream security updates and registry URLs.
  • Replace obsolete Self and NotRequired backports with standard-library imports. Remove the Python 3.10 AnyType shim, obsolete test skips, and the event-loop workaround. Apply Python 3.11 syntax upgrades, including built-in TimeoutError and datetime.UTC. Keep import guards still needed by Python 3.11.
  • Run Python 3.11–3.14 as required unit-test jobs across the existing OS/test-suite matrix: 22 jobs, preserving the Python 3.11/macOS exclusion. Move all six integration-test matrices to Python 3.14 and explicitly provision interpreters before uv.
  • Use uv 0.13 and per-environment uv pip install resolution in unit CI, integration CI, and local setup, including the development dependency group. Use uv run --no-sync for subsequent tools and VS Code tasks so the shared universal lock does not restore incompatible NumPy 1.x. MCP sample subprocesses also use --no-sync.
  • Add an AutoGen dependency marker excluding Python 3.14 and Windows/Python 3.13, including all-extras installs. Its NumPy <2 constraint forces old scientific and gRPC packages; NumPy 1.26.4 crashes during import on Windows/Python 3.13. Preserve AutoGen coverage on Python 3.11–3.12 and Linux/macOS Python 3.13. Local pytest collection and CI follow the same exclusion policy.
  • Keep all other extras and connector tests enabled across the supported matrix. Remove abandoned newer-version exclusions and native-build workarounds. Keep the separate Dapr suite and its dependencies.
  • Constrain azure-ai-projects to >=1.0,<2.0: SK's Azure AI agent implementation requires the classic APIs removed in Projects 2.x. Add a regression test that checks the actual installed client's agent, file, thread, and run operations without cloud calls.
  • Replace the unmaintained nest-asyncio dependency and imports with nest-asyncio2>=1.7.4,<2. The old patch breaks Python 3.14 task detection, causing OpenAI/sniffio, AnyIO/MCP, and notebook timeout failures. Update nested-loop MCP samples too. Add regression tests for nested template invocation, async-library detection, timeout handling, and restoration of the outer task context.
  • Disable matrix fail-fast so one failure does not cancel the remaining required jobs. Run pytest through Python with unbuffered output and faulthandler for native-crash diagnostics.
  • Fix typing reflection: do not recurse into Union origin classes when parsing function annotations, and read model annotations from the class when building schemas from instances. Add regression cases for optional dictionary annotations and inherited/optional model fields.
  • Default local development to Python 3.14. Update the Makefile interpreter installation list, VS Code choices, setup instructions, READMEs, and sample requirements. Document the CI dependency policy and runtime compatibility constraints.
  • Add regression coverage for Any return annotations in message and RPC handlers.

Validation

From python/, using an isolated stable Python 3.14.9 environment with VIRTUAL_ENV/UV_PROJECT_ENVIRONMENT pointing to its session-only directory:

  • uv pip install --editable . --requirements pyproject.toml --all-extras --group dev --upgrade --prerelease=if-necessary-or-explicit — passed; installed Azure Projects 1.0.0, nest-asyncio2 1.7.4, and the full supported extras/dev dependency set.
  • uv run --no-sync pytest tests/unit --ignore=tests/unit/processes/dapr_runtime --disable-warnings -o addopts=-ra -q — passed: 4,947 passed, 1 skipped, 5 xfailed.
  • uv run --no-sync pytest tests/unit/prompt_template tests/unit/agents/azure_ai_agent --disable-warnings -o addopts=-ra -q — passed before the stable-interpreter recheck: 328 tests. The full stable-interpreter run above includes these tests.

From the repository root unless noted:

  • cd python && .venv/bin/pytest tests/unit/prompt_template tests/unit/agents/azure_ai_agent --disable-warnings -o addopts=-ra -q — passed on Python 3.11: 328 tests.
  • python/.venv/bin/pre-commit run --all-files --config python/.pre-commit-config.yaml — passed, including pyupgrade, Ruff, formatting, lockfile consistency, and Bandit.
  • uv build --project python --out-dir "$BUILD_OUTPUT" — passed, with BUILD_OUTPUT set to the session-only artifact directory; built the source distribution and wheel. uv reports the existing if-necessary-or-explicit deprecation warning.
  • git diff --check — passed.

Also exercised the failing async paths on stable Python 3.14.9 after nested template rendering: an actual Azure OpenAI SDK request with an in-memory HTTP mock, stdio initialization/tool listing for both MCP sample servers, and execution of a Python 3.14 notebook cell using asyncio.timeout. All passed without cloud calls. The old nest-asyncio failure was independently reproduced without external services.

Verified the support matrix, metadata, AutoGen marker/collection policy on all 12 OS/Python combinations, all six integration installers/runners, and preservation of existing locked package versions and registry/artifact URLs. Windows and Linux Python 3.14 installation resolution checks select NumPy/SciPy wheels without AutoGen. Previously verified rejection of Python 3.10 during wheel installation.

Live service integration tests were not run locally. Regular PR checks skip those jobs for fork PRs; the merge queue must run them to establish the latest commit's live-service results. The latest fixes do not skip additional integration tests.

Contribution Checklist

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.

🟡 Changes recommended

The required Python 3.15 all-extras jobs fail before pytest because the exact onnxruntime-genai and torch pins have no compatible artifacts in the lockfile.

1 open issue
What changed in this PR

This PR raises the Python SDK minimum to 3.11, removes Python 3.10 compatibility code, and aligns CI and developer tooling with the updated version policy.

Changes:

  • Expands required unit-test coverage to Python 3.11–3.15 and moves integration tests and local defaults to Python 3.14.
  • Replaces obsolete typing backports, removes compatibility workarounds, and adds regression tests for Any handler return annotations.
  • Updates package requirements, sample metadata, documentation, and development tools.
File Description
README.md Updates supported Python versions.
python/​tests/​unit/​kernel/​test_kernel.py Removes an outdated compatibility docstring.
python/​tests/​unit/​data/​conftest.py Removes the Python 3.10 event-loop workaround.
python/​tests/​unit/​agents/​runtime/​test_runtime.py Tests Any returns for message and RPC handlers.
python/​tests/​unit/​agents/​orchestration/​test_sequential.py Removes Python 3.10-specific skips.
python/​tests/​unit/​agents/​orchestration/​test_magentic.py Removes Python 3.10-specific skips.
python/​tests/​unit/​agents/​orchestration/​test_handoff.py Removes Python 3.10-specific skips.
python/​tests/​unit/​agents/​orchestration/​test_group_chat.py Removes Python 3.10-specific skips.
python/​tests/​unit/​agents/​orchestration/​test_concurrent.py Removes Python 3.10-specific skips.
python/​semantic_kernel/​schema/​kernel_json_schema_builder.py Removes an obsolete comment; behavior is unchanged.
python/​semantic_kernel/​data/​vector.py Uses standard-library Self.
python/​semantic_kernel/​contents/​streaming_content_mixin.py Uses standard-library Self.
python/​semantic_kernel/​contents/​history_reducer/​chat_history_truncation_reducer.py Removes the Self backport guard.
python/​semantic_kernel/​contents/​history_reducer/​chat_history_summarization_reducer.py Removes the Self backport guard.
python/​semantic_kernel/​contents/​history_reducer/​chat_history_reducer.py Uses standard-library Self.
python/​semantic_kernel/​connectors/​weaviate.py Uses standard-library Self.
python/​semantic_kernel/​connectors/​sql_server.py Uses standard-library Self.
python/​semantic_kernel/​connectors/​mongodb.py Uses standard-library Self.
python/​semantic_kernel/​connectors/​mcp.py Uses standard-library Self.
python/​semantic_kernel/​connectors/​ai/​realtime_client_base.py Uses standard-library Self.
python/​semantic_kernel/​agents/​runtime/​core/​type_helpers.py Removes the AnyType compatibility shim.
python/​semantic_kernel/​agents/​runtime/​core/​topic.py Uses standard-library Self.
python/​semantic_kernel/​agents/​runtime/​core/​telemetry/​tracing_config.py Uses standard-library NotRequired.
python/​semantic_kernel/​agents/​runtime/​core/​routed_agent.py Checks handler return types against Any directly.
python/​semantic_kernel/​agents/​runtime/​core/​base_agent.py Uses standard-library Self.
python/​semantic_kernel/​agents/​runtime/​core/​agent_id.py Removes the Self backport guard.
python/​semantic_kernel/​agents/​orchestration/​handoffs.py Uses standard-library Self.
python/​semantic_kernel/​agents/​open_ai/​azure_responses_agent.py Removes the Self backport guard.
python/​semantic_kernel/​agents/​open_ai/​azure_assistant_agent.py Removes the Self backport guard.
python/​samples/​learn_resources/​README.md Raises the documented Python minimum.
python/​samples/​getting_started_with_agents/​copilot_studio/​README.md Raises the documented Python minimum.
python/​samples/​demos/​mcp_with_oauth/​server/​uv.lock Removes Python 3.10-only dependencies and artifacts.
python/​samples/​demos/​mcp_with_oauth/​server/​pyproject.toml Requires Python 3.11+.
python/​samples/​demos/​mcp_with_oauth/​pyproject.toml Raises the minimum and Ruff target to 3.11.
python/​samples/​demos/​guided_conversations/​pyproject.toml Raises the minimum while retaining the upper bound.
python/​samples/​demos/​booking_restaurant/​README.md Updates documented Python versions.
python/​README.md Updates supported Python versions.
python/​pyproject.toml Raises the minimum, updates classifiers, and simplifies ONNX pins.
python/​Makefile Defaults to 3.14 and installs Python 3.11–3.15.
python/​DEV_SETUP.md Aligns setup instructions with the new defaults.
python/​.vscode/​tasks.json Updates interpreter choices and the default.
python/​.pre-commit-config.yaml Targets Python 3.11+ for pyupgrade.
.github/​workflows/​python-unit-tests.yml Expands required version coverage and provisions interpreters.
.github/​workflows/​python-test-coverage.yml Moves coverage to Python 3.11.
.github/​workflows/​python-lint.yml Moves linting to Python 3.11.
.github/​workflows/​python-integration-tests.yml Uses Python 3.14 with explicit interpreter setup.
.github/​workflows/​python-build.yml Moves builds to Python 3.11.

Review effort: Balanced

Comment thread .github/workflows/python-unit-tests.yml Resolved
Preserve upstream dependency updates while regenerating locks without Python 3.10 support. Exclude the new Chroma-dependent filter tests only on Python 3.15.
@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) changed the title Python: Drop 3.10 support and expand CI coverage through 3.15 Python: Drop 3.10 support and expand CI coverage through 3.14 Nov 3, 2026

@jpalvarezl Jose Alvarez (jpalvarezl) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One Python 3.14 compatibility issue remains in the all-extras setup paths.

@jpalvarezl Jose Alvarez (jpalvarezl) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Python 3.14 AutoGen/NumPy compatibility gap is addressed. The dependency marker, per-environment setup, test collection policy, lockfile, and published wheel metadata are consistent across the supported combinations.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 4, 2026
Merged via the queue into microsoft:main with commit cbb8059 Nov 4, 2026
40 of 41 checks passed
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) deleted the python-drop-310-support branch November 4, 2026 14:38
westey (westey-m) pushed a commit to westey-m/semantic-kernel-1 that referenced this pull request Nov 5, 2026
…crosoft#14720)

### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Prepare the Semantic Kernel Python package for the `1.47.0` release and
consolidate all six open Python package Dependabot updates into one
validated change.

The prerequisite microsoft#14708 has merged and is included in this branch.
Python 3.10 support is removed; the package now requires Python 3.11+
and advertises support through Python 3.14. This compatibility change is
the reason for the minor release.

Other Python changes already merged since `python-1.46.0` include fixes
for MCP initialization and prompt arguments, Redis vector search, Google
AI embeddings and token usage, Mistral settings and finish reasons, SQL
Server handling, OpenAPI URL matching, schema generation, chat history
and tool results, Handlebars helpers, and empty in-memory searches.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

- Update `semantic_kernel.__version__` from `1.46.0` to `1.47.0`.
- Allow `flit-core >=3.9,<5.0`; verified the build with Flit Core 4.2.0.
Supersedes microsoft#14596.
- Expand the boto3 upper bound to `<1.44.0` and lock boto3/botocore
1.43.123 with s3transfer 0.19.3. Supersedes microsoft#14597.
- Expand the google-genai upper bound to `<2.30`. The combined Google
extra still resolves google-genai 1.75.0 because google-cloud-aiplatform
requires `<2.0.0`. Supersedes microsoft#14598.
- Expand the Redis upper bound to `<9`; lock Redis 8.1.0 and compatible
redisvl 0.30.0. Supersedes microsoft#14599.
- Pin ONNX Runtime GenAI to 0.18.0 and lock its required ONNX Runtime
1.31.1. No Python 3.10 compatibility pins remain. Supersedes microsoft#14600.
- Update the MCP OAuth sample lockfile from MCP 1.28.1 to 1.30.0.
Supersedes microsoft#14627.
- Regenerate both affected lockfiles. Preserve exact original lock
entries, including registry URLs and artifact metadata, for every
unchanged SDK dependency. New package versions use PyPI because the
existing proxy returned a metadata 404 for the new ONNX GenAI wheel.

Validation:

- `uv build --project python --no-sources` — passed; built the `1.47.0`
wheel and source distribution. The build selected Flit Core 4.2.0. uv
reports the existing prerelease-mode deprecation warning.
- `cd python && uv run --no-sync pytest tests/unit/connectors/ai/bedrock
tests/unit/connectors/ai/google/google_ai tests/unit/connectors/ai/onnx
tests/unit/connectors/memory/test_redis_store.py
tests/unit/connectors/mcp --disable-warnings -q` — passed on Python
3.14.0rc3 with boto3 1.43.123, Redis 8.1.0, redisvl 0.30.0, ONNX Runtime
GenAI 0.18.0, and ONNX Runtime 1.31.1 installed.
- `python/.venv/bin/pre-commit run --files python/pyproject.toml
python/semantic_kernel/__init__.py python/uv.lock
python/samples/demos/mcp_with_oauth/uv.lock --config
python/.pre-commit-config.yaml` — passed for all applicable hooks.
- `uvx --from uv==0.5.30 uv lock --project python --check` — passed,
using the SDK's pre-commit resolver version.
- `uv lock --project python/samples/demos/mcp_with_oauth --check` —
passed.
- `git diff --check` — passed.
- Parsed wheel `METADATA` and source `PKG-INFO` — passed: version
`1.47.0`, `Requires-Python: >=3.11`, and all requested runtime
dependency bounds are present.
- Asserted that all unchanged SDK dependencies retain their exact
original lock entries and that both affected lockfiles contain the
requested updates — passed.

The full unit-test suite and live-service integration tests were not run
locally. This PR remains a draft pending release review and CI; it does
not publish a release.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

This branch was previously deployed

1 inactive deployment
github-app-auth — 94166528 Deployed Nov 4, 2026 by eavanvalkenburg via add_label #29587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants