Skip to content

[Typing] Clean up invalid python.paddle imports#79313

Merged
SigureMo merged 1 commit into
PaddlePaddle:developfrom
ShigureNyako:codestyle/clean-python-paddle-imports
Jun 14, 2026
Merged

[Typing] Clean up invalid python.paddle imports#79313
SigureMo merged 1 commit into
PaddlePaddle:developfrom
ShigureNyako:codestyle/clean-python-paddle-imports

Conversation

@ShigureNyako

Copy link
Copy Markdown
Contributor

PR Category

Environment Adaptation

PR Types

Improvements

Description

This PR cleans up the remaining invalid python.paddle import found on latest develop.

  • Replace the type-checking-only import in python/paddle/amp/grad_scaler.py with the public paddle.optimizer.optimizer path.
  • Verified no remaining from python.paddle, import python.paddle, or python.paddle. references in the repo.
  • Checked that [CodeStyle] Clean up Python 3.10 type-hint diagnostics #79291 is already merged and this PR only touches a different file.

Validation:

  • PYTHONPYCACHEPREFIX=/tmp/paddle-clean-python-paddle-imports-pycache python3 -m py_compile python/paddle/amp/grad_scaler.py
  • ruff check python/paddle/amp/grad_scaler.py
  • pre-commit run --files python/paddle/amp/grad_scaler.py
  • git diff --check
  • PYTHONPATH=python python3 test/amp/test_grad_scaler_out.py not run successfully: this source checkout does not have a built libpaddle extension, so importing local paddle fails before the test body runs.

是否引起精度变化

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

已自查:本 PR 只将 TYPE_CHECKING 下残留的 python.paddle 导入替换为公开 paddle 导入路径;本地 py_compile / ruff / pre-commit / git diff --check 均已通过。

@SigureMo 麻烦有空帮忙 review,感谢!

@SigureMo SigureMo changed the title [CodeStyle] Clean up invalid python.paddle imports [Typing] Clean up invalid python.paddle imports Jun 14, 2026
@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@SigureMo SigureMo merged commit de83694 into PaddlePaddle:develop Jun 14, 2026
240 of 259 checks passed
@SigureMo SigureMo deleted the codestyle/clean-python-paddle-imports branch June 14, 2026 07:23
@SigureMo SigureMo changed the title [Typing] Clean up invalid python.paddle imports [Typing] Clean up invalid python.paddle imports Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants