Skip to content

Use TYPE_CHECKING for imports in importance/_ped_anova/scott_parzen_estimator.py - #6554

Merged
not522 merged 3 commits into
optuna:masterfrom
Aliipou:fix/type-checking-scott-parzen
Mar 23, 2026
Merged

not522 merged 3 commits into
optuna:masterfrom
Aliipou:fix/type-checking-scott-parzen

Conversation

@Aliipou

@Aliipou Aliipou commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Part of #6029.

Moves BaseDistribution and FrozenTrial under TYPE_CHECKING guard in optuna/importance/_ped_anova/scott_parzen_estimator.py since they are only referenced in type annotations. With from __future__ import annotations, these imports are not needed at runtime.

Reduces import time and avoids optional-dependency errors for users who do not have these optional dependencies installed.

Aliipou and others added 2 commits March 22, 2026 21:05
…ott_parzen_estimator.py

Part of #6029.

Moves BaseDistribution and FrozenTrial under TYPE_CHECKING guard in
optuna/importance/_ped_anova/scott_parzen_estimator.py since they are
only referenced in type annotations. With from __future__ import
annotations, these imports are not needed at runtime.

Reduces import time and avoids optional-dependency errors.
@not522 not522 changed the title fix(types): use TYPE_CHECKING for imports in importance/_ped_anova/scott_parzen_estimator.py Use TYPE_CHECKING for imports in importance/_ped_anova/scott_parzen_estimator.py Mar 23, 2026
@not522 not522 added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 23, 2026
@not522 not522 added this to the v4.9.0 milestone Mar 23, 2026

@not522 not522 left a comment

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.

LGTM

@not522
not522 merged commit c65a813 into optuna:master Mar 23, 2026
12 checks passed
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