"""Print pip constraints (name==version) for every package in a uv.lock. Used at image build time to install the ghidra-mcp wheel with the exact dependency versions its upstream lock file was tested with. A package that uv resolved differently per Python version appears more than once; those entries carry their resolution markers, so pip applies only the one that matches the interpreter. """ import sys import tomllib with open(sys.argv[1], "rb") as f: lock = tomllib.load(f) for package in lock["package"]: # The project itself is installed from the release wheel. if package["name"] == "ghidra-mcp": continue line = f'{package["name"]}=={package["version"]}' markers = package.get("resolution-markers") if markers: line += " ; " + " or ".join(f"({m})" for m in markers) print(line)