SOPS Python wrapper library
Project description
SOPSy
SOPSy is a simple Python wrapper arround SOPS.
Installation
SOPS binary must be installed and available in your $PATH:
# use your package manager to install it
brew install sops
Install the SOPSy library:
pip install sopsy
# or with whatever your package/project manager is
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)
# you either need a `.sops.yml` configuration file with `creation_rules` set
# or append some arguments to the `Sops.global_args` attribute:
# s.global_args.extend([
# "--age", "age1yt3tfqlfrwdwx0z0ynwplcr6qxcxfaqycuprpmy89nr83ltx74tqdpszlw"
# ])
s.encrypt()
API Reference
Check documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sopsy-1.2.1.tar.gz
(108.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sopsy-1.2.1-py3-none-any.whl
(7.5 kB
view details)
File details
Details for the file sopsy-1.2.1.tar.gz.
File metadata
- Download URL: sopsy-1.2.1.tar.gz
- Upload date:
- Size: 108.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2159a82f6fee10b7e29b688e4a0bdc1a50e96e8da2357ff46f97554aff0990f1
|
|
| MD5 |
52dcb3fcab191487d8bb9e5cababc91c
|
|
| BLAKE2b-256 |
afbd55feeb922c4e83c02a36a81d09beebf4cd1dc8ceac36e0d25a39359a2e32
|
File details
Details for the file sopsy-1.2.1-py3-none-any.whl.
File metadata
- Download URL: sopsy-1.2.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ff3fae9d53eb52acb5b3c15662db2f9521b8e2fb1a199872c37fb330d84d8c4
|
|
| MD5 |
852cb6d9bb0a7d8c8e8f8b0ea300ec6a
|
|
| BLAKE2b-256 |
8bd3fbb22b18176ee0aa41af23ccaeee2ce879158042bf2335dfdcbc14bc5ea6
|