Disable colored log when NO_COLOR env or not tty.#4376
Merged
keisuke-umezawa merged 4 commits intooptuna:masterfrom Feb 2, 2023
Merged
Disable colored log when NO_COLOR env or not tty.#4376keisuke-umezawa merged 4 commits intooptuna:masterfrom
NO_COLOR env or not tty.#4376keisuke-umezawa merged 4 commits intooptuna:masterfrom
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #4376 +/- ##
==========================================
- Coverage 90.43% 90.40% -0.04%
==========================================
Files 172 172
Lines 13660 13668 +8
==========================================
+ Hits 12354 12357 +3
- Misses 1306 1311 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Member
|
@Alnusjaponica @keisuke-umezawa Could you review this PR? |
Alnusjaponica
approved these changes
Feb 2, 2023
Contributor
|
LGTM |
Member
Author
|
Do I need to add the test? |
keisuke-umezawa
approved these changes
Feb 2, 2023
Member
keisuke-umezawa
left a comment
There was a problem hiding this comment.
LGTM! I confirmed it worked in my local env.
Member
|
This breaks compatibility with old |
gen740
added a commit
to gen740/optuna
that referenced
this pull request
Feb 8, 2023
gen740
added a commit
to gen740/optuna
that referenced
this pull request
Feb 8, 2023
gen740
added a commit
to gen740/optuna
that referenced
this pull request
Feb 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When piping optuna's log output to the file, escape sequences are also captured.
Given the following code.
log.txt would be like
Many python tools including
pipwould disable coloring when stdout is not a tty, so it is more natural to do this in optuna.And also natural to disable coloring when
NO_COLORenvironment variable is set, (ref. https://no-color.org).Description of the changes
_color_supportedto check the environment variable and tty state.