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

Black action fails for black v23.12.0 #18

Open
dariusmargineansrx opened this issue Dec 12, 2023 · 13 comments
Open

Black action fails for black v23.12.0 #18

dariusmargineansrx opened this issue Dec 12, 2023 · 13 comments
Assignees

Comments

@dariusmargineansrx
Copy link

dariusmargineansrx commented Dec 12, 2023

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?

@odobosevych
Copy link

Same issue

1 similar comment
@vladislavkoz
Copy link

Same issue

@BryceStevenWilley
Copy link

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.

@michael-rogger-swarm
Copy link

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.

@rickstaa rickstaa pinned this issue Dec 12, 2023
@rickstaa
Copy link
Owner

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 #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 #10).

@rickstaa rickstaa self-assigned this Dec 12, 2023
@rickstaa
Copy link
Owner

rickstaa commented Dec 12, 2023

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.

rickstaa added a commit that referenced this issue Dec 12, 2023
This commit temporary pins black to 23.11.0 since version https://github.com/psf/black/releases/tag/23.12.0
breaks this action (see #18).
@rickstaa
Copy link
Owner

Never mind, I quickly applied the suggestion of @BryceStevenWilley #19.

rickstaa added a commit to rickstaa/action-test-repo that referenced this issue Dec 12, 2023
rickstaa added a commit that referenced this issue Dec 12, 2023
This commit temporary pins black to 23.11.0 since version https://github.com/psf/black/releases/tag/23.12.0
breaks this action (see #18).
@rickstaa rickstaa changed the title Black action fails Black action fails for black v23.12.0 Dec 12, 2023
@rickstaa
Copy link
Owner

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 ❤️‍🔥.

@dariusmargineansrx
Copy link
Author

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

@rickstaa
Copy link
Owner

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 psf/black#4107 is fixed. This would allow me to remove the hotfix again 👍🏻.

@dariusmargineansrx
Copy link
Author

Ok! Sounds good!

@michael-rogger-swarm
Copy link

@rickstaa Thanks for the quick fix! We can confirm that the issue is resolved.

@rickstaa
Copy link
Owner

@michael-rogger-swarm, thanks for the feedback 💙. I will close this issue and release the pin when vercel/vercel#6434 is fixed.

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

No branches or pull requests

6 participants