Skip to content

Commit d950bb5

Browse files
benvinegarclaude
andauthored
chore: require Python 3.11+ and use stdlib tomllib (#8)
Python 3.9 is past end of life and uv installs interpreters automatically, so raise the floor to 3.11 and delete the hand-rolled fallback TOML parser in youtube_publish.py in favor of tomllib, which also handles subtables, multiline strings, and quoted edge cases the fallback could not. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f70bf89 commit d950bb5

5 files changed

Lines changed: 114 additions & 1766 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ All notable user-visible changes to this project are documented in this file.
1313

1414
- Discover skills dynamically in the startup header and show analyzed episodes from `dist/analysis/`, so returning users can see what already exists.
1515
- Remove the unused `[outputs]`, `[transcription]`, and `[video_scan]` sections from `podguy.example.toml`; document which sections are read by code vs. by the agent.
16+
- Require Python 3.11+ (managed automatically by uv) and parse `podguy.toml` with the standard-library TOML parser.
1617

1718
### Fixed
1819

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "podguy"
33
version = "0.1.0"
44
description = "Small tooling repo for repeatable podcast and video-podcast post-production tasks."
5-
requires-python = ">=3.9"
5+
requires-python = ">=3.11"
66
dependencies = []
77

88
[dependency-groups]

scripts/youtube_publish.py

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import os
5454
import re
5555
import sys
56+
import tomllib
5657
from pathlib import Path
5758
from typing import Any, Optional
5859

@@ -87,60 +88,12 @@ def fail(message: str) -> "NoReturn": # noqa: F821 - py39 compat, comment only
8788
# ---------------------------------------------------------------------------
8889

8990

90-
def strip_toml_comment(line: str) -> str:
91-
"""Drop a trailing # comment, ignoring # characters inside quoted strings."""
92-
in_quote = ""
93-
for index, char in enumerate(line):
94-
if in_quote:
95-
if char == in_quote:
96-
in_quote = ""
97-
elif char in "\"'":
98-
in_quote = char
99-
elif char == "#":
100-
return line[:index]
101-
return line
102-
103-
10491
def parse_toml_youtube_section(text: str) -> dict[str, Any]:
105-
"""Read the [youtube] table from podguy.toml.
106-
107-
Uses tomllib when available (Python 3.11+) and falls back to a minimal
108-
flat-key parser for older interpreters. Only simple keys are supported;
109-
the fallback does not handle [youtube.*] subtables, multiline strings,
110-
or array items containing quote characters.
111-
"""
92+
"""Read the [youtube] table from podguy.toml."""
11293
try:
113-
import tomllib
114-
11594
return dict(tomllib.loads(text).get("youtube", {}))
116-
except ModuleNotFoundError:
117-
pass
118-
119-
section: dict[str, Any] = {}
120-
in_youtube = False
121-
for raw_line in text.splitlines():
122-
line = strip_toml_comment(raw_line).strip()
123-
if not line:
124-
continue
125-
if line.startswith("["):
126-
in_youtube = line == "[youtube]"
127-
continue
128-
if not in_youtube or "=" not in line:
129-
continue
130-
key, value = (part.strip() for part in line.split("=", 1))
131-
if value in ("true", "false"):
132-
section[key] = value == "true"
133-
elif value.startswith("[") and value.endswith("]"):
134-
items = re.findall(r"[\"']([^\"']*)[\"']", value)
135-
section[key] = items
136-
elif len(value) >= 2 and value[0] in "\"'" and value[-1] == value[0]:
137-
section[key] = value[1:-1]
138-
else:
139-
try:
140-
section[key] = int(value)
141-
except ValueError:
142-
section[key] = value
143-
return section
95+
except tomllib.TOMLDecodeError as error:
96+
fail(f"error: could not parse profile TOML: {error}")
14497

14598

14699
def load_profile_defaults(profile_path: Optional[str]) -> dict[str, Any]:

src/podguy-post-production/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: podguy-post-production
33
description: Use for generic podcast and video-podcast post-production. Run the repo's transcript and optional visual scanner tools on episode media, prepare transcript artifacts, propose YouTube/podcast chapters, and give editorial feedback such as cuts, clips, show notes, quotes, highlights, and proper noun cleanup.
4-
compatibility: Launch pi from the repository root. The visual scanner requires macOS and Swift. The transcript CLI requires Python 3.9+, uv, and an installed transcription backend.
4+
compatibility: Launch pi from the repository root. The visual scanner requires macOS and Swift. The transcript CLI requires Python 3.11+, uv, and an installed transcription backend.
55
---
66

77
# podguy Post Production

0 commit comments

Comments
 (0)