SOPSy
SOPSy is a simple Python wrapper arround SOPS.
Installation
SOPS binary must be installed and available in your $PATH
:
brew install sops
Install the SOPSy library:
pip install sopsy
uv add sopsy
Quickstart
Retrieve a secret value:
from sopsy import Sops
sops = Sops("secrets.yml")
my_secret_key = sops.get("my_secret_key")
print(f"single secret: {my_secret_key}")
secrets = sops.decrypt()
print(f"all my secrets: {secrets}")
Encrypt a file:
import json
from pathlib import Path
from sopsy import Sops
plaintext_content = json.dumps({"hello": "world"})
Path("secrets.json").write_text(plaintext_content)
s = Sops("secrets.json", in_place=True)
s.encrypt()
API Reference
Check documentation.