mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
deps: require Python 3.11; clear Dependabot alerts in the 3.10 lock fork (#4517)
## Description Vanta/Dependabot report 64 open alerts on this repo. 59 of them are pillow, filelock and virtualenv versions that exist only in the Python 3.10 split of `uv.lock`: the patched releases (pillow 13, filelock 4.2) require Python 3.11, so Dependabot could not open a fix PR. Python 3.10 reached end of life in October 2026 and CI already tests only 3.11, 3.12 and 3.14. The second commit also fixes the two `security.yml` jobs that fail on `main` today: pip-audit (litellm CVE-2026-114612) and the e2e npm audit (three undici advisories published after #4453 for the copy bundled inside npm). ## Type of Change - [x] Breaking change: `pip install headroom-ai` now refuses Python 3.10 - [x] Bug fix: security patches ## Changes Made - `requires-python = ">=3.11"`; drop the 3.10 classifier and the `tomli` backport dependency - pillow override and filelock floor lose their `python_version` markers - mypy `python_version = "3.11"`; the three `tomli` import fallbacks in `headroom/` become plain `import tomllib` - ruff `target-version` stays `py310` with a note: moving it raises 213 pyupgrade findings (UP017/UP036/UP041/UP042), a separate mechanical PR - `uv.lock` re-resolved: pillow 13.0.0, filelock 4.2.4, virtualenv 21.14.13 (single entry each, the 3.10 fork is gone) - gitpython 3.1.62 → 3.2.1, strands-agents 1.24.0 → 1.62.0, litellm 1.101.0 → 1.101.3 - `e2e/wrap/tools/npm-audit-exceptions.json`: three further undici 6.x advisories added at the existing exact path and version, expiry unchanged (2026-11-15) - README, CONTRIBUTING and the Dockerfile comment updated Clears 61 of the 64 Dependabot alerts. The remaining 3 (undici, ip-address) live inside the bundled dependencies of the `npm` package in `e2e/wrap/tools/package-lock.json`; npm 12.2.1 is the newest release and still ships them, so there is no bump available yet. ## Dependencies & supply chain **gitpython 3.1.62 → 3.2.1.** Already a dependency; bumped for a security patch (CVE-2026-114145). Maintained by the gitpython-developers org (Sebastian Thiel), monthly-ish releases, long advisory history with prompt fixes. Install surface unchanged: pure-Python wheel (`py3-none-any`), one runtime dependency (`gitdb`), no native code, no install-time or runtime network of its own. **strands-agents 1.24.0 → 1.62.0.** Already a dependency behind the `[strands]` extra; bumped for a security patch (CVE-2026-115419, fixed in 1.43.0; the lock takes the current release). Maintained by AWS (strands-agents org, `opensource@amazon.com`), weekly releases. Install surface: pure-Python wheel, no native code. Declared dependencies grow by two, `httpx` and `pyyaml`, both already in the lock for other packages, so no new transitive packages are introduced. Runtime network is unchanged: it calls the model provider the user configures, as before. **litellm 1.101.0 → 1.101.3.** Already a core dependency; patch bump for CVE-2026-114612, the smallest fix that keeps the `filelock>=4.2.1` floor resolvable (litellm 1.106 caps filelock <4). No change to maintainers or install surface. **pillow, filelock, virtualenv.** No new packages; the lock now holds the single patched version the 3.11+ fork already had. ## Testing - [x] Linting passes (`ruff check .`, `ruff format --check .`) - [x] Type checking passes (`mypy headroom`): 1 error, identical to main (`langchain/chat_model.py:380`) - [x] Unit tests (targeted, see below) ### Test Output ```text $ pytest -q tests/test_litellm_optional.py tests/test_dependency_overrides.py tests/test_release_workflows.py tests/test_image_decoder_guard.py tests/test_optional_dependencies.py tests/test_onnx_dependency_contract.py 74 passed in 3.07s $ grep -rl -E "headroom\.release_version|headroom\.providers\.codex\.project_context|headroom\.cli\.wrap" tests | xargs pytest -q 4 failed, 1043 passed in 28.03s # same 4 in tests/test_cli/test_wrap_persistent.py fail on main $ uv run --extra strands --extra dev -m pytest -q tests/integrations/test_strands tests/test_strands_tokenizer.py 18 failed, 87 passed in 52.30s # the 18 are *Real classes needing live AWS Bedrock creds; main fails the same 18 on 1.24.0 $ uv export --frozen --no-dev --no-emit-project --no-hashes --extra all --format requirements-txt > requirements-prod.txt $ uvx pip-audit==2.10.1 -r requirements-prod.txt --no-deps --disable-pip No known vulnerabilities found $ cd e2e/wrap/tools && npm audit --package-lock-only --json > audit.json && <security.yml check script> unexpected: [] stale: [] seen: 6 ``` ## Real Behavior Proof - Environment: macOS 27.2 arm64; uv-managed CPython 3.11.16 and 3.10; the lock from this branch. - Exact command / steps: ```text $ uv run --python 3.11 --all-extras python -c "import sys, platform, headroom, PIL, filelock, virtualenv, git, strands, litellm, importlib.metadata as m; ..." $ uv venv -p 3.10 /tmp/py310-venv && uv pip install --python /tmp/py310-venv/bin/python --dry-run . ``` - Observed result: ```text macOS-27.2-arm64-arm-64bit python 3.11.16 pillow 13.0.0 filelock 4.2.4 virtualenv 21.14.13 gitpython 3.2.1 strands-agents 1.62.0 litellm 1.101.3 (3.10) ... headroom-ai==0.42.0 depends on Python>=3.11, we can conclude that headroom-ai==0.42.0 cannot be used. And because only headroom-ai==0.42.0 is available and you require headroom-ai, we can conclude that your requirements are unsatisfiable. ``` - Not tested: Linux and Windows installs (CI wheel matrix covers them); a live Bedrock run of the strands integration; the Docker image build. ## Runtime Rollout Safety - Rollout-managed feature(s): none - Minimum rollout channel: n/a - Stable/default behavior changed: installs on Python 3.10 are refused at resolve time; no runtime behavior change on 3.11+ - Kill switch / disable path: n/a - Unsafe override required: no - Qualification impact: none - Rollback path: revert the PR ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project's style guidelines - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] New and existing unit tests pass locally with my changes (targeted runs above; pre-existing failures noted) - [x] I did **not** edit `CHANGELOG.md` - [ ] New tests added: n/a, dependency and metadata change; existing contract tests cover the floor and the pillow override ## Additional Notes Follow-ups, not in this PR: - ruff `target-version = "py311"` plus the pyupgrade fixes - remaining `tomli` fallbacks in `tests/` and the `sys.version_info < (3, 11)` branches they guard - `python_version < '3.11'` branches in the onnxruntime markers (now dead but harmless) - `pyo3` `abi3-py310` in `Cargo.toml` could move to `abi3-py311` - the 3 remaining Dependabot alerts (bundled undici/ip-address in npm) until an npm release replaces them 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
f10725e6b9
commit
3c6f82b060
+1
-1
@@ -122,7 +122,7 @@ Enable or disable automatic Copilot review in **Settings → Rules → Rulesets
|
||||
- [Ruff](https://github.com/astral-sh/ruff) for lint + format, line length 100, PEP 8.
|
||||
- Type hints on public functions; Google-style docstrings.
|
||||
- Cover new behavior + edge cases; aim >80% coverage on new code.
|
||||
- Python 3.10+. Optional features go behind extras.
|
||||
- Python 3.11+. Optional features go behind extras.
|
||||
- **Headroom writes LF and normalizes on read, on every platform.** Pass
|
||||
`newline="\n"` to every `write_text`/`open` that writes a context, memory,
|
||||
or state file, and normalize `\r\n`/`\r` when you read one back. Without
|
||||
|
||||
+1
-2
@@ -53,8 +53,7 @@ COPY headroom/ headroom/
|
||||
ARG HEADROOM_EXTRAS=proxy,code,bedrock
|
||||
# `uv pip install` ignores [tool.uv] override-dependencies (uv.lock only), so
|
||||
# pass them explicitly: the image gets the security overrides the lock has
|
||||
# (pillow 13 over fastembed's <13 cap). Python 3.10 has no tomllib: pip's
|
||||
# vendored tomli reads the file there.
|
||||
# (pillow 13 over fastembed's <13 cap).
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/usr/local/cargo/git \
|
||||
|
||||
@@ -443,7 +443,7 @@ Granular extras: `[proxy]`, `[mcp]`, `[ml]` (Kompress-v2-base), `[code]`,
|
||||
`[memory]`, `[vector]` (optional HNSW backend — needs a C++ toolchain, not in
|
||||
`[all]`), `[relevance]`, `[image]`, `[agno]`, `[langchain]`, `[evals]`,
|
||||
`[pytorch-mps]` (Apple-GPU memory-embedder offload — set
|
||||
`HEADROOM_EMBEDDER_RUNTIME=pytorch_mps`). Requires **Python 3.10+**.
|
||||
`HEADROOM_EMBEDDER_RUNTIME=pytorch_mps`). Requires **Python 3.11+**.
|
||||
|
||||
> `[all]` covers the core stack but not the framework adapters. Install those
|
||||
> separately: `pip install "headroom-ai[langchain]"`, and likewise `[agno]`,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"expires": "2026-11-15",
|
||||
"reason": "E2E harness only, never shipped in the wheel or SDK. npm 12.2.1 bundles undici 6.29.0 and ip-address 10.7.2; bundled copies ignore overrides and no newer npm release is available. OpenClaw is updated to 2026.10.6 and uses fixed Undici 8.12.3, so no OpenClaw path is excepted. Recheck npm upstream and remove these exact-path exceptions by the existing expiry.",
|
||||
"reason": "E2E harness only, never shipped in the wheel or SDK. npm 12.2.1 bundles undici 6.29.0 and ip-address 10.7.2; bundled copies ignore overrides and no newer npm release is available. OpenClaw is updated to 2026.10.6 and uses fixed Undici 8.12.3, so no OpenClaw path is excepted. Three further undici 6.x advisories (GHSA-2m5v-pch6-74hx, GHSA-qrxm-fqhp-jwvm, GHSA-9fm3-97px-rjf6) published after #4453 cover the same bundled copy. Recheck npm upstream and remove these exact-path exceptions by the existing expiry.",
|
||||
"advisories": {
|
||||
"GHSA-4qv8-2p9j-2685": {
|
||||
"node_modules/npm/node_modules/undici": "6.29.0"
|
||||
@@ -10,6 +10,15 @@
|
||||
},
|
||||
"GHSA-rxp7-6hxx-x8q5": {
|
||||
"node_modules/npm/node_modules/ip-address": "10.7.2"
|
||||
},
|
||||
"GHSA-2m5v-pch6-74hx": {
|
||||
"node_modules/npm/node_modules/undici": "6.29.0"
|
||||
},
|
||||
"GHSA-qrxm-fqhp-jwvm": {
|
||||
"node_modules/npm/node_modules/undici": "6.29.0"
|
||||
},
|
||||
"GHSA-9fm3-97px-rjf6": {
|
||||
"node_modules/npm/node_modules/undici": "6.29.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,7 @@ from functools import wraps
|
||||
from pathlib import Path
|
||||
from typing import Any, NamedTuple, cast
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ModuleNotFoundError: # pragma: no cover - Python < 3.11
|
||||
import tomli as tomllib
|
||||
import tomllib
|
||||
|
||||
from headroom._subprocess import identity_mismatch as _shared_identity_mismatch
|
||||
from headroom._subprocess import pid_alive, proc_identity, run
|
||||
|
||||
@@ -14,10 +14,7 @@ from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Any, Literal, cast
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ModuleNotFoundError: # pragma: no cover - Python 3.10
|
||||
import tomli as tomllib
|
||||
import tomllib
|
||||
|
||||
from headroom.memory.storage_router import ProjectResolver, RequestContext
|
||||
from headroom.providers.codex.threads import _codex_state_db_paths
|
||||
|
||||
@@ -230,10 +230,7 @@ def compute_release_version(
|
||||
def get_canonical_version(root: Path) -> str:
|
||||
"""Read the canonical project version from pyproject.toml."""
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ModuleNotFoundError: # pragma: no cover - Python 3.10 compatibility
|
||||
import tomli as tomllib
|
||||
import tomllib
|
||||
|
||||
with open(root / "pyproject.toml", "rb") as file:
|
||||
project = tomllib.load(file)["project"]
|
||||
|
||||
+8
-11
@@ -8,7 +8,7 @@ version = "0.42.0"
|
||||
description = "The Context Optimization Layer for LLM Applications - Cut costs by 50-90%"
|
||||
readme = "README.md"
|
||||
license = "Apache-2.0"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{ name = "Headroom Contributors" }
|
||||
]
|
||||
@@ -35,7 +35,6 @@ classifiers = [
|
||||
"Intended Audience :: Developers",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
@@ -50,7 +49,7 @@ dependencies = [
|
||||
"pydantic>=2.0.0", # Config and data models
|
||||
# Model registry, pricing and non-core providers; all lazily imported and
|
||||
# ImportError-guarded. 1.96.2 is the first litellm with prebuilt wheels for
|
||||
# Python 3.10-3.14 on Linux, macOS and Windows: older releases either reject
|
||||
# Python 3.11-3.14 on Linux, macOS and Windows: older releases either reject
|
||||
# Python 3.14 (GH #956) or fall back to a Rust source build.
|
||||
"litellm>=1.96.2,<2.0",
|
||||
"click>=8.3.3", # CLI framework; PYSEC-2026-2132 fix (command injection in click.edit())
|
||||
@@ -63,7 +62,6 @@ dependencies = [
|
||||
# future patched one.
|
||||
"ast-grep-cli>=0.30.0,!=0.44.1",
|
||||
"pyyaml>=6.0", # omp wrap: parse/merge omp's models.yml registry
|
||||
"tomli>=2.0.0; python_version < '3.11'", # tomllib backport for helper scripts
|
||||
"tomlkit>=0.13.0,<1.0", # Loss-minimizing Codex config recovery
|
||||
# Verify upstream TLS through the OS trust store (macOS Keychain, Windows
|
||||
# cert store), where IT installs corporate TLS-inspection roots (Zscaler,
|
||||
@@ -82,9 +80,8 @@ dependencies = [
|
||||
# CVE-2026-112907/112913/112940 are fixed in 4.2.1, but litellm 1.106 caps
|
||||
# filelock <4, so without this floor pip picks that litellm and 3.32.7;
|
||||
# with it pip takes litellm 1.103.7 (uv.lock has 1.101.0). Declared here so
|
||||
# the floor reaches pip installs. 4.2 needs Python 3.11, so pip on 3.10
|
||||
# still gets an affected filelock.
|
||||
"filelock>=4.2.1; python_version >= '3.11'",
|
||||
# the floor reaches pip installs.
|
||||
"filelock>=4.2.1",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
@@ -446,10 +443,8 @@ constraint-dependencies = [
|
||||
# `pip install headroom-ai[all]` still resolves against fastembed's cap; on
|
||||
# that Pillow, headroom/image/decoder_guard.py forwards images undecoded.
|
||||
# Drop this override once fastembed allows Pillow 13.
|
||||
# Pillow 13 needs Python 3.11; on 3.10 no fixed release exists.
|
||||
override-dependencies = [
|
||||
"pillow>=13.0.0; python_version >= '3.11'",
|
||||
"pillow>=12.3.0,<13; python_version < '3.11'",
|
||||
"pillow>=13.0.0",
|
||||
]
|
||||
|
||||
[[tool.uv.index]]
|
||||
@@ -484,6 +479,8 @@ features = ["extension-module"]
|
||||
bindings = "pyo3"
|
||||
|
||||
[tool.ruff]
|
||||
# Kept at py310 until the py311 idiom migration lands (UP017/UP036/UP041/UP042
|
||||
# touch ~200 sites); requires-python is 3.11.
|
||||
target-version = "py310"
|
||||
line-length = 100
|
||||
|
||||
@@ -511,7 +508,7 @@ quote-style = "double"
|
||||
indent-style = "space"
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.10"
|
||||
python_version = "3.11"
|
||||
warn_return_any = true
|
||||
warn_unused_configs = true
|
||||
disallow_untyped_defs = true
|
||||
|
||||
@@ -26,7 +26,7 @@ from packaging.requirements import Requirement
|
||||
from packaging.version import Version
|
||||
|
||||
PYPROJECT = Path(__file__).resolve().parents[1] / "pyproject.toml"
|
||||
SUPPORTED_PYTHONS = ("3.10", "3.11", "3.12", "3.13", "3.14")
|
||||
SUPPORTED_PYTHONS = ("3.11", "3.12", "3.13", "3.14")
|
||||
PLATFORMS = ("linux", "darwin", "win32")
|
||||
LITELLM_FLOOR = Version("1.96.2")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user