Skip to content

chore!: require Python 3.11 or newer - #1927

Merged
hassiebp merged 2 commits into
prepare-v5-releasefrom
lfe-16917-python-sdk-add-python-315-support-and-drop-310
Oct 7, 2026
Merged

hassiebp merged 2 commits into
prepare-v5-releasefrom
lfe-16917-python-sdk-add-python-315-support-and-drop-310

Conversation

@hassiebp

@hassiebp hassiebp commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Python SDK v5 requires Python >=3.11 (3.10 reaches end of life in October 2026). This redoes the closed #1923 on prepare-v5-release:

  • requires-python = ">=3.11,<4.0" and ruff target-version = "py311"
  • CI unit matrix: 3.11 to 3.14 (3.10 dropped); AGENTS.md CI contract updated
  • removes the pre-3.11 fallbacks: asyncio.create_task(context=...) in the async-generator wrapper of observe, the typing_extensions.NotRequired fallback, and the skipif(python<3.11) markers
  • uv.lock regenerated with the CI-pinned uv 0.11.2; only the 3.10-only packages (backports-asyncio-runner, exceptiongroup, tomli) and markers drop out. The relative exclude-newer header is kept as it was, so later lock edits on this stack don't collide with it.

Stack: 1 of 10 in the v5 stack. Base: prepare-v5-release. Merge this first.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Documentation update
  • Tooling, CI, or repo maintenance

Verification

uv run --frozen ruff check .                       # All checks passed!
uv run --frozen mypy langfuse --no-error-summary   # clean
uvx uv@0.11.2 lock --check                         # Resolved 91 packages
uv run --frozen pytest -n auto tests/unit          # 713 passed, 2 skipped (Python 3.12)
uv run --frozen --python 3.11 pytest -n auto tests/unit  # 713 passed, 2 skipped (Python 3.11)

Checklist

  • I self-reviewed the diff using code_review.md.
  • I added or updated tests for behavior changes.
  • I updated docs, examples, or .env.template if needed.
  • I did not hand-edit generated files; if generated files changed, I used the upstream regeneration path.
  • I did not commit secrets or credentials.
Open in Web Open in Cursor 

RetriggerConfidence Score: 4/5

The PR should not merge until @observe preserves asynchronous tracing for asyncio-marker-bearing callables.

Summary

The PR raises the SDK’s minimum Python version to 3.11, updates CI and tooling targets, and removes older-version fallbacks and lockfile entries.

  • The coroutine predicate change also alters @observe dispatch for asyncio-marker-bearing callables on Python 3.11.

Reviews (1) · Last reviewed commit: "chore!: require Python 3.11 or newer"

Python 3.10 reaches end of life in October 2026. Raise requires-python
to >=3.11, target py311 in ruff, drop 3.10 from the CI unit matrix, and
remove the pre-3.11 fallbacks for asyncio.create_task(context=...) and
typing.NotRequired.

Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
@hassiebp
hassiebp requested a review from a team as a code owner October 6, 2026 14:27
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

@claude review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T14:33:53.923668Z 18a7f21 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.

Tip: disable this comment in your organization's Code Review settings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18a7f21cbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread langfuse/_client/observe.py Outdated
Comment thread langfuse/_client/observe.py Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, straightforward minimum-Python-version bump.

What was reviewed: the pyproject.toml/ruff/CI matrix/AGENTS.md version bumps for consistency (all now 3.11+), the removal of the _ASYNCIO_CREATE_TASK_SUPPORTS_CONTEXT fallback and typing_extensions.NotRequired fallback in favor of direct 3.11+ APIs, and the corresponding test cleanup (removed skipif markers and the now-dead fallback test). The asyncio.iscoroutinefunction to inspect.iscoroutinefunction swap in observe.py was already investigated by the bug hunter as a candidate and ruled out as a duplicate.

Extended reasoning...

The diff is a mechanical minimum-Python-version bump (3.10 to 3.11) touching pyproject.toml, CI config, AGENTS.md docs, uv.lock, and two source files (observe.py, types.py) plus matching test removals; no security-sensitive surface (auth, crypto, permissions) is touched. Every file change matches the PR description precisely with no discrepancies found on inspection. The one non-mechanical code change (iscoroutinefunction swap) was already examined by the automated bug-hunting system and ruled out as a duplicate, leaving no open findings or unaddressed objections in the timeline.

inspect.iscoroutinefunction ignores asyncio's _is_coroutine marker,
which asgiref's markcoroutinefunction sets on Python < 3.12. Accept
both so such functions keep the async wrapper and their observation
ends after the coroutine runs.

Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
@hassiebp
hassiebp merged commit 41617eb into prepare-v5-release Oct 7, 2026
13 checks passed
@hassiebp
hassiebp deleted the lfe-16917-python-sdk-add-python-315-support-and-drop-310 branch October 7, 2026 08:51
@cursor cursor Bot mentioned this pull request Oct 7, 2026
7 of 11 tasks
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