{"record":{"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":"error","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/d041d4d0fd48c3f0832084d33be16cf1c4835f85/requirements/sync-direct-runtime-deps.py#L1-L23","documentation":"Raised by requirements/sync-direct-runtime-deps.py when run on Python < 3.11. The script reads pyproject.toml using the stdlib `tomllib` module, which was only added in Python 3.11; on older interpreters there is no tomllib available so the script refuses to run rather than producing partial or wrong output. It is a maintainer-side build script invoked via `make sync-direct-runtime-deps`.","triggerScenarios":"Running `make sync-direct-runtime-deps` (or `python requirements/sync-direct-runtime-deps.py`) with a Python 3.10 or older interpreter active in the venv that drives the build.","commonSituations":"A contributor's pyenv/venv still on 3.10; CI matrix that builds docs/deps with an older Python; running the Makefile target by accident with the system python3 on an older distro.","solutions":["Run the target under Python 3.11+: `python3.11 $(which make) sync-direct-runtime-deps` or activate a 3.11+ venv first.","Install tomli and patch the import only if you cannot upgrade (not recommended for a maintainer script — prefer upgrading).","Confirm the interpreter with `python --version` before invoking make."],"exampleFix":"// before\n$ python --version\nPython 3.10.13\n$ make sync-direct-runtime-deps\nRuntimeError: Use Python 3.11+ ...\n\n// after\n$ python3.12 -m venv .venv && source .venv/bin/activate\n$ make sync-direct-runtime-deps   # ok","handlingStrategy":"validation","validationCode":"import sys\nassert sys.version_info >= (3, 11), 'sync-direct-runtime-deps requires Python 3.11+ (for tomllib)'","typeGuard":"def supports_tomllib() -> bool:\n    import sys\n    return sys.version_info >= (3, 11)","tryCatchPattern":"# raised at script start; switch interpreter rather than catching.\n# Guard invocation:\nimport subprocess, sys\nif sys.version_info < (3, 11):\n    subprocess.check_call(['python3.11', 'requirements/sync-direct-runtime-deps.py'])\nelse:\n    ...","preventionTips":["Run maintainer make targets under the project's minimum supported Python (3.11+ here).","Pin the interpreter in the contributing docs and the dev venv.","Verify `python --version` before invoking the Makefile."],"tags":["build","tooling","python-version","dependencies","maintenance"],"backgroundTag":null,"analyzedSha":"d041d4d0fd48c3f0832084d33be16cf1c4835f85","analyzedAt":"2026-08-11T20:44:15.550Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}