Skip to content

chore!: require Python 3.11 or newer (0.36.0) - #3589

Merged
Daniel Meppiel (danielmeppiel) merged 8 commits into
mainfrom
danielmeppiel-require-python-311
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 8 commits into
mainfrom
danielmeppiel-require-python-311

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

TL;DR

APM now requires Python 3.11 or newer, starting with release 0.36.0. Python 3.10 reached end of life in October 2026, and every patched filelock release (≥ 4.2.1, the GHSA-v4x8-3wr5-3wq8 fix family) needs 3.11+. This PR removes the Python-version split from #3465, so the patched filelock now applies on every supported interpreter. The prebuilt standalone binaries bundle their own Python, so they are unaffected.

Note

Sequencing confirmed: no 0.35.2; ships in 0.36.0.

Note

Side finding, now moot: on Python 3.10, apm audit already fails in 0.35.1 and main with Error: No module named 'tomllib'. The cause is an unconditional import tomllib in src/apm_cli/security/file_scanner.py (#3529). Because there will be no 0.35.2 and 0.36.0 drops Python 3.10, no tomli fallback is needed.

Problem (WHY)

Approach (WHAT)

# Change
1 requires-python = ">=3.11"; drop the 3.9 and 3.10 classifiers; remove the [tool.uv] constraint-dependencies filelock split; raise the direct floor to filelock>=4.2.1; drop the tomli; python_version<'3.11' backport.
2 Edit uv.lock by hand instead of regenerating it (see Trade-offs). Drop the 3.10-only packages, markers and wheels. Keep public PyPI source URLs and revision = 5.
3 Align every place that enforces the floor: install.sh and install.ps1 pip fallback, devcontainer feature install.sh, and the Windows git-discovery CI matrix (['3.10','3.11'] → ['3.11']).
4 Update the docs (installation, install-failures, enterprise security, integration-testing, devcontainer README), README (pip line), NOTICE and metadata, and CHANGELOG (BREAKING entry).
5 Clean up code that is now safe at a 3.11 floor: ruff target-version = "py311" with autofixes (timezone.utc → UTC, import sort), removal of the 3.10 fromisoformat Z shim in apm lock, and a direct import tomllib in scripts/generate-notice.py.

Implementation (HOW)

  • pyproject.toml: floor, classifiers, dependency floors, [tool.uv] removal, ruff py311, and the trusted_executable marker text. Adds UP042 (StrEnum) to the ruff ignore list instead of auto-migrating it. StrEnum changes the output of str() and format(), so that migration is not mechanical.
  • uv.lock: requires-python >=3.11. Removes the [manifest] constraint, async-timeout, exceptiongroup, filelock 3.29.0, every python_full_version < '3.11' dependency edge, and the cp310-cp310 / pp310 wheels. cp310-abi3 wheels stay because they still install on 3.11+. The < '3.11' fork is removed from resolution-markers. Diff: +3/−275.
  • install.sh / install.ps1: the pip fallback now requires 3.11. In install.ps1 the check moves from a stale 3.9 to 3.11.
  • devcontainer/: the feature floor is now 3.11 and the error suggests ubuntu:24.04 or debian:12. The pinned-version scenario moves off ubuntu:22.04 (system Python 3.10) to ubuntu:24.04. The bats boundary tests now check that 3.11 passes and 3.10 fails. The feature is not published yet (publishing is disabled in devcontainer-feature-publish.yml), so its version is not bumped.
  • .github/workflows/ci.yml: windows-git-discovery now runs on 3.11 only. Its < (3, 12) PATHEXT fallback still applies there, so the job still covers it. The job is not listed in merge-gate.yml EXPECTED_CHECKS, so removing the 3.10 check run does not affect the gate.
  • src/apm_cli/commands/lock.py: removes _normalize_utc_designator, because 3.11's datetime.fromisoformat parses a trailing Z. Its test still asserts that Z input normalizes to +00:00.
  • Untouched on purpose: scripts/runtime/setup-llm.*, runtime/manager.py and troubleshooting/ssl-issues.md still say "3.10+". Those refer to the llm child-runtime venv's need for truststore, not to APM's own interpreter. git_env.py's < (3, 12) gate is also unchanged, because it still applies to 3.11.

Diagram

Legend: every place that now enforces the 3.11 floor (solid edges), and the standalone binary path, which bundles its own Python and is unaffected (dashed).

flowchart LR
    PY["pyproject.toml<br/>requires-python >=3.11"] --> LOCK["uv.lock<br/>requires-python >=3.11<br/>filelock 4.2.10 only"]
    PY --> PIP["pip / PyPI metadata<br/>refuses 3.10"]
    SH["install.sh pip fallback<br/>REQUIRED_VERSION 3.11"] --> PIP
    PS["install.ps1 pip fallback<br/>minor -ge 11"] --> PIP
    DC["devcontainer feature<br/>PYTHON_MINOR -lt 11 fails"] --> PIP
    BIN["standalone binaries<br/>bundled Python 3.12"] -.->|"unaffected"| USER["user"]
    PIP --> USER
    CI["ci.yml windows-git-discovery<br/>matrix 3.11"] --> PY
Loading

Trade-offs

  • uv.lock edited by hand, not regenerated. Running uv lock locally either cannot reach files.pythonhosted.org or, through the internal feed proxy, rewrites every source URL, downgrades the lock to revision = 3, and resolves filelock 4.2.9 instead of 4.2.10. I used the proxy run only as a structural reference. A normalized diff (ignoring source and URL fields) matches the edited lock except for the proxy's filelock version and the fork grouping of resolution-markers. The edited lock keeps the existing 3.11/3.12/3.13/3.14 forks. Against public PyPI, uv lock --check passes and uv lock makes no changes.
  • Ruff py311 autofixes widen the diff (about 15 files) with mechanical timezone.utc → UTC changes. Leaving py310 would let 3.10-compatible idioms keep accumulating. UP042 is ignored on purpose (see Implementation).
  • Devcontainer users who pin an old APM on ubuntu:22.04 now hit the 3.11 check, even though old APM releases ran on 3.10. Keeping a single floor was chosen over a version-aware check.
  • README edited (one line: pip (Python 3.10+) → 3.11+). Repo rule 2 requires maintainer approval for README changes, so please confirm during review.

Benefits

  1. Patched filelock (≥ 4.2.1) is the only resolution on every supported interpreter. uv.lock has 0 python_full_version < '3.11' markers, down from 16.
  2. A single 3.11 floor across pyproject.toml, both installers' pip fallback, the devcontainer feature, docs and CI (install.ps1 previously checked 3.9).
  3. The lockfile drops 3 packages and 212 wheel rows that only applied to 3.10.

Issue and approved scope

Issue: Refs #3562

Human scope-approval comment: #3562 (comment) (maintainer decision of 2026-11-12, also recorded in the Atlas decision decisions/2026-11-12-require-python-311.md).

Does this PR complete the issue, or what remains? It contains all the code for the decision. The issue stays open until 0.36.0 ships, hence Refs, not Fixes.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass (CI; see Validation for local machine-load timeouts)
  • Added tests for new functionality: a new install.ps1 floor boundary test (panel follow-up); the existing boundary tests were moved to the new 3.11 floor.

Validation

Lint contract (.apm/instructions/linting.instructions.md, including scripts/windows_native_symlink_probe_entry.py): all green.

$ ruff check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
All checks passed!
$ ruff format --check ...
2124 files already formatted
$ python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ ...
Your code has been rated at 10.00/10
$ bash scripts/lint-auth-signals.sh
[+] auth-signal lint clean
$ bash scripts/lint-architecture-boundaries.sh   # exit 0

Lockfile, against public PyPI (UV_DEFAULT_INDEX=https://pypi.org/simple):

$ uv lock --check
Resolved 105 packages in 12ms        # exit 0
$ uv lock && git diff --quiet uv.lock  # unchanged (idempotent)
$ grep -c "python_full_version < '3.11'" uv.lock
0

Python 3.10 is refused at install time:

$ uv pip install --python <3.10 venv> .
  ... apm-cli==0.35.1 depends on Python>=3.11 ... requirements are unsatisfiable.

NOTICE was regenerated with scripts/generate-notice.py from a venv matching uv.lock. The diff only removes the tomli component and updates the filelock requirement and note.

Local unit suite (macOS, pytest tests/unit tests/test_console.py tests/red_team -n 8)
86 failed, 26245 passed, 11 skipped, 21 xfailed in 1948.13s
  • 74 of the 86 failures are subprocess.TimeoutExpired in installer-script suites (test_unix_install_ownership.py, test_unix_installer_checksums.py) under 8-way load. The same test_binary_failure_advice_preserves_installation_ownership[...-existing] timeouts reproduce on unmodified origin/main on this machine.
  • 1 failure was real: test_project_licensing.py::test_filelock_notice_matches_reviewed_release pinned the old "locked 3.29.0 release" note. Fixed in this PR.
  • A serial rerun of the remaining non-installer failures gave 5 failed, 411 passed. All 5 are environmental: test_is_tool_available needs python on PATH, and the 4 others are network/curl-backed test_public_release_metadata.py cases that differ from run to run.

CI on this PR is the authoritative signal. On merge commit 79891b3ee6, all 31 checks pass, including Lint, both Build & Test shards, Windows Git Discovery (Python 3.11), Windows Compatibility Gate, the lifecycle smoke shards, NOTICE Drift Check, Spec conformance, Devcontainer Feature - Test (bats plus the image scenarios, including the new pinned-version image ubuntu:24.04) and Merge Gate. Later main merges were clean; ruff and the pylint R0801 mirror were rerun on them.

Scenario Evidence

# Scenario (user promise) Principle(s) Test(s) proving it Type
1 "On a 3.10 machine, the binary-failure pip fallback tells me to install Python 3.11+ and never runs pip." DevX / Secure by default tests/unit/install/test_unix_install_ownership.py::test_binary_failure_advice_preserves_installation_ownership (3.10 rejected, 3.11 accepted), ::test_missing_python_recovery_does_not_invent_pip_command unit
1b "On Windows, the pip fallback refuses Python 3.10 and accepts 3.11+." DevX / Portability tests/unit/test_enterprise_bootstrap_installers.py::test_windows_pip_fallback_enforces_python_311_floor (runs Test-PythonRequirement under pwsh; reverting the check to -ge 9 makes it fail) unit
2 "The devcontainer feature fails fast on Python 3.10 and continues on 3.11." DevX devcontainer/test/apm-cli/unit/install.bats (boundary tests for 3.11 passing and 3.10 failing; CI unit-bats) unit
3 "Windows git/gh discovery still runs natively on the oldest supported Python." Portability tests/unit/test_windows_compat_gate_workflow.py::test_legacy_windows_git_discovery_runs_real_consumer_contracts, CI Windows Git Discovery (Python 3.11) unit / CI
4 "apm lock export --timestamp ...Z still accepts UTC Z timestamps." DevX tests/unit/export/test_sbom.py::test_resolve_export_timestamp_valid_iso unit
5 "NOTICE attributes exactly the dependencies APM installs." OSS NOTICE Drift Check (CI), tests/unit/test_project_licensing.py::test_filelock_notice_matches_reviewed_release unit / CI

How to test

  • uv lock --check against public PyPI → Resolved 105 packages, exit 0.
  • grep -c "python_full_version < '3.11'" uv.lock → 0.
  • uv venv --python 3.10 /tmp/v && uv pip install --python /tmp/v/bin/python . → resolution fails because of requires-python >=3.11.
  • bash install.sh with only a Python 3.10 on PATH and a forced binary failure → prints Install Python 3.11+ first.

Spec conformance (OpenAPM v0.1)

  • N/A: this PR does not change OpenAPM-observable behaviour.

Co-authored-by: Copilot [email protected]

Python 3.10 reached end of life in October 2026 and every fixed filelock
release (>= 4.2.1, GHSA-v4x8-3wr5-3wq8 family) requires Python 3.11.
Raise requires-python to >=3.11, drop the #3465 filelock Python-version
split so filelock >= 4.2.1 applies everywhere, and remove the tomli
backport. uv.lock is edited surgically (public PyPI source URLs and lock
revision 5 preserved); uv lock --check passes against PyPI.

Also align install.sh/install.ps1 pip fallback, the devcontainer feature
floor, the Windows git-discovery CI matrix, docs and NOTICE.

Refs #3562

Co-authored-by: Copilot App <[email protected]>
…-python-311

# Conflicts:
#	docs/src/content/docs/getting-started/installation.md
#	tests/unit/install/test_unix_install_ownership.py

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 shipped apm-usage guide still recommends Python 3.10+ in two places, which can direct users to an interpreter incompatible with the upcoming release; both references need updating to Python 3.11+.

1 open issue
What changed in this PR

This PR raises APM's minimum Python version to 3.11 for the planned 0.36.0 release, removing the compatibility constraint that prevented patched filelock versions on Python 3.10. Prebuilt binaries retain their bundled Python.

Changes:

  • Aligns package metadata, installers, devcontainers, documentation, and Windows discovery CI with Python 3.11+.
  • Removes Python 3.10-only dependency resolutions and updates license notices.
  • Adopts Python 3.11 standard-library features and adjusts existing regression tests.
File Description
uv.lock Removes Python 3.10 resolutions, dependency edges, and wheels.
tests/​unit/​test_windows_compat_gate_workflow.py Expects the discovery matrix to use Python 3.11 only.
tests/​unit/​test_project_licensing.py Checks attribution for locked filelock 4.2.10.
tests/​unit/​scripts/​test_run_mutation_pilot.py Groups tomllib with standard-library imports.
tests/​unit/​integration/​test_agent_integrator.py Groups tomllib with standard-library imports.
tests/​unit/​install/​test_unix_install_ownership.py Moves installer boundary cases and guidance to 3.11.
tests/​unit/​install/​test_mcp_lockfile_determinism.py Uses datetime.UTC in timestamp fixtures.
tests/​unit/​export/​test_sbom.py Removes shim-specific assertions while retaining UTC parsing coverage.
tests/​test_lockfile.py Uses datetime.UTC in timestamp fixtures.
tests/​spec_conformance/​test_manifest_reqs.py Groups tomllib with standard-library imports.
tests/​quality/​test_test_taxonomy.py Groups tomllib with standard-library imports.
tests/​quality/​test_ci_topology.py Groups tomllib with standard-library imports.
tests/​integration/​test_oci_mcp_lifecycle_contract.py Groups tomllib with standard-library imports.
tests/​integration/​test_marketplace_object_audit_lifecycle.py Uses datetime.UTC in timestamp assertions.
tests/​integration/​test_marker_registry_sync.py Reorders tomllib as a standard-library import.
tests/​integration/​test_codex_agent_tool_scope_contract.py Groups tomllib with standard-library imports.
src/​apm_cli/​security/​file_scanner.py Reorders the existing tomllib import.
src/​apm_cli/​deps/​lockfile.py Uses datetime.UTC for lockfile timestamps.
src/​apm_cli/​deps/​git_semver_resolver.py Uses datetime.UTC for resolution timestamps.
src/​apm_cli/​core/​script_executors.py Uses datetime.UTC for script-log timestamps.
src/​apm_cli/​core/​lifecycle_scripts.py Uses datetime.UTC for lifecycle timestamps.
src/​apm_cli/​core/​azure_cli.py Uses datetime.UTC for expiry conversion.
src/​apm_cli/​commands/​lock.py Removes the Python 3.10 UTC-designator shim.
src/​apm_cli/​bundle/​lockfile_enrichment.py Uses datetime.UTC for pack timestamps.
scripts/​notice-metadata.yaml Removes tomli attribution and updates filelock notes.
scripts/​generate-notice.py Imports tomllib directly without the backport fallback.
README.md Updates the pip prerequisite comment to Python 3.11+.
pyproject.toml Raises Python and filelock floors and targets Ruff at 3.11.
NOTICE Aligns dependency notices with the new requirements.
install.sh Requires Python 3.11 for pip fallback and recovery guidance.
install.ps1 Raises pip fallback eligibility from Python 3.9 to 3.11.
docs/​src/​content/​docs/​troubleshooting/​install-failures.md Updates the pip prerequisite.
docs/​src/​content/​docs/​getting-started/​installation.md Aligns installation and fallback requirements.
docs/​src/​content/​docs/​enterprise/​security.md Updates supported Windows discovery version wording.
docs/​src/​content/​docs/​contributing/​integration-testing.md Documents the Python 3.11 discovery job.
devcontainer/​test/​apm-cli/​with-python-feature.sh Checks for Python 3.11 or newer.
devcontainer/​test/​apm-cli/​unit/​install.bats Tests acceptance at 3.11 and rejection at 3.10.
devcontainer/​test/​apm-cli/​scenarios.json Moves the pinned-version scenario to Ubuntu 24.04.
devcontainer/​src/​apm-cli/​install.sh Enforces Python 3.11 and updates image guidance.
devcontainer/​README.md Updates prerequisites, scenarios, and supported images.
CHANGELOG.md Announces the breaking Python requirement.
.github/​workflows/​ci.yml Removes Python 3.10 from Windows discovery CI.

Review effort: Balanced

Comment thread pyproject.toml Resolved
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Raises APM's Python floor to 3.11 and clears the filelock GHSA-v4x8-3wr5-3wq8 vulnerability family in one coordinated breaking change.

panel-mode=lean; personas=supply-chain-security-expert,test-coverage-expert,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Both panelists agree. The supply-chain-security-expert confirms the lockfile surgery is sound: filelock moves from the 3.x fork to 4.2.10 with hashes, the 3.10 backports are correctly removed, and nothing that 3.11+ needs was dropped. The test-coverage-expert confirms that five of the six changed user-promise surfaces have regression traps. The one gap: install.ps1 Test-PythonRequirement changed its -ge operand from 9 to 11 with no boundary test, while install.sh has both bats and pytest coverage for the same gate. If someone later reverted the PowerShell floor, the change would ship silently.

Strategically, this is the right move at the right time. Dropping 3.10 removes the tomli backport, the _normalize_utc_designator shim, and the [tool.uv] constraint-dependencies workaround that kept filelock on an unpatched release for 3.10. The ruff target-version = "py311" change and the UP017 autofixes are housekeeping that depended on this new floor. The breaking change is communicated correctly: a chore!: prefix, a CHANGELOG **BREAKING** entry that references #3562, and a recorded maintainer decision.

The missing install.ps1 boundary test is a recommended follow-up. It does not justify holding a coordinated change that is otherwise green across 31 CI checks.

Aligned with: Secure by default (the filelock>=4.2.1 floor clears the GHSA family without a version-forked constraint); portable by manifest (requires-python, the installer guards, the devcontainer feature and the CI matrix move to 3.11 together); OSS community driven (decision recorded in #3562, a BREAKING CHANGELOG line, and no ambiguous 0.35.2).

Panel summary

Persona B R N Takeaway
Supply Chain Security Expert 0 0 0 The lockfile surgery is clean: filelock 4.2.10 everywhere with hashes, the 3.10 backports are removed, no dependency 3.11+ needs is dropped, and the installer floors now agree.
Test Coverage Expert 0 1 0 Five of six changed user-promise surfaces have regression traps; the install.ps1 Python-floor guard has no boundary test (install.sh does).

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 1 follow-ups

  1. [Test Coverage Expert] Add a boundary test for install.ps1 Test-PythonRequirement that asserts the -ge operand is 11 and that the pip-fallback error says 'Python 3.11+'. -- install.sh has bats and pytest boundary tests for the same gate, and install.ps1 has none. Without a test, a revert to -ge 9 would ship silently.

Recommendation

Ship with this follow-up. The breaking change is communicated properly, and the security posture improves materially because the filelock vulnerability family is cleared. All 31 CI checks are green, and the panelists report either nothing or one low-severity gap. Add the install.ps1 boundary test so the Windows installer has the same regression traps as the Unix one.


Full per-persona findings

Supply Chain Security Expert

No findings.

Test Coverage Expert

  • [recommended] The install.ps1 Test-PythonRequirement version floor changed from 3.9 to 3.11 with no boundary test, at install.ps1:292.
    install.sh has a bats boundary test (3.10 refused, 3.11 accepted) and a pytest parametrize [None, 3.10, 3.11]. Nothing asserts the install.ps1 floor or its error wording. The Windows e2e test only runs the happy path.
    Suggested: Add a structural unit test that extracts Test-PythonRequirement from install.ps1 and asserts the -ge 11 operand and the 'Python 3.11+' error string.
    Proof (missing at): tests/unit/test_enterprise_bootstrap_installers.py::test_windows_pip_fallback_python_floor_is_3_11 -- proves: the Windows pip fallback refuses Python versions below the declared 3.11 floor [devx,portability-by-manifest]

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Folds the panel follow-up on #3589: run Test-PythonRequirement under a
PowerShell host with stubbed interpreters so 3.10 is refused and 3.11+
accepted, and assert the refusal names Python 3.11+.

Refs #3562

Co-authored-by: Copilot App <[email protected]>
The shipped apm-usage guide still pointed pip users at Python 3.10+.
Also generalize a notice-drift comment that cited the removed tomli
marker.

Refs #3562

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 76fe2c8 into main Nov 12, 2026
34 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-require-python-311 branch November 12, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants