{"id":"1cd2c7c3ba6089cf","repo":"aio-libs/aiohttp","slug":"use-python-3-11-to-run-make-sync-direct-runtime","errorCode":null,"errorMessage":"Use Python 3.11+ to run 'make sync-direct-runtime-deps'","messagePattern":"Use Python 3\\.11\\+ to run 'make sync-direct-runtime-deps'","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"requirements/sync-direct-runtime-deps.py","lineNumber":10,"sourceCode":"#!/usr/bin/env python\n\"\"\"Sync direct runtime dependencies from pyproject.toml to runtime-deps.in.\"\"\"\n\nimport sys\nfrom pathlib import Path\n\nif sys.version_info >= (3, 11):\n    import tomllib\nelse:\n    raise RuntimeError(\"Use Python 3.11+ to run 'make sync-direct-runtime-deps'\")\n\ndata = tomllib.loads(Path(\"pyproject.toml\").read_text())\nreqs = (\n    data[\"project\"][\"dependencies\"]\n    + data[\"project\"][\"optional-dependencies\"][\"speedups\"]\n)\nreqs = sorted(reqs, key=str.casefold)\n\nwith open(Path(\"requirements\", \"runtime-deps.in\"), \"w\") as outfile:\n    header = \"# Extracted from `pyproject.toml` via `make sync-direct-runtime-deps`\\n\\n\"\n    outfile.write(header)\n    outfile.write(\"\\n\".join(reqs) + \"\\n\")\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/c0ef574e29109210e96e652771ae4e7b88615fa4/requirements/sync-direct-runtime-deps.py#L1-L23","documentation":"Raised by the maintainer script requirements/sync-direct-runtime-deps.py when run on Python < 3.11. The script reads pyproject.toml via tomllib, which only entered the stdlib in Python 3.11; on older interpreters tomllib is unavailable, so the script aborts rather than trying a backport.","triggerScenarios":"Running `make sync-direct-runtime-deps` (or the script directly) with a Python interpreter older than 3.11. The version check at requirements/sync-direct-runtime-deps.py:7-10 raises RuntimeError before the tomllib import.","commonSituations":"A contributor's default `python` is 3.9 or 3.10; a virtualenv created with an older interpreter; CI using a Python matrix that includes pre-3.11 versions for this maintainer step; running the sync step in a runtime container pinned below 3.11.","solutions":["Run the script with Python 3.11+: `python3.11 requirements/sync-direct-runtime-deps.py`.","Update the venv to a 3.11+ interpreter (`python3.11 -m venv .venv`).","In CI/Make, invoke via a 3.11+ interpreter explicitly, e.g. `python3.11 -m requirements.sync-direct-runtime-deps`."],"exampleFix":"# before\npython make sync-direct-runtime-deps  # uses python 3.9\n\n# after\npython3.11 $(which make) sync-direct-runtime-deps\n# or ensure `python` resolves to 3.11+ in the active venv","handlingStrategy":"validation","validationCode":"import sys\n\ndef assert_python_311():\n    if sys.version_info < (3, 11):\n        raise RuntimeError(\"Use Python 3.11+ to run 'make sync-direct-runtime-deps'\")","typeGuard":"import sys\n\ndef supports_tomllib() -> bool:\n    return sys.version_info >= (3, 11)","tryCatchPattern":null,"preventionTips":["Run maintainer scripts with Python 3.11+.","Pin CI for the sync step to a 3.11+ interpreter.","Keep a 3.11+ venv available for repo tooling."],"tags":["build","tooling","python-version","maintenance"],"analyzedSha":"c0ef574e29109210e96e652771ae4e7b88615fa4","analyzedAt":"2026-08-04T19:51:05.467Z","schemaVersion":2}