Repository navigation
feat: bump Python minimum from 3.12 to 3.13, drop strenum backport - #14767
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR raises the project Python floor to 3.13 (pyproject, Dockerfile, CI, docs) and replaces third-party ChangesPython 3.13 Upgrade
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
.github/workflows/tests.ymlCLAUDE.mdDockerfileagent/tools/code_exec.pydeepdoc/parser/mineru_parser.pypyproject.toml
Thanks for your review. I will fix it right away. |
- 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.
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
pyproject.toml
a4fef78 to
9d6721a
Compare
9d6721a to
160a4ee
Compare
There was a problem hiding this comment.
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 winUpgrade
onnxruntimeandonnxruntime-gputo 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
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
.github/workflows/tests.ymlCLAUDE.mdDockerfileagent/tools/code_exec.pyapi/db/__init__.pycommon/constants.pydeepdoc/parser/mineru_parser.pymcp/server/server.pypyproject.tomlrag/llm/__init__.pyrag/llm/chat_model.pytest/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
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.
160a4ee to
e1752a3
Compare
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.
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
.github/workflows/tests.ymlCLAUDE.mdDockerfileagent/tools/code_exec.pyapi/db/__init__.pycommon/constants.pydeepdoc/parser/mineru_parser.pymcp/server/server.pypyproject.tomlrag/llm/__init__.pyrag/llm/chat_model.pytest/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
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Hi, @JinHai-CN |
|
LGTM |
Closes #14753
What changed
pyproject.tomlrequires-python→>=3.13,<3.15; removestrenum==0.4.15Dockerfileuv python install 3.13,uv sync --python 3.13.github/workflows/tests.ymluv sync --python 3.13on both matrix legsCLAUDE.mddeepdoc/parser/mineru_parser.pyfrom strenum import StrEnum→from enum import StrEnumagent/tools/code_exec.pyStrEnumhas been in the stdlib since Python 3.11 — thestrenumbackport package is no longer needed once the floor is 3.13.Why uv.lock is not regenerated
uv lock --python 3.13fails because:numpy>=1.26.4,<2.0.0tensorflow-cpu>=2.20.0(the first release with cp313 wheels) depends onml-dtypes>=0.5.1, which requiresnumpy>=2.1.0The lockfile regeneration requires loosening the
numpyupper bound in theinfiniflow/graspologicfork. Once that fork commit is updated and the SHA inpyproject.toml:49is bumped,uv lock --python 3.13will succeed.RFC corrections
Two claims in the original RFC (#14753) did not hold up under code review:
<3.13Python constraint. The blocker is the transitivenumpy<2.0.0conflict with tensorflow-cpu's test dependency, not a direct Python version cap.--disable-gilbuild 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.