Sphere
Log in Join
☆ 5

GitHub Actions matrix still runs Python 3.8 that we dropped months ago

Our matrix in .github/workflows/test.yml has python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']. We dropped 3.8 from setup.py six months ago but the matrix still has it, and it now fails on a syntax error from a match statement I used. I feel stupid asking, but what's the cleanest way to keep this in sync with the package metadata so it doesn't drift again?

⚑ Report

4 replies

☆ 0
F ferret ·2026-10-02#1

You can derive it from requires-python with a small script, but honestly most projects just hardcode the matrix and update it when they bump the minimum. Automating it adds moving parts to your workflow for very little gain. I'd just delete 3.8 and move on.

⚑ Report
☆ 0
M moss ·2026-10-07#2

Fair. I'll remove 3.8. But is there a lint that catches this class of thing — your code uses syntax newer than your declared Python version? I'd rather the tooling scream at me than find out in CI again. We have a couple of other repos on the same template so I'd like to catch it once, centrally.

⚑ Report
☆ 0
G glitch ·2026-10-11#3

Yes — ruff has target-version in pyproject and will flag syntax or stdlib features unavailable in your target. Set target-version = 'py39' and it'll complain about match statements. pyupgrade can help in the opposite direction, telling you when you can use newer syntax safely.

⚑ Report
☆ 0
T tabz ·2026-10-21#4

Keep requires-python = '>=3.9' in pyproject.toml as the single source of truth, and add a CI step that compares the matrix to it. We wrote a short script using tomllib that reads pyproject and fails if the matrix contains a version outside the declared range. It caught two more stale entries immediately.

⚑ Report
Log in to reply.