Black action fails for black v23.12.0
Hello!
I am using action-black configured in a github action job like this:
name: job-name
on:
push:
branches: "main"
jobs:
job-name:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- name: Black formatter
uses: rickstaa/action-black@v1
with:
black_args: "."
However, I saw that it now fails with the next output:
[2/3] RUN python -m venv venv && . venv/bin/activate && pip install --upgrade pip && venv/bin/pip install --upgrade --no-cache-dir black:
20.82 creating build/temp.linux-x86_64-cpython-312
20.82 creating build/temp.linux-x86_64-cpython-312/multidict
20.82 gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/venv/include -I/usr/local/include/python3.12 -c multidict/_multidict.c -o build/temp.linux-x86_64-cpython-312/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing -pedantic
20.82 error: command 'gcc' failed: No such file or directory
20.82 [end of output]
20.82
20.82 note: This error originates from a subprocess, and is likely not a problem with pip.
20.82 ERROR: Failed building wheel for multidict
20.82 Failed to build frozenlist multidict
20.82 ERROR: Could not build wheels for frozenlist, multidict, which is required to install pyproject.toml-based projects
------
Dockerfile:6
--------------------
4 | PYTHONUNBUFFERED 1
5 |
6 | >>> RUN python -m venv venv && . venv/bin/activate && pip install --upgrade pip && venv/bin/pip install --upgrade --no-cache-dir black
7 |
8 | COPY entrypoint.sh /entrypoint.sh
--------------------
ERROR: failed to solve: process "/bin/sh -c python -m venv venv && . venv/bin/activate && pip install --upgrade pip && venv/bin/pip install --upgrade --no-cache-dir black" did not complete successfully: exit code: 1
Yesterday (11 Dec 2023), it was working fine. Please, do you have any ideas how can I fix this?
Same issue
Same issue
It looks like the issue is that black released a new version, https://github.com/psf/black/releases/tag/23.12.0, which has a specific wheel for the linux runners on GitHub. From a successful run of our action last week vs today:
Downloading black-23.11.0-py3-none-any.whl.metadata (66 kB)
Downloading black-23.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (68 kB)
This new wheel seems to include optional dependencies for black, specifically aiohttp, which in turn requires new dependencies frozenlist and multidict, both of which don't have wheels, and need gcc to compile. The python:3-slim docker image used by this project doesn't include gcc.
I'd guess that the fixes for this would be to:
- switch to a not-slim python docker, maybe
python:3-bullseye(need to confirm that exists) - figure out how to install black without the dependencies, or
- for the moment, freeze black at the previous version
23.11.0.
Given the notice in the README that:
Therefore, you are advised to use the official black action
and the fact that you can choose a specific black version in the official action, I'm not sure what the best approach for this project is. Likely avoiding downloading aiohttp in the first place.
We are affected as well even-though we pin the action to a hash (uses: rickstaa/action-black@44c11064a01277fdca360a0ba8c7c408ef350465).
Might be worth to freeze the underlying dependencies to avoid regressions like these.
Hello @dariusmargineansrx,
Thank you for creating the bug report, and a big shoutout to @BryceStevenWilley and @michael-rogger-swarm for their debugging efforts 🙏🏻. I'm fully focused on completing my thesis work, which is taking up a substantial amount of my time 😅. As a result, I can't provide a specific timeline for addressing the issue, but I'm open to reviewing a PR for a hotfix whenever it's available 👍🏻. I'm okay with making adjustments like changing the Docker base and pinning black to provide temporary relief while we investigate the issue 🤔.
Looking forward, my main goal is to phase out the Docker-based version of this action and introduce a composite version in v2 (track progress at https://github.com/rickstaa/action-black/issues/11). This will simplify maintenance, remove internal dependencies, and ensure that primary development remains in the official black repository, with this action serving as a straightforward wrapper (more details at https://github.com/rickstaa/action-black/issues/10).
I've assigned this task to myself to ensure it is clear from my mind. However, as mentioned earlier, the weeks leading up to the new year are pretty hectic for me 😅. I might have some time on Friday.
Never mind, I quickly applied the suggestion of @BryceStevenWilley https://github.com/rickstaa/action-black/pull/19.
The issue is expected to be resolved in version https://github.com/rickstaa/action-black/releases/tag/v1.3.2. I'll take a closer look at this version and remove the pin when I have the opportunity 👍🏻. Special thanks to @BryceStevenWilley for promptly investigating this matter, enabling a swift patch ❤️🔥.
The issue is expected to be resolved in version https://github.com/rickstaa/action-black/releases/tag/v1.3.2. I'll take a closer look at this version and remove the pin when I have the opportunity 👍🏻. Special thanks to @BryceStevenWilley for promptly investigating this matter, enabling a swift patch ❤️🔥.
@rickstaa Thanks for your promptness! I'll test it tomorrow and if all is good, I'll close the issue. Also, thanks @BryceStevenWilley for feedback
The issue is expected to be resolved in version https://github.com/rickstaa/action-black/releases/tag/v1.3.2. I'll take a closer look at this version and remove the pin when I have the opportunity 👍🏻. Special thanks to @BryceStevenWilley for promptly investigating this matter, enabling a swift patch ❤️🔥.
@rickstaa Thanks for your promptness! I'll test it tomorrow and if all is good, I'll close the issue. Also, thanks @BryceStevenWilley for feedback
@dariusmargineansrx let's keep it open till https://github.com/psf/black/issues/4107 is fixed. This would allow me to remove the hotfix again 👍🏻.
Ok! Sounds good!
@rickstaa Thanks for the quick fix! We can confirm that the issue is resolved.
@michael-rogger-swarm, thanks for the feedback 💙. I will close this issue and release the pin when https://github.com/vercel/vercel/discussions/6434 is fixed.