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

[BUG] v13.3.4 broke coloring #2924

Open
ofek opened this issue Apr 13, 2023 · 10 comments
Open

[BUG] v13.3.4 broke coloring #2924

ofek opened this issue Apr 13, 2023 · 10 comments

Comments

@ofek
Copy link
Contributor

ofek commented Apr 13, 2023

Describe the bug

Previously setting NO_COLOR to 1 would override forced coloring but now it does not. The use case is in CI we force color to get nice test output but inside testing at the beginning of setup we set that environment variable so we can properly assert output.

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

ofek added a commit to DataDog/integrations-core that referenced this issue Apr 13, 2023
@willmcgugan
Copy link
Collaborator

As far as I can tell NO_COLOR does takes precedence over FORCE_COLOR.

Can you give me an example where that doesn't work?

@webknjaz
Copy link

@willmcgugan I just hit the exact same problem. Specifically, this is happening with pip, which vendors v13.4.2, currently: https://github.com/pypa/pip/blob/2a0acb5/src/pip/_vendor/vendor.txt#L15-L17.

We have FORCE_COLOR: 1 set for the entire GitHub Actions CI/CD workflow. But in one specific step of one job, we call pip ... --no-color | jq and it breaks because pip produces colored output through Rich and I don't think it uses Rich API to disable colorization: https://github.com/pypa/pip/blob/2a0acb595c4b6394f1f3a4e7ef034ac2e3e8c17e/src/pip/_internal/commands/install.py#L384.

There's one other place where it initializes Console() passing no_color explicitly: https://github.com/pypa/pip/blob/2a0acb595c4b6394f1f3a4e7ef034ac2e3e8c17e/src/pip/_internal/utils/logging.py#L268.

This is how it crashes for me: https://github.com/aio-libs/yarl/actions/runs/6934150793/job/18862144526#step:6:24.

@ofek is it pip that breaks in your case?

cc @pradyunsg does this sound like a pip bug?

@webknjaz
Copy link

Here's the hack that worked for me: aio-libs/yarl@f202823 (using a separate unset FORCE_COLOR Bash command).

I also ended up filing an issue in pip: pypa/pip#12405.

@webknjaz webknjaz mentioned this issue Nov 20, 2023
9 tasks
@ofek
Copy link
Contributor Author

ofek commented Nov 20, 2023

No it was for our main developer tool. I just had to stop forcing color DataDog/integrations-core@c5ef1ef

@webknjaz
Copy link

@ofek sounds like you also had to use a hack?

@willmcgugan
Copy link
Collaborator

It's been fixed for a while in Rich. Pip will be using an older vendored version.

@webknjaz
Copy link

@willmcgugan do you have the exact commit? I could attempt testing it with a local pip checkout...

@webknjaz
Copy link

I posted in #2449 (comment) a summary of the dissonance between two toggle that is likely happening here…

@webknjaz
Copy link

@willmcgugan do you have any workarounds in mind that could allow doing UNFORCE_COLOR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants