Skip to content

Move type-only stdlib imports in optuna.testing.storages behind TYPE_CHECKING#6537

Merged
c-bata merged 1 commit intooptuna:masterfrom
t7r0n:fix/type-checking-testing-storages-6029
Mar 23, 2026
Merged

Move type-only stdlib imports in optuna.testing.storages behind TYPE_CHECKING#6537
c-bata merged 1 commit intooptuna:masterfrom
t7r0n:fix/type-checking-testing-storages-6029

Conversation

@t7r0n
Copy link
Copy Markdown
Contributor

@t7r0n t7r0n commented Mar 20, 2026

Summary

  • move type-only stdlib imports (ThreadPoolExecutor, TracebackType) into TYPE_CHECKING in optuna/testing/storages.py
  • keep runtime behavior unchanged

Testing

  • uv run ruff check optuna/testing/storages.py --select TCH
  • uv run ruff check optuna/testing/storages.py
  • uv run ruff format --check optuna/testing/storages.py
  • uv run mypy optuna/testing/storages.py
  • uv run pytest tests/storages_tests/test_storages.py -q

Closes #6029

@c-bata c-bata added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 23, 2026
@c-bata c-bata added this to the v4.9.0 milestone Mar 23, 2026
@c-bata c-bata merged commit 2a01d35 into optuna:master Mar 23, 2026
14 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.

Use TYPE_CHECKING if necessary

2 participants