Page MenuHomePhabricator

refill back end (python) continuous integration is broken
Open, Needs TriagePublicBUG REPORT

Assigned To
None
Authored By
Novem_Linguae
Jun 10 2024, 7:41 AM
Referenced Files
F55160147: image.png
Jun 10 2024, 7:41 AM
F55160139: image.png
Jun 10 2024, 7:41 AM

Description

Steps to replicate the issue (include links if applicable):

What happens?:

image.png (124×162 px, 3 KB)

image.png (1×1 px, 136 KB)

black: find interpreter for spec PythonSpec(path=/opt/hostedtoolcache/Python/3.8.18/x64/bin/python)
black: proposed PythonInfo(spec=CPython3.8.18.final.0-64, exe=/opt/hostedtoolcache/Python/3.8.18/x64/bin/python, platform=linux, version='3.8.18 (default, Aug 28 2023, 08:27:22) \n[GCC 11.4.0]', encoding_fs_io=utf-8-utf-8)
black: create virtual environment via CPython3Posix(dest=/home/runner/work/refill/refill/.tox/black, clear=False, no_vcs_ignore=False, global=False)
black: add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/runner/.local/share/virtualenv)
black: add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
black: install_deps> python -I -m pip install black
black: exit 0 (1.90 seconds) /home/runner/work/refill/refill> python -I -m pip install black pid=18black: freeze> python -m pip freeze --all
black: exit 0 (0.30 seconds) /home/runner/work/refill/refill> python -m pip freeze --all pid=18black: black==24.4.2,click==8.1.7,mypy-extensions==1.0.0,packaging==24.0,pathspec==0.12.1,pip==24.0,platformdirs==4.2.2,setuptools==69.5.1,tomli==2.0.1,typing_extensions==4.12.0,wheel==0.43.0
black: commands[0]> black --check --diff backend
--- /home/runner/work/refill/refill/backend/refill/dataparsers/parsespecial.py	2024-05-30 12:33:39.083116+00:+++ /home/runner/work/refill/refill/backend/refill/dataparsers/parsespecial.py	2024-05-30 12:34:07.334062+00:@@ -31,13 +31,13 @@
                 },
would reformat /home/runner/work/refill/refill/backend/refill/dataparsers/parsespecial.py
                 "type": {
                     "element": lambda e: e.name == "aside"
                     and "block" in e.get("class", [])
                     and e.findChildren("img"),
-                    "value": lambda e: "radioBroadcast"
-                    if "radio" in e.text
-                    else "tvBroadcast",
+                    "value": lambda e: (
+                        "radioBroadcast" if "radio" in e.text else "tvBroadcast"
+                    ),
                 },
             },
         },
     ]
 
--- /home/runner/work/refill/refill/backend/refill/utils/__init__.py	2024-05-30 12:33:39.083116+00:+++ /home/runner/work/refill/refill/backend/refill/utils/__init__.py	2024-05-30 12:34:07.422189+00:@@ -1,13 +1,13 @@
 import functools
 
 import requests as _requests
would reformat /home/runner/work/refill/refill/backend/refill/utils/__init__.py
 
 session = _requests.Session()
-session.headers[
-    "User-Agent"
-] = "reFill/2 (https://en.wikipedia.org/wiki/User:Zhaofeng_Li/reFill)"
+session.headers["User-Agent"] = (
+    "reFill/2 (https://en.wikipedia.org/wiki/User:Zhaofeng_Li/reFill)"
+)
 
 # Ugly hack to set default timeouts
 # https://stackoverflow.com/a/558418 for method in ("get", "options", "head", "post", "put", "patch", "delete"):
     setattr(

Oh no! 💥 💔 💥
2 files would be reformatted, 46 files would be left unchanged.
black: exit 1 (0.46 seconds) /home/runner/work/refill/refill> black --check --diff backend pid=18black: FAIL ✖ in 2.79 seconds

What should have happened instead?:

  • tests pass

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

I've disabled the 4 failing Python CI jobs because I don't like red X's that aren't caused by the patch itself. These should be fixed and re-enabled in the future when someone tackles the back end. The job code is still on the server, since I simply renamed .github/workflows/python.yml to .github/workflows/python.disabled.

https://github.com/CurbSafeCharmer/refill/commit/c314d64833fec8d499aa9c5bb0d1e45cb37212fd

Novem_Linguae renamed this task from refill continuous integration is broken to refill back end (python) continuous integration is broken.Thu, Apr 9, 12:51 AM

When examining these failing Python CI jobs, I was expecting some major breakages. However it appears the problem is that the code linter named "black" is warning about code style in 2 places. Could fixing this CI be as easy as linting our code?

black: commands[0]> black --check --diff backend
would reformat /home/runner/work/refill/refill/backend/refill/dataparsers/parsespecial.py
--- /home/runner/work/refill/refill/backend/refill/dataparsers/parsespecial.py	2026-04-12 06:32:39.404875+00:00
+++ /home/runner/work/refill/refill/backend/refill/dataparsers/parsespecial.py	2026-04-12 06:33:06.299880+00:00
@@ -31,13 +31,13 @@
                 },
                 "type": {
                     "element": lambda e: e.name == "aside"
                     and "block" in e.get("class", [])
                     and e.findChildren("img"),
-                    "value": lambda e: "radioBroadcast"
-                    if "radio" in e.text
-                    else "tvBroadcast",
+                    "value": lambda e: (
+                        "radioBroadcast" if "radio" in e.text else "tvBroadcast"
+                    ),
                 },
             },
         },
     ]
 
--- /home/runner/work/refill/refill/backend/refill/utils/__init__.py	2026-04-12 06:32:39.406410+00:00
+++ /home/runner/work/refill/refill/backend/refill/utils/__init__.py	2026-04-12 06:33:06.412169+00:00
would reformat /home/runner/work/refill/refill/backend/refill/utils/__init__.py
@@ -1,13 +1,13 @@
 import functools
 
 import requests as _requests
 
 session = _requests.Session()
-session.headers[
-    "User-Agent"
-] = "reFill/2 (https://en.wikipedia.org/wiki/User:Zhaofeng_Li/reFill)"
+session.headers["User-Agent"] = (
+    "reFill/2 (https://en.wikipedia.org/wiki/User:Zhaofeng_Li/reFill)"
+)
 
 # Ugly hack to set default timeouts
 # https://stackoverflow.com/a/55841818
 for method in ("get", "options", "head", "post", "put", "patch", "delete"):
     setattr(

It was as easy as linting those 2 files. That fixed the linter part of the job. The flask app part of the job is still broken.

I've gone ahead and split this into 2 jobs. python-linter.yml is now enabled and passing. python-flask-app.yml has been renamed to python-flask-app.disable and we can come back and fix it later.