Skip to content

refactor: extract the compose reader into read.py#65

Merged
lesnik512 merged 2 commits into
mainfrom
extract-compose-reader
Jul 15, 2026
Merged

refactor: extract the compose reader into read.py#65
lesnik512 merged 2 commits into
mainfrom
extract-compose-reader

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Extracts the JSON/YAML compose reader out of cli.py into a new compose2pod/read.py deep module with a one-function interface read(text: str, fmt: str) -> Any. The repo's subtlest logic — the YAML-1.2 (Docker) SafeLoader that keeps a bare on a string and reads 1e3 as a float — now has a direct test surface (tests/test_read.py) instead of being reachable only through main(). cli.py returns to argparse glue.

read() raises only UnsupportedComposeError; the JSON path now wraps json.JSONDecodeError as invalid JSON: ... (symmetric with the existing invalid YAML:) — the one intended, observable change. Every parsed document is otherwise identical; the auto fallback (invalid JSON → YAML) is preserved.

The move also retargeted the direct importers a first pass missed — test_cli.py's TestYaml12* classes and tests/conformance/conftest.py called the old cli._load_yaml/_read_compose directly — and promoted the stale _read_compose reference in architecture/supported-subset.md.

Rationale and design: planning/changes/2026-07-15.18-extract-compose-reader.md.

Gates: just test-ci 1273 passed @ 100% coverage (read.py 42/42, cli.py 50/50) · just lint-ci clean · just check-planning OK.

🤖 Generated with Claude Code

@lesnik512 lesnik512 merged commit f854103 into main Jul 15, 2026
8 checks passed
@lesnik512 lesnik512 deleted the extract-compose-reader branch July 15, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant