Skip to content

Commit 22cd352

Browse files
committed
Avoid stale lint failures from config helper imports
Move PyYAML loading into the helpers that read and write agent-context configuration, and replace the broad Any annotation with object. The runtime behavior stays the same while the module no longer exposes top-level imports that can be flagged as unused when CI analyzes a narrower code shape. Constraint: CI is failing on F401 for top-level yaml and typing.Any imports in src/specify_cli/__init__.py Rejected: Delete PyYAML usage entirely | agent-context config still needs YAML read/write support Confidence: high Scope-risk: narrow Tested: uvx ruff check src/ Tested: .venv/bin/python -m pytest tests/integrations/test_integration_codex.py tests/integrations/test_integration_base_markdown.py -q Assisted-by: OpenAI Codex (model: GPT-5, autonomous)
1 parent 1021698 commit 22cd352

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
import os
3030
import sys
3131
import json
32-
import yaml
3332
from pathlib import Path
3433

35-
from typing import Any
36-
3734
import typer
3835
from rich.panel import Panel
3936
from rich.align import Align
@@ -269,11 +266,13 @@ def ensure_executable_scripts(project_path: Path, tracker: StepTracker | None =
269266
)
270267

271268

272-
def _load_agent_context_config(project_root: Path) -> dict[str, Any]:
269+
def _load_agent_context_config(project_root: Path) -> dict[str, object]:
273270
"""Load the agent-context extension config, returning defaults on failure."""
271+
import yaml
272+
274273
from .integrations.base import IntegrationBase
275274

276-
defaults: dict[str, Any] = {
275+
defaults: dict[str, object] = {
277276
"context_file": "",
278277
"context_files": [],
279278
"context_markers": {
@@ -294,9 +293,11 @@ def _load_agent_context_config(project_root: Path) -> dict[str, Any]:
294293

295294

296295
def _save_agent_context_config(
297-
project_root: Path, config: dict[str, Any]
296+
project_root: Path, config: dict[str, object]
298297
) -> None:
299298
"""Persist *config* to the agent-context extension config file."""
299+
import yaml
300+
300301
path = project_root / _AGENT_CTX_EXT_CONFIG
301302
path.parent.mkdir(parents=True, exist_ok=True)
302303
path.write_text(yaml.safe_dump(config, default_flow_style=False, sort_keys=False), encoding="utf-8")

0 commit comments

Comments
 (0)