Skip to content

[Fix] Support Python 3.13 by relaxing dependency constraints#3010

Open
honglei wants to merge 17 commits into
eosphoros-ai:mainfrom
honglei:fix/python313
Open

[Fix] Support Python 3.13 by relaxing dependency constraints#3010
honglei wants to merge 17 commits into
eosphoros-ai:mainfrom
honglei:fix/python313

Conversation

@honglei

@honglei honglei commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #3006

PR Description

Summary

This PR adds support for Python 3.13 by relaxing or updating the version constraints for several key dependencies, including aiohttp, pandas, numpy, onnxruntime, and spacy. It ensures compatibility across Python 3.10 to 3.13 without forcing breaking changes on existing environments.

Problem

Python 3.13 introduced internal changes (such as the removal of some deprecated APIs and changes in C-API) that require newer versions of many scientific and web libraries. The previous version pinning (==) and strict upper bounds (e.g., <2.0.0 for numpy) in pyproject.toml prevented users from installing compatible versions in a Python 3.13 environment.

Solution

  • Relax Version Pinning: Changed strict version pinning (==) to minimum version constraints (>=) for aiohttp and pandas to allow the installer to select newer, compatible versions when running on Python 3.13.
  • Remove Numpy Upper Bound: Removed the <2.0.0 restriction for numpy. This allows the use of Numpy 2.x, which provides the necessary wheels and compatibility for Python 3.13.
  • Adjust External Dependencies: Updated onnxruntime and spacy constraints in dbgpt-ext to remove outdated upper bounds and allow versions that support Python 3.13.
  • Maintain Backward Compatibility: Retained existing lower bounds to ensure that users on Python 3.10, 3.11, and 3.12 can still run the project with their current setups without being forced to upgrade unless necessary.

How Has This Been Tested?

The changes have been verified in the following environment:

  • OS: Windows 11 x64
  • Python: 3.13
  • Tools: Verified that pip and uv can successfully resolve and install the dependency tree.
  • Functionality: Basic DB-GPT core operations were tested with the updated library versions to ensure no immediate regressions in the primary workflows.

Snapshots:

N/A

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

@chenliang15405

Copy link
Copy Markdown
Collaborator

@honglei Please fix the CI,the test python check is failed.

honglei added a commit to honglei/DB-GPT that referenced this pull request Apr 21, 2026
…n and hardcoded py313 path

The PR was blocked by CI infrastructure issues rather than dependency logic changes. Test Python jobs were auto-failed because upload-artifact v3 is deprecated, and code-quality setup could fail on runners lacking /opt/python313/bin/python3.13.\n\nThis updates upload-artifact to v4 and makes virtualenv creation choose /opt/python313 first, then fall back to python3.13/python3 from PATH for broader runner compatibility.\n\nConstraint: Keep fix minimal and limited to CI/setup behavior\nRejected: Reworking dependency matrix or Python version policy | unrelated to observed failure mode\nConfidence: high\nScope-risk: narrow\nReversibility: clean\nDirective: Keep CI action major versions current; avoid hardcoded interpreter paths without PATH fallback\nTested: make setup (pass)\nNot-tested: Full GitHub Actions rerun on PR eosphoros-ai#3010
The PR branch regressed due to two setup mismatches: test-python installed the repository root as an editable package, and Makefile used an absolute interpreter path tied to specific runners. Both caused avoidable CI breakage.

This rollback-based fix keeps scope narrow: use the actual package under test (packages/dbgpt-core), run tests against its source tree, move artifact upload to v4, and resolve Python via PATH fallback instead of /opt hardcoding.

Constraint: Keep fixes limited to CI/bootstrap behavior for PR eosphoros-ai#3010

Rejected: Keep root editable install () | fails under current monorepo layout

Rejected: Keep /opt/python313/bin/python3.13 | runner-specific path breaks portability

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: CI install/test paths must target workspace packages, not repo root

Tested: Verified failing reason from run 24702430365 logs; make -nB setup

Not-tested: Full GitHub matrix rerun
honglei added 11 commits April 21, 2026 13:06
The test-python workflow failed during dependency install because requirements/dev-requirements.txt in the branch was committed as binary content. pip could not decode it (UnicodeDecodeError at byte 0x88).

Restore the file to plain text requirements so pip can parse it across all matrix jobs.

Constraint: Keep scope to the broken requirements file only

Rejected: Change workflow to skip dev requirements install | hides the underlying corrupted file

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep requirements files as UTF-8 text; avoid binary rewrites

Tested: file and hex header checks confirm ASCII text content

Not-tested: Full GitHub Actions rerun
The Test Python matrix failed during collection with missing modules such as sqlalchemy, click, cloudpickle, and fastapi. The workflow only installed proxy_openai extra, which is insufficient for the selected test scope under packages/dbgpt-core/src/dbgpt.

Install the core package with the extras that provide the missing runtime/test dependencies used by those modules.

Constraint: Keep fix limited to workflow dependency setup

Rejected: Narrow test scope to avoid modules | would hide dependency regressions

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep workflow install extras aligned with test collection scope

Tested: Verified prior failure logs and mapped missing modules to extras

Not-tested: Full GitHub matrix rerun
Latest matrix failures show missing dbgpt_ext imports during collection and pytest 9 deprecation behavior breaking flow-variable tests.

Install dbgpt-ext and dbgpt-serve alongside dbgpt-core in the test workflow, and cap pytest below 9 to keep current tests compatible.

Constraint: Keep fix limited to CI workflow dependency/runtime setup

Rejected: Ignore failing modules via test selection | would hide integration regressions

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Test workflow must install workspace packages used by core test imports

Tested: Verified failure signatures from run 24705179474 logs

Not-tested: Full GitHub matrix rerun
Keep CI dependency installation aligned with repository-managed requirement files so pytest constraints are not split between workflow scripts and dependency manifests.

Constraint: CI install path is transitioning to uv-based sync and run commands
Rejected: Keep a standalone workflow-level pytest pin | creates split dependency authority and drift risk
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep pytest major-version constraints in dependency files, not ad hoc workflow commands
Tested: Reviewed staged diff for targeted files
Not-tested: Full GitHub Actions matrix run
@honglei

honglei commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

@chenliang15405 fixed the CI.

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.

[Feature][dbgpt-ext] Update spacy dependency to support Python 3.13

2 participants