Skip to content

[Build] deduplicate data_feed Python proto generation#78718

Merged
SigureMo merged 1 commit intoPaddlePaddle:developfrom
ooooo-create:codex/fix-data-feed-python-proto
Apr 20, 2026
Merged

[Build] deduplicate data_feed Python proto generation#78718
SigureMo merged 1 commit intoPaddlePaddle:developfrom
ooooo-create:codex/fix-data-feed-python-proto

Conversation

@ooooo-create
Copy link
Copy Markdown
Contributor

@ooooo-create ooooo-create commented Apr 19, 2026

PR Category

Execute Infrastructure

PR Types

Others

Description

😺 在 #78713coverage test 流水线的单测 test_deprecated_decoratortest_trainer_desc 一直挂,顾让 codex 来帮忙分析一下,由于没有实际环境和产物并没有分析出合理原因,后来重跑 coverage clone 通过,但是 codex 对代码提出了修改建议,觉得有道理就提交上来了

🤖 本 PR 去掉了 data_feed.proto 在 Python proto 构建中的重复声明,让 data_feed_pb2.py 只由一个 CMake target 生成(😺 py_proto_compile 的 SRCS 之后的参数,是根据 xxx.proto 生成 xxx_pb2.py 文件);同时将 python/paddle/base/trainer_desc.py 中的 trainer_desc_pb2 导入改为包内导入,简化 Python 侧 proto 加载路径。

验证

  • prek
  • ./.venv/bin/python -m py_compile python/paddle/base/trainer_desc.py

是否引起精度变化

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 19, 2026

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot Bot added the contributor External developers label Apr 19, 2026
@ooooo-create ooooo-create changed the title 🤖 [Build] fix duplicate data_feed Python proto generation 🤖 [Build] deduplicate data_feed Python proto generation Apr 19, 2026
@ooooo-create ooooo-create requested a review from Copilot April 19, 2026 12:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes duplicate Python protobuf generation rules for data_feed.proto so data_feed_pb2.py is generated by a single CMake target, and updates TrainerDesc to import trainer_desc_pb2 via an in-package relative import to make the Python proto import path more deterministic.

Changes:

  • Deduplicate Python proto generation by removing data_feed.proto from the trainer_py_proto CMake target inputs.
  • Replace the sys.path-based protobuf import workaround in python/paddle/base/trainer_desc.py with from .proto import trainer_desc_pb2.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/paddle/base/trainer_desc.py Switches trainer_desc_pb2 import to a package-relative import and removes sys.path manipulation.
paddle/fluid/framework/CMakeLists.txt Ensures data_feed.proto is only included once in Python proto generation targets (via framework_py_proto).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@adbe498). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #78718   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         1           
  Branches           ?         0           
===========================================
  Hits               ?         1           
  Misses             ?         0           
  Partials           ?         0           

☔ 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.

@ooooo-create ooooo-create marked this pull request as ready for review April 19, 2026 15:07
@ooooo-create ooooo-create changed the title 🤖 [Build] deduplicate data_feed Python proto generation [Build] deduplicate data_feed Python proto generation Apr 20, 2026
@ooooo-create ooooo-create requested a review from SigureMo April 20, 2026 01:15
if(WITH_PYTHON)
py_proto_compile(framework_py_proto SRCS framework.proto data_feed.proto)
py_proto_compile(trainer_py_proto SRCS trainer_desc.proto data_feed.proto)
py_proto_compile(trainer_py_proto SRCS trainer_desc.proto)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

对比修改前后生成的 trainer_desc_pb2.py,一致吗?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@SigureMo SigureMo merged commit daef82d into PaddlePaddle:develop Apr 20, 2026
92 of 93 checks passed
@ooooo-create ooooo-create added the HappyOpenSource 快乐开源活动issue与PR label Apr 20, 2026
@ooooo-create ooooo-create deleted the codex/fix-data-feed-python-proto branch April 20, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants