Skip to main content

SOPS Python wrapper library

Project description

SOPSy

Python Version from PEP 621 TOML PyPI - Version PyPI - Downloads build codecov

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


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)

Uploaded Source

Built Distribution

sopsy-1.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

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

Hashes for sopsy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5b25c831c96a5248de7ebec6180879c8d5cd3894ab8b1ad12409e6180567e82a
MD5 eb3c454eb64d3c86455db5e2816e0463
BLAKE2b-256 14f9d52a5092f9e32bd7749d10174c9c2d408e20da28f407775dee088e0b1a25

See more details on using hashes here.

Provenance

The following attestation bundles were made for sopsy-1.1.0.tar.gz:

Publisher: cd.yml on nikaro/sopsy

Attestations:

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

Hashes for sopsy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13158da272f43c1394f370887a56d822d3fe17cd175421782e8e3285a5107fdf
MD5 f551b2e17432d3098fcb88b6f0a3063c
BLAKE2b-256 f403bb47d54941bb08ecc45e0e311c4089211fe5bfd169f6200d008cdffe7fcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sopsy-1.1.0-py3-none-any.whl:

Publisher: cd.yml on nikaro/sopsy

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page