Python
public
Python Package Inventory
Share this script safely, inspect its metadata, and copy the exact command you need.
Ready to run
One-liner
curl -fsSL https://runny.sh/r/X8C4DS14R4KY | python3
Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.684
At a glance
Script metadata
Readable before runnable
Preview
#!/usr/bin/env python3
# Python installed package inventory
# Read-only: importlib.metadata lists local distributions and a count. Does not download.
# Exit 0 if packages can be listed, 1 if the environment is empty, 2 on metadata errors.
# Hosted on Runny.sh. Review the script page before you run it.
from __future__ import annotations
import sys
from importlib import metadata
def main() -> int:
print("=== Installed Python packages (local only) ===")
print(f"Runtime: {sys.implementation.name} {sys.version.split()[0]}")
print("Note: no PyPI query and no downloads")
print()
try:
dists = list(metadata.distributions())
except Exception as exc:
print(f"importlib.metadata failed: {exc}")
print("Result: CRITICAL")
return 2
rows = []
for dist in dists:
name = dist.metadata.get("Name") or dist.metadata.get("name") or "unknown"
version = dist.version or "?"
rows.append((name.lower(), name, version))
rows.sort()
print(f"Count: {len(rows)}")
for index, (_key, name, version) in enumerate(rows):
if index >= 25:
print(f" ... {len(rows) - 25} more")
break
print(f" {name}=={version}")
print()
if not rows:
print(" WARNING: no distributions visible in this environment")
print("Result: WARNING")
return 1
print(" OK")
print("Result: HEALTHY")
return 0
if __name__ == "__main__":
sys.exit(main())
Raw endpointhttps://runny.sh/r/X8C4DS14R4KY
See something unsafe?
Report this script
Tell us why it should come down. Anyone can also report a URL at /abuse.