Skip to content

#4376 breaks compatibility with old colorlog #4403

@contramundum53

Description

@contramundum53

Expected behavior

import optuna should not fail.

Environment

  • Optuna version:
  • Python version:
  • OS:
  • (Optional) Other libraries and their versions: colorlog v4.8

Error messages, stack traces, or logs

File ~/optuna/optuna/logging.py:36, in create_default_formatter()
     31 def create_default_formatter() -> colorlog.ColoredFormatter:
     32     """Create a default formatter of log messages.
     33 
     34     This function is not supposed to be directly accessed by library users.
     35     """
---> 36     return colorlog.ColoredFormatter(
     37         "%(log_color)s[%(levelname)1.1s %(asctime)s]%(reset)s %(message)s",
     38         no_color=False if _color_supported() else True,
     39     )

TypeError: ColoredFormatter.__init__() got an unexpected keyword argument 'no_color'

Steps to reproduce

$ pip install colorlog==4.8.0
import optuna

Additional context (optional)

Updating to the latest colorlog fixes this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions