Fix CI: pin black to the version it actually runs - #100
Open
audiodude wants to merge 2 commits into
Open
Conversation
The tox py3-black environment declares `deps = black`, unpinned, so every run installs whatever black is newest on PyPI that day. When black 26.5.1 was released it dropped a blank line after module-level imports, and CI went red on main without a single line of this repository changing. Every PR opened since then has inherited a failure it did not cause. Pin the environment to black==26.5.1 and apply its formatting to the three files that had drifted: models/base.py, utils/__init__.py and worker.py. The change is three deleted blank lines. Black is dropped from test-requirements.txt rather than pinned there too. The pin in that file (black==20.8b0, from 2020) is already dead weight: it cannot parse the `target_version = ['py311']` in pyproject.toml, so it fails immediately if anyone runs it. It cannot be bumped in place either, because a current black needs click >= 8 while requirements.txt pins click==7.1.2 for celery, and pip refuses to resolve the two together. The py3-black tox environment installs into its own virtualenv, so pinning it there sidesteps the conflict entirely. Also add node_modules to the flake8 exclude list. It has no effect on CI, where the checkout is clean, but `npm run build` leaves a node_modules directory containing a vendored flatted.py that flake8 then reports on - so running tox locally after building the frontend fails in a way CI never reproduces. This patch was written with AI assistance (Claude Code). It has been reviewed and tested by hand: all four tox environments (flake8, pytest, black, mypy) pass in the tests/tox container. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Bug: T434789
audiodude
force-pushed
the
fix-ci-black
branch
from
August 13, 2026 13:43
48b8e7d to
acb5bd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
tox.inideclares the black environment as:Because this is unpinned, every CI run installs whatever black is newest on PyPI that day — currently 26.5.1. This results in CI going red in precisely the way the initial tox.ini comment warned against, just by a different mechanism.
This PR pins black for tox and does a slight reformat (blank lines) for the latest version.
It also drops black from `test-requirements.txt because it was currently a no-op.
Also add
node_modulesto the flake8 exclude to avoid errors runningtoxlocally after building the frontend\AI disclosure
This patch was written with AI assistance (Claude Code), per Using AI in MediaWiki patches.
🤖 Generated with Claude Code
Manually reviewed by @audiodude.