Repository navigation
fix(deps): sync requirements.txt with pyproject.toml - #10705
Merged
mantoujun12 merged 4 commits intoDec 1, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_dependency_sync.py" line_range="41" />
<code_context>
+ """
+ dependencies = {}
+ for entry in entries:
+ requirement = Requirement(entry)
+ dependencies[canonicalize_name(requirement.name)] = (
+ frozenset(requirement.extras),
</code_context>
<issue_to_address>
**Valid pip directives fail the check**
When requirements.txt contains a supported pip option or nested-requirements directive, `Requirement(entry)` parses every non-comment line as a package requirement, so a valid pip directive such as `--extra-index-url` or `-r base.txt` raises a parsing error and fails the sync test instead of checking the declared packages.
Reuse the repository's requirements-file parsing behavior to expand or skip supported directives before normalizing package requirements.
</issue_to_address>
### Comment 2
<location path="tests/test_dependency_sync.py" line_range="44" />
<code_context>
+ requirement = Requirement(entry)
+ dependencies[canonicalize_name(requirement.name)] = (
+ frozenset(requirement.extras),
+ str(requirement.specifier),
+ str(requirement.marker or ""),
+ )
</code_context>
<issue_to_address>
**Equivalent constraints fail the check**
When the equivalent version constraints are written in different orders in the two manifests, `str(requirement.specifier)` preserves the order of constraints, so equivalent declarations such as `>=1,<2` and `<2,>=1` compare as different and fail the test even though they allow the same versions.
Canonicalize the individual specifiers before comparing them.
</issue_to_address>
### Comment 3
<location path="tests/test_dependency_sync.py" line_range="45" />
<code_context>
+ dependencies[canonicalize_name(requirement.name)] = (
+ frozenset(requirement.extras),
+ str(requirement.specifier),
+ str(requirement.marker or ""),
+ )
+ return dependencies
</code_context>
<issue_to_address>
**Equivalent markers fail comparison**
When equivalent marker clauses are written in a different order in the manifests, `_normalize` compares the strings produced by `str(requirement.marker or "")`, so reordered equivalent clauses fail the sync test even though both manifests install the dependency under the same conditions.
Compare markers in a canonical form that treats equivalent clause orderings as equal.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: tests/test_dependency_sync.py:44, tests/test_dependency_sync.py:45
Contributor
Author
|
问题1,3已确认, 第二个为误报: specifier是packaging.requirements.SpecifierSet, 本身已经消序 |
Contributor
Author
|
或者我就改一个同步的地方? |
inertialobs
dismissed
sourcery-ai[bot]’s stale review
December 1, 2026 13:36
The base branch was changed.
requirements.txt still declared faiss-cpu>=1.12.0 while pyproject.toml has required >=1.14.3 since AstrBotDevs#8837. Restore the matching baseline so installs from requirements.txt resolve the intended version.
Parse both dependency files and compare package names, extras, version specifiers, and environment markers. This catches changes that update only one file, which is how the faiss-cpu drift slipped in.
Reuse the existing requirements-file parser so pip directives and nested -r includes are expanded or skipped instead of failing requirement parsing. Canonicalize markers into a structured frozenset-based key so reordered and/or clauses compare equal without relying on string order, while preserving parentheses and operator precedence.
inertialobs
force-pushed
the
fix/deps-sync-requirements-txt
branch
from
December 1, 2026 18:07
2458c4e to
f974ba1
Compare
mantoujun12
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pyproject.tomlandrequirements.txthad drifted. Commit #8837 raisedfaiss-cputo>=1.14.3inpyproject.tomlbut leftrequirements.txtat
>=1.12.0.This matters because
requirements.txtis consumed by the Docker build,the smoke test workflow, and the in-app updater. The two install paths
could therefore resolve different FAISS versions.
Modifications / 改动点
Align
faiss-cpuinrequirements.txtwithpyproject.toml(
>=1.12.0->>=1.14.3).This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Have no behavior change to the main program
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
📚 I checked the affected WebUI instructions and screenshots in
docs/zhanddocs/enagainst the changed navigation, page structure, and labels, and updated them in this PR (or explained why no documentation update is needed). For renamed, moved, or merged entry points, I included an old entry → new entry mapping in the documentation and changelog./ 我已对照变化后的 WebUI 入口、页面结构和术语,核对并在本 PR 中更新
docs/zh和docs/en的相关操作说明与截图(或说明无需更新文档的原因)。入口改名、移动或合并时,已在文档和 changelog 中补充 旧入口 → 新入口 对照。没有对应文档需要更新
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Synchronize runtime dependency declarations and enforce consistency between requirements.txt and pyproject.toml.
Bug Fixes:
Enhancements:
Tests: