Skip to content

feat: bump Python minimum from 3.12 to 3.13, drop strenum backport - #14767

Merged
yuzhichang merged 5 commits into
infiniflow:mainfrom
wdeveloper16:feat/python313-bump
May 15, 2026
Merged

yuzhichang merged 5 commits into
infiniflow:mainfrom
wdeveloper16:feat/python313-bump

Conversation

@wdeveloper16

Copy link
Copy Markdown
Contributor

Closes #14753

What changed

File Change
pyproject.toml requires-python → >=3.13,<3.15; remove strenum==0.4.15
Dockerfile uv python install 3.13, uv sync --python 3.13
.github/workflows/tests.yml uv sync --python 3.13 on both matrix legs
CLAUDE.md dev setup command + requirements note updated
deepdoc/parser/mineru_parser.py from strenum import StrEnum → from enum import StrEnum
agent/tools/code_exec.py same

StrEnum has been in the stdlib since Python 3.11 — the strenum backport package is no longer needed once the floor is 3.13.

Why uv.lock is not regenerated

uv lock --python 3.13 fails because:

  1. The infiniflow/graspologic fork pins numpy>=1.26.4,<2.0.0
  2. tensorflow-cpu>=2.20.0 (the first release with cp313 wheels) depends on ml-dtypes>=0.5.1, which requires numpy>=2.1.0
  3. These two constraints are irreconcilable on Python 3.13

The lockfile regeneration requires loosening the numpy upper bound in the infiniflow/graspologic fork. Once that fork commit is updated and the SHA in pyproject.toml:49 is bumped, uv lock --python 3.13 will succeed.

RFC corrections

