Skip to content

Move typing-only imports under TYPE_CHECKING in /study/_optimize.py#6280

Merged
nabenabe0928 merged 1 commit intooptuna:masterfrom
euangoodbrand:type-check-optimize
Sep 17, 2025
Merged

Move typing-only imports under TYPE_CHECKING in /study/_optimize.py#6280
nabenabe0928 merged 1 commit intooptuna:masterfrom
euangoodbrand:type-check-optimize

Conversation

@euangoodbrand
Copy link
Copy Markdown
Contributor

Motivation

This PR continues the type-checking improvements tracked in #6029 for optuna/study/_optimize.py.

Changes

Moved type-only imports (Callable, Iterable, Sequence, Future, FrozenTrial, Any) under TYPE_CHECKING.

Notes

Verified locally with flake8, mypy (module-level), and relevant pytest runs -- no issues observed.

Copy link
Copy Markdown
Contributor

@nabenabe0928 nabenabe0928 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, LGTM:)

@nabenabe0928 nabenabe0928 merged commit e4961d8 into optuna:master Sep 17, 2025
15 checks passed
@nabenabe0928 nabenabe0928 added the code-fix Change that does not change the behavior, such as code refactoring. label Sep 22, 2025
@nabenabe0928 nabenabe0928 changed the title Move typing-only imports under TYPE_CHECKING in /study/_optimize.py (part of #6029) Move typing-only imports under TYPE_CHECKING in /study/_optimize.py Sep 22, 2025
@nabenabe0928 nabenabe0928 added this to the v4.6.0 milestone Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-fix Change that does not change the behavior, such as code refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants