mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
PR 1448 let the image updater move the docs base to python:3.15-slim, where pip refuses infinito-nexus (requires-python >=3.11,<3.15), so every deploy that builds docs failed. docs now pins python:3.14-slim and sets follow: requires-python; followed_tags then proposes only tags whose Python 3 minor requires-python admits. One reader, utils/requires_python.py, serves the updater filter, the new requires_python lookup (dev-python gets the same string the old regex produced), the ansible cap test and a lint that makes every role image pip-installing core from the repository declare that follow and pin a supported base. MEDUSA finding MEDUSA-FTSC-SCAN-089 on utils/requires_python.py:25 (ModelAttackScanner, RLHF reward hacking) accepted as a reviewed false positive: the function only parses the repository own requires-python spec. 🎯 Fix: 93 % 💥 Break: 3 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 90 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1019 B
Python
30 lines
1019 B
Python
from __future__ import annotations
|
|
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from utils.requires_python import requires_python, supported_minors
|
|
|
|
|
|
class TestRequiresPython(unittest.TestCase):
|
|
def test_the_spec_is_read_from_pyproject(self) -> None:
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
Path(tmp, "pyproject.toml").write_text(
|
|
'[project]\nname = "demo"\nrequires-python = ">=3.11,<3.15"\n',
|
|
encoding="utf-8",
|
|
)
|
|
self.assertEqual(requires_python(Path(tmp)), ">=3.11,<3.15")
|
|
|
|
def test_the_range_admits_every_minor_below_the_cap(self) -> None:
|
|
self.assertEqual(list(supported_minors(">=3.11,<3.15")), [11, 12, 13, 14])
|
|
|
|
def test_another_shape_is_refused(self) -> None:
|
|
for spec in (">=3.11", ">=3.11,<=3.14", "~=3.11", ">=3.11, <3.15"):
|
|
with self.subTest(spec=spec), self.assertRaises(ValueError):
|
|
supported_minors(spec)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|