Two claims in the original RFC (#14753) did not hold up under code review:

  • "graspologic hard-blocks 3.13" — the infiniflow fork at the pinned commit has no <3.13 Python constraint. The blocker is the transitive numpy<2.0.0 conflict with tensorflow-cpu's test dependency, not a direct Python version cap.
  • "free-threading throughput gains for I/O-bound workload" — Python 3.13 free-threading requires a special --disable-gil build and provides no benefit for async I/O code (the GIL is already released during I/O). The real motivation is forward compatibility and improved error messages.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 11, 2026
@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR raises the project Python floor to 3.13 (pyproject, Dockerfile, CI, docs) and replaces third-party strenum.StrEnum imports with the standard-library enum.StrEnum across code and tests.

Changes

Python 3.13 Upgrade

Layer / File(s) Summary
Project Metadata & Requirements
pyproject.toml
requires-python updated from >=3.12,<3.15 to >=3.13,<3.15; ormsgpack relaxed from ==1.5.0 to >=1.5.0; uv constraints/indices updated.
Build & Deployment Configuration
Dockerfile, .github/workflows/tests.yml
uv python install in Dockerfile base stage changed to 3.13; builder uv sync --python and CI uv sync --python steps updated from 3.12 to 3.13.
Documentation Updates
CLAUDE.md
uv sync example changed to use Python 3.13 and supported Python range extended to 3.10–3.13.
Standard Library Import Migration
agent/tools/code_exec.py, deepdoc/parser/mineru_parser.py, api/db/__init__.py, common/constants.py, mcp/server/server.py, rag/llm/__init__.py, rag/llm/chat_model.py, test/.../test_session_sdk_routes_unit.py
Replaced strenum.StrEnum imports with enum.StrEnum in modules and tests.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as pyproject.toml
  participant Build as Dockerfile
  participant CI as .github/workflows/tests.yml
  Dev->>Build: bump requires-python -> 3.13
  Dev->>CI: update uv sync --python -> 3.13
  CI->>Build: CI uses uv sync --python 3.13 during test/setup
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped from twelve up to thirteen with cheer,
Stdlib StrEnum now cuddles near,
Docker, CI, docs all sing one tune,
Small edits made beneath the moon,
A tidy hop — we’re ready to steer.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description does not follow the required template format. It lacks the 'What problem does this PR solve?' and 'Type of change' sections specified in the template. Add the missing template sections: briefly describe the problem the PR solves and select the appropriate type of change from the provided checkboxes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR largely meets the objectives from RFC #14753: Python version bumped to 3.13 in pyproject.toml, Dockerfile, and CI workflow; strenum import replaced with stdlib enum in multiple files; documentation updated. However, uv.lock was not regenerated as required, citing unresolved graspologic numpy constraints. Resolve the graspologic numpy version conflict (fork and patch the infiniflow/graspologic dependency to allow numpy>=2.1.0) and regenerate uv.lock before merging to fully meet RFC requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes: bumping Python minimum from 3.12 to 3.13 and removing the strenum backport dependency.
Out of Scope Changes check ✅ Passed All changes are directly related to the Python 3.13 bump objective. The pyproject.toml updates to constraint-dependencies and override-dependencies appear to be aligned with resolving dependency conflicts for Python 3.13 support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent/tools/code_exec.py`:
- Line 27: Replace all remaining third-party strenum imports with the stdlib
version: in the modules
test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py
(test module), rag.llm.__init__, rag.llm.chat_model, mcp.server.server,
api.db.__init__, and common.constants, change any "from strenum import StrEnum"
(or similar) to "from enum import StrEnum" so the code uses the Python 3.13+
builtin; ensure any references to StrEnum types remain valid after the swap and
run the test suite to confirm no regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8d40fda0-3271-42f4-b966-c8e842c211bc

📥 Commits

Reviewing files that changed from the base of the PR and between 46897d6 and 155b36d.

📒 Files selected for processing (6)
  • .github/workflows/tests.yml
  • CLAUDE.md
  • Dockerfile
  • agent/tools/code_exec.py
  • deepdoc/parser/mineru_parser.py
  • pyproject.toml

Comment thread agent/tools/code_exec.py Resolved
@JinHai-CN JinHai-CN added the ci Continue Integration label May 11, 2026
@JinHai-CN
JinHai-CN marked this pull request as draft May 11, 2026 08:47
@JinHai-CN
JinHai-CN marked this pull request as ready for review May 11, 2026 08:47
@dosubot dosubot Bot added the python:uv Pull requests that update python:uv code label May 11, 2026
@JinHai-CN

Copy link
Copy Markdown
Member

@wdeveloper16

Copy link
Copy Markdown
Contributor Author

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels May 11, 2026
- pyproject.toml: requires-python >= 3.13
- Dockerfile: uv python install / uv sync target -> 3.13
- .github/workflows/tests.yml: uv sync target -> 3.13 (both matrix legs)
- CLAUDE.md: update dev setup command and requirements note
- deepdoc/parser/mineru_parser.py, agent/tools/code_exec.py:
  replace `from strenum import StrEnum` with `from enum import StrEnum`
  (StrEnum is stdlib since Python 3.11)
- pyproject.toml: remove strenum==0.4.15 dependency

uv.lock regeneration is deferred: the infiniflow/graspologic fork pins
numpy<2.0.0, which conflicts with tensorflow-cpu>=2.20.0 (the first
release with cp313 wheels) requiring numpy>=2.1.0 via ml-dtypes.
Regeneration requires loosening the numpy upper bound in the graspologic
fork first.

Closes infiniflow#14753
…files

Replace `from strenum import StrEnum` with `from enum import StrEnum`
(stdlib since Python 3.11) in api/db/__init__.py, common/constants.py,
mcp/server/server.py, rag/llm/__init__.py, rag/llm/chat_model.py, and
the session-management unit test. No strenum third-party import remains.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyproject.toml`:
- Line 188: Update the index strategy setting in pyproject.toml by replacing the
existing index-strategy value "unsafe-best-match" with "first-index"; locate the
line containing the exact token index-strategy = "unsafe-best-match" and change
it to index-strategy = "first-index" so resolution only considers the first
index containing a package, mitigating dependency-confusion risk.
- Line 179: The dependency line "tensorflow-cpu>=2.17.0; python_version <
'3.13'" is unreachable given requires-python = ">=3.13,<3.15" and no tensorflow
usage exists; remove that dependency entry from pyproject.toml and any related
extras/markers, and run a quick repo-wide search for "tensorflow" imports/usages
to confirm there are no remaining references before committing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 51db450a-f014-4f3a-9d3a-78835cd88f6d

📥 Commits

Reviewing files that changed from the base of the PR and between fc0a3b1 and 3b30696.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • pyproject.toml

Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
@wdeveloper16
wdeveloper16 force-pushed the feat/python313-bump branch 3 times, most recently from a4fef78 to 9d6721a Compare May 11, 2026 09:38
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 11, 2026
@wdeveloper16
wdeveloper16 force-pushed the feat/python313-bump branch from 9d6721a to 160a4ee Compare May 11, 2026 09:39

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pyproject.toml (1)

71-72: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Upgrade onnxruntime and onnxruntime-gpu to version 1.26.0 or later to support Python 3.13.

Version 1.23.2 has no cp313 wheels. The project requires Python 3.13+ but these pinned versions will force source builds or fail installation on Python 3.13. Version 1.26.0 provides full cp313 wheel support including free-threaded variants (cp313t).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` around lines 71 - 72, The pinned dependencies
"onnxruntime==1.23.2; sys_platform == 'darwin' or platform_machine != 'x86_64'"
and "onnxruntime-gpu==1.23.2; sys_platform != 'darwin' and platform_machine ==
'x86_64'" must be updated to at least version 1.26.0 so Python 3.13 cp313 wheels
are available; change both version pins from 1.23.2 to 1.26.0+ (or a specific
>=1.26.0 release) in the dependency list and run install/tests to verify correct
wheel selection on macOS and x86_64 GPU Linux.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyproject.toml`:
- Line 77: Update the PR description to explicitly state why the ormsgpack
constraint was loosened: mention the commit "fix: unblock Python 3.13 Docker
build — upgrade ormsgpack to 1.12.2", explain that ormsgpack 1.5.0 lacks Python
3.13 wheels while newer releases include them, and that allowing
ormsgpack>=1.5.0 permits pip to choose a Python-3.13-compatible wheel; reference
the dependency line "ormsgpack>=1.5.0" in pyproject.toml so reviewers can easily
correlate the rationale with the change.

---

Outside diff comments:
In `@pyproject.toml`:
- Around line 71-72: The pinned dependencies "onnxruntime==1.23.2; sys_platform
== 'darwin' or platform_machine != 'x86_64'" and "onnxruntime-gpu==1.23.2;
sys_platform != 'darwin' and platform_machine == 'x86_64'" must be updated to at
least version 1.26.0 so Python 3.13 cp313 wheels are available; change both
version pins from 1.23.2 to 1.26.0+ (or a specific >=1.26.0 release) in the
dependency list and run install/tests to verify correct wheel selection on macOS
and x86_64 GPU Linux.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e362f62-0569-4d28-901c-859f0e46dfbf

📥 Commits

Reviewing files that changed from the base of the PR and between 3b30696 and 160a4ee.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • .github/workflows/tests.yml
  • CLAUDE.md
  • Dockerfile
  • agent/tools/code_exec.py
  • api/db/__init__.py
  • common/constants.py
  • deepdoc/parser/mineru_parser.py
  • mcp/server/server.py
  • pyproject.toml
  • rag/llm/__init__.py
  • rag/llm/chat_model.py
  • test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py
✅ Files skipped from review due to trivial changes (7)
  • deepdoc/parser/mineru_parser.py
  • CLAUDE.md
  • rag/llm/init.py
  • test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py
  • api/db/init.py
  • Dockerfile
  • .github/workflows/tests.yml
🚧 Files skipped from review as they are similar to previous changes (4)
  • rag/llm/chat_model.py
  • agent/tools/code_exec.py
  • common/constants.py
  • mcp/server/server.py

Comment thread pyproject.toml Resolved
ormsgpack:
- Relax pin to >=1.5.0; resolves to 1.12.2 (first version with cp313
  wheels). 1.5.0 had no cp313 wheel and failed via maturin on stable Rust.

trio / Python 3.13 crash:
- trio<0.26 crashes at import on Python 3.13: pathlib.Path.parser is now
  a module, not a callable; trio's _path.py metaclass hits TypeError.
  anyio's pytest plugin calls get_available_backends() at module load,
  importing trio eagerly, so pytest crashes before running any test.
- Add constraint trio>=0.26.0 (via selenium-wire→trio-websocket→trio).
- trio 0.26+ requires attrs>=23.2.0, but moodlepy<=0.24.1 pins
  attrs<23.0.0. attrs 23.x is backward-compatible; add an
  override-dependencies entry to bypass moodlepy's over-conservative pin.
- trio 0.26+ is not yet on the Aliyun mirror. Add PyPI as an explicit
  index and route trio to it via [tool.uv.sources] to avoid the
  dependency-confusion risk of unsafe-best-match while still finding
  the correct version.

Result: trio resolves to 0.33.0 from PyPI; attrs to 26.1.0 from Aliyun.

Regenerate uv.lock for all of the above.
@wdeveloper16
wdeveloper16 force-pushed the feat/python313-bump branch from 160a4ee to e1752a3 Compare May 11, 2026 11:22
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels May 11, 2026
discord-py 2.3.2 imports audioop in discord/player.py; audioop was
removed from the stdlib in Python 3.13. audioop-lts provides the
module as a backport. No version marker needed since requires-python
is already >=3.13.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyproject.toml`:
- Line 10: The dependency "audioop-lts>=0.2.1" in pyproject.toml appears
undocumented and unused; either remove the "audioop-lts" entry from
pyproject.toml or, if it is intentionally required (e.g., for a transitive use,
platform audio support, or future compatibility), add a short justification to
the PR description explaining why "audioop-lts>=0.2.1" was added and where it is
used (or will be used) so reviewers understand its necessity.
- Around line 189-191: The comment next to the "trio>=0.26.0" constraint
incorrectly describes Python 3.13's pathlib change and the link to Trio; update
pyproject.toml by either removing the misleading comment or replacing it with an
accurate, concise rationale tied to Trio's actual changelog, and if the
constraint is intended to address Python 3.13 compatibility, verify the minimal
Trio release that includes the fix and bump "trio>=0.26.0" to that correct
version (or remove the constraint if unnecessary); reference the current literal
"trio>=0.26.0" and the mentioned symbol pathlib.Path.parser when verifying and
updating the comment and version constraint.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a4931aca-64e5-46ec-b61d-b17582fca610

📥 Commits

Reviewing files that changed from the base of the PR and between 160a4ee and cc63f95.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • .github/workflows/tests.yml
  • CLAUDE.md
  • Dockerfile
  • agent/tools/code_exec.py
  • api/db/__init__.py
  • common/constants.py
  • deepdoc/parser/mineru_parser.py
  • mcp/server/server.py
  • pyproject.toml
  • rag/llm/__init__.py
  • rag/llm/chat_model.py
  • test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py
✅ Files skipped from review due to trivial changes (8)
  • CLAUDE.md
  • agent/tools/code_exec.py
  • deepdoc/parser/mineru_parser.py
  • Dockerfile
  • api/db/init.py
  • rag/llm/init.py
  • mcp/server/server.py
  • common/constants.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/tests.yml
  • rag/llm/chat_model.py
  • test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py

Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
@codecov

codecov Bot commented May 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (592dba1) to head (caf8395).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14767   +/-   ##
=======================================
  Coverage   94.16%   94.16%           
=======================================
  Files          10       10           
  Lines         703      703           
  Branches      112      112           
=======================================
  Hits          662      662           
  Misses         25       25           
  Partials       16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wdeveloper16

Copy link
Copy Markdown
Contributor Author

Hi, @JinHai-CN
Sorry to ping you.
Would be it possible to review the PR again?

@yuzhichang

Copy link
Copy Markdown
Member

LGTM

@yuzhichang
yuzhichang merged commit 14c0985 into infiniflow:main May 15, 2026
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request May 21, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration python:uv Pull requests that update python:uv code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Python 3.12 → 3.13 Version Bump

3 participants