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.1.0.tar.gz
(78.2 kB
view details)
Built Distribution
sopsy-1.1.0-py3-none-any.whl
(7.0 kB
view details)
File details
Details for the file sopsy-1.1.0.tar.gz
.
File metadata
- Download URL: sopsy-1.1.0.tar.gz
- Upload date:
- Size: 78.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b25c831c96a5248de7ebec6180879c8d5cd3894ab8b1ad12409e6180567e82a |
|
MD5 | eb3c454eb64d3c86455db5e2816e0463 |
|
BLAKE2b-256 | 14f9d52a5092f9e32bd7749d10174c9c2d408e20da28f407775dee088e0b1a25 |
Provenance
The following attestation bundles were made for sopsy-1.1.0.tar.gz
:
Publisher:
cd.yml
on nikaro/sopsy
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
sopsy-1.1.0.tar.gz
- Subject digest:
5b25c831c96a5248de7ebec6180879c8d5cd3894ab8b1ad12409e6180567e82a
- Sigstore transparency entry: 149591144
- Sigstore integration time:
- Predicate type:
File details
Details for the file sopsy-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: sopsy-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13158da272f43c1394f370887a56d822d3fe17cd175421782e8e3285a5107fdf |
|
MD5 | f551b2e17432d3098fcb88b6f0a3063c |
|
BLAKE2b-256 | f403bb47d54941bb08ecc45e0e311c4089211fe5bfd169f6200d008cdffe7fcc |
Provenance
The following attestation bundles were made for sopsy-1.1.0-py3-none-any.whl
:
Publisher:
cd.yml
on nikaro/sopsy
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
sopsy-1.1.0-py3-none-any.whl
- Subject digest:
13158da272f43c1394f370887a56d822d3fe17cd175421782e8e3285a5107fdf
- Sigstore transparency entry: 149591145
- Sigstore integration time:
- Predicate type: