Skip to content

Commit

Permalink
🐛🧪 Unset FORCE_COLOR on Bash level @ CI
Browse files Browse the repository at this point in the history
This is a hack to work around the inability of `Rich` -- and by
extension `pip` -- to allow overriding a `FORCE_COLOR` environment
variable, made available globally.

The following **doesn't** actually work:

    $ NO_COLOR=1 FORCE_COLOR= python -m pip install yarl --no-color --dry-run --no-deps --report - --quiet | jq --raw-output .install[].download_info.url

Ref: Textualize/rich#2622
  • Loading branch information
webknjaz committed Nov 20, 2023
1 parent ef5664b commit f202823
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,21 @@ jobs:
# NOTE: preference here via https://no-color.org.
# NOTE: Setting `FORCE_COLOR` to any value (including 0, an empty
# NOTE: string, or a "YAML null" `~`) doesn't have any effect and
# NOTE: `pip` (through its verndored copy of `rich`) treats the presence
# NOTE: of the variable as "force-color" regardless.
# NOTE: `pip` (through its verndored copy of `rich`) treats the
# NOTE: presence of the variable as "force-color" regardless.
#
# NOTE: This doesn't actually work either, so we'll resort to unsetting
# NOTE: in the Bash script.
# NOTE: Ref: https://github.com/Textualize/rich/issues/2622
NO_COLOR: 1
id: wheel-file
run: >
echo -n path= | tee -a "${GITHUB_OUTPUT}"
unset FORCE_COLOR
python
-X utf8
-u -I
Expand Down

1 comment on commit f202823

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

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

Issue filed: pypa/pip#12405.

Please sign in to comment.