Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make handling of FORCE_COLOR environment variable match the emerging standard #13853

Closed
wants to merge 1 commit into from

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Oct 9, 2022

See the conversation in https://github.com/python/mypy/pull/13814/files#r990652344: the emerging standard for this is to treat the presence of the FORCE_COLOR environment variable as indicating that color is desired, even if the variable is set to "0" or "False". This PR makes mypy's behaviour here match the behaviour of pytest, nox, rich and pypa/build in how they all handle this environment variable.

(It doesn't match the behaviour of tox, but tox seems to be on its own here.)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Unless there's actually some thought out standard and not just tired maintainers merging quick PRs, let's treat FORCE_COLOR=0 as not forcing colour. Setting env vars to 0 or 1 is about as standard as it gets and it's weird that it's inconsistent with MYPY_FORCE_COLOR. Also looks like it's not just tox, it's node too.

@AlexWaygood
Copy link
Member Author

it's weird that it's inconsistent with MYPY_FORCE_COLOR

Yeah, that's fair. I don't really have a strong opinion one way or another :)

@hugovk might have some thoughts!

@hugovk
Copy link
Member

hugovk commented Oct 12, 2022

If starting from scratch I think it would make sense to have 0 disable it, but it's been quite widely implemented so 0 also enables it. 🤷

There's some value to following other implementations, but I agree it's pretty weird to set FORCE_COLOR=0 and expect colour enabled! And if I saw it, I would definitely recommend against using FORCE_COLOR=0 to enable.

Personally, as long as I can set FORCE_COLOR=1 on GitHub Actions and get coloured mypy output I'll be happy :)

@AlexWaygood AlexWaygood deleted the force-color branch October 19, 2022 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants