Skip to content

Instantly share code, notes, and snippets.

@ryan-williams
Created October 26, 2025 16:12
Show Gist options
  • Save ryan-williams/b69ffd1f2d2153fc5f61afb01a0cb4aa to your computer and use it in GitHub Desktop.
Save ryan-williams/b69ffd1f2d2153fc5f61afb01a0cb4aa to your computer and use it in GitHub Desktop.
runsascoded/stdlb#2 (pr) - 2-way sync via github-pr.py (ryan-williams/git-helpers)

runsascoded/stdlb#2 Snapshot testing, collision fixes, and src/ layout

Summary

This PR adds comprehensive snapshot testing to prevent regressions, fixes name collision issues discovered when comparing to v0.0.4, and reorganizes the codebase with a src/ layout.

Key Changes

  • Snapshot testing (scripts/snapshot_exports.py, tests/test_exports_snapshot.py)

    • Tracks all 2127 exported symbols with their FQNs
    • Prevents regressions like the missing os.path members in v0.1.0
    • Simple {"name": "fqn"} format for easy diffing
  • Version comparison tool (scripts/compare_versions.py)

    • Compare exports between any two git refs
    • Identified 20 FQN changes from v0.0.4 → HEAD
    • Usage: python scripts/compare_versions.py v0.0.4 HEAD
  • Collision resolution fixes

    • Path: pathlib.Path (not zipfile.Path) ✅
    • error: re.error (not zlib.error) ✅
    • compress: itertools.compress (not zlib.compress) ✅
    • repeat: itertools.repeat (not timeit.repeat) ✅
  • Restore missing submodule imports

    • Fixed regression: os.path members (basename, dirname, etc.)
    • Fixed regression: urllib.parse members (urlparse, urlencode, etc.)
  • Src/ layout

    • Moved stdlb/src/stdlb/
    • Modern Python package structure
  • Documentation

    • Comprehensive helper script documentation
    • Updated stats: 2127 symbols, 79+ modules, ~57ms import time
    • Examples for all collision resolution preferences

Testing

All tests pass:

pytest tests/ -q
# 12 passed, 1 skipped

Comparison with v0.0.4:

  • ✨ Added 1287 symbols (841 → 2128)
  • ❌ Removed 0 symbols (fully backward compatible)
  • 🔄 Fixed 4 critical collisions, 16 remain (mostly acceptable)

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment