Turn any technical book PDF into a Claude Code skill — ready to study, reference, and use while you work.
Python agent-skillsai-agentsbook-to-skillcontext-engineeringdocument-processingedtechknowledge-baseknowledge-managementllmpdf-to-markdownragself-studystudy-tools
chore: untrack stale compiled bytecode (#94)
Theerayut (TJ) Jaiyenfd4f1b2edd30
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9eb4e85..d7b0c91 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,17 @@ All notable changes to **book-to-skill** are documented here.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## [Unreleased]++### Removed+- **Stale tracked bytecode** — `scripts/__pycache__/extract.cpython-313.pyc` was committed+ alongside the EPUB-support change and has been tracked ever since, despite `.gitignore`+ listing both `*.pyc` and `__pycache__/` (ignore rules do not untrack already-committed+ files). The file was inert — its timestamp-based header records a 11,321-byte source while+ `scripts/extract.py` is now 871 bytes, so Python always invalidated it and recompiled — but+ committed bytecode is not reviewable in a diff. A regression test now fails if any `.pyc`+ or `__pycache__/` path is tracked.+## [1.3.0] - 2026-07-30### Addeddiff --git a/scripts/__pycache__/extract.cpython-313.pyc b/scripts/__pycache__/extract.cpython-313.pycdeleted file mode 100644index e889c7c..0000000Binary files a/scripts/__pycache__/extract.cpython-313.pyc and /dev/null differdiff --git a/tests/test_repo_hygiene.py b/tests/test_repo_hygiene.pynew file mode 100644index 0000000..f527381--- /dev/null+++ b/tests/test_repo_hygiene.py@@ -0,0 +1,62 @@+"""Regression test: build artifacts must never be tracked in the repository."""++import subprocess+from pathlib import Path++import pytest+++REPO_ROOT = Path(__file__).resolve().parent.parent+++def _git(*args: str) -> subprocess.CompletedProcess:+ try:+ return subprocess.run(+ ["git", *args],+ cwd=REPO_ROOT,+ capture_output=True,+ timeout=30,+ text=True,+ encoding="utf-8",+ errors="surrogateescape",+ )+ except (OSError, subprocess.SubprocessError) as exc:+ pytest.skip(f"git unavailable: {exc}")+++def _tracked_files() -> list[str]:+ """Every path tracked in this repository.++ Uses -z because `git ls-files` otherwise quotes non-ASCII paths+ (`"caf\\303\\251/stale.pyc"`), which would silently defeat the suffix check+ below and let the test pass while bytecode is tracked.+ """+ toplevel = _git("rev-parse", "--show-toplevel")+ if toplevel.returncode != 0:+ pytest.skip("not a git checkout (e.g. installed sdist)")+ if Path(toplevel.stdout.strip()).resolve() != REPO_ROOT:+ # Vendored inside an unrelated repo: `git ls-files` would answer for that+ # repo, so an empty result would be a vacuous pass rather than a real one.+ pytest.skip("REPO_ROOT is not the root of the enclosing git repository")++ listed = _git("ls-files", "-z")+ if listed.returncode != 0:+ pytest.skip("not a git checkout (e.g. installed sdist)")+ return [path for path in listed.stdout.split("\0") if path]+++def test_no_compiled_bytecode_is_tracked():+ """`.gitignore` lists *.pyc and __pycache__/, but ignore rules do not untrack+ files already committed. A stale .pyc shipped in the repo is build noise at+ best and a supply-chain smell at worst, since bytecode is not reviewable in a+ diff."""+ offenders = [+ path+ for path in _tracked_files()+ if path.endswith(".pyc") or "__pycache__/" in path+ ]+ assert offenders == [], (+ "compiled bytecode is tracked in git: "+ + ", ".join(offenders)+ + " — remove with `git rm --cached <path>`"+ )