Skip to content

Instantly share code, notes, and snippets.

View andrew222651's full-sized avatar

Andrew andrew222651

View GitHub Profile
@andrew222651
andrew222651 / submodule_only_changes.py
Last active June 17, 2026 14:43
Check if branch only updates submodules to commits from protected GitHub branches
#!/usr/bin/env python3
# /// script
# dependencies = [
# "pygit2==1.19.3",
# "typer==0.16.0",
# "PyGithub==2.6.1",
# ]
# ///
@andrew222651
andrew222651 / check_submodule_versions.py
Created March 4, 2026 08:55
Check consistency across Python packages found in git submodules
import subprocess
import tomllib
from pathlib import Path
def get_submodule_commit_hash(path: Path) -> str:
result = subprocess.run(
["git", "rev-parse", "HEAD"],
cwd=str(path),
stdout=subprocess.PIPE,
r"""
requires:
pydantic==1.*
numpy==1.*
scipy==1.*
"""
from abc import ABC, abstractmethod
import math