sopsy


Namesopsy JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummarySOPS Python wrapper library
upload_time2024-11-18 19:36:47
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords sops
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SOPSy

[![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fgithub.com%2Fnikaro%2Fsopsy%2Fraw%2Fmain%2Fpyproject.toml)](https://www.python.org/downloads/)
[![PyPI - Version](https://img.shields.io/pypi/v/sopsy)](https://pypi.org/project/sopsy/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/sopsy)](https://pypi.org/project/sopsy/#files)
[![build](https://github.com/nikaro/sopsy/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/nikaro/sopsy/actions/workflows/ci.yml)
[![codecov](https://codecov.io/github/nikaro/sopsy/graph/badge.svg?token=DEVPQ8M6C4)](https://codecov.io/github/nikaro/sopsy)

SOPSy is a simple Python wrapper arround [SOPS](https://github.com/getsops/sops).

## Installation

SOPS binary must be installed and available in your `$PATH`:

```sh
# use your package manager to install it
brew install sops
```

Install the SOPSy library:

```sh
pip install sopsy

# or with whatever your package/project manager is
uv add sopsy
```

## Quickstart

Retrieve a secret value:

```python
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:

```python
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](http://sopsy.nikaro.net/reference/).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sopsy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "sops",
    "author": null,
    "author_email": "Nicolas Karolak <nicolas@karolak.fr>",
    "download_url": "https://files.pythonhosted.org/packages/14/f9/d52a5092f9e32bd7749d10174c9c2d408e20da28f407775dee088e0b1a25/sopsy-1.1.0.tar.gz",
    "platform": null,
    "description": "# SOPSy\n\n[![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fgithub.com%2Fnikaro%2Fsopsy%2Fraw%2Fmain%2Fpyproject.toml)](https://www.python.org/downloads/)\n[![PyPI - Version](https://img.shields.io/pypi/v/sopsy)](https://pypi.org/project/sopsy/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/sopsy)](https://pypi.org/project/sopsy/#files)\n[![build](https://github.com/nikaro/sopsy/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/nikaro/sopsy/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/github/nikaro/sopsy/graph/badge.svg?token=DEVPQ8M6C4)](https://codecov.io/github/nikaro/sopsy)\n\nSOPSy is a simple Python wrapper arround [SOPS](https://github.com/getsops/sops).\n\n## Installation\n\nSOPS binary must be installed and available in your `$PATH`:\n\n```sh\n# use your package manager to install it\nbrew install sops\n```\n\nInstall the SOPSy library:\n\n```sh\npip install sopsy\n\n# or with whatever your package/project manager is\nuv add sopsy\n```\n\n## Quickstart\n\nRetrieve a secret value:\n\n```python\nfrom sopsy import Sops\n\nsops = Sops(\"secrets.yml\")\n\nmy_secret_key = sops.get(\"my_secret_key\")\nprint(f\"single secret: {my_secret_key}\")\n\nsecrets = sops.decrypt()\nprint(f\"all my secrets: {secrets}\")\n```\n\nEncrypt a file:\n\n```python\nimport json\nfrom pathlib import Path\nfrom sopsy import Sops\n\nplaintext_content = json.dumps({\"hello\": \"world\"})\nPath(\"secrets.json\").write_text(plaintext_content)\n\ns = Sops(\"secrets.json\", in_place=True)\n# you either need a `.sops.yml` configuration file with `creation_rules` set\n# or append some arguments to the `Sops.global_args` attribute:\n# s.global_args.extend([\n#     \"--age\", \"age1yt3tfqlfrwdwx0z0ynwplcr6qxcxfaqycuprpmy89nr83ltx74tqdpszlw\"\n# ])\ns.encrypt()\n```\n\n## API Reference\n\nCheck [documentation](http://sopsy.nikaro.net/reference/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SOPS Python wrapper library",
    "version": "1.1.0",
    "project_urls": {
        "Changelog": "https://sopsy.nikaro.net/changelog/",
        "Homepage": "https://sopsy.nikaro.net",
        "Issues": "https://github.com/nikaro/sopsy/issues",
        "Repository": "https://github.com/nikaro/sopsy"
    },
    "split_keywords": [
        "sops"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f403bb47d54941bb08ecc45e0e311c4089211fe5bfd169f6200d008cdffe7fcc",
                "md5": "f551b2e17432d3098fcb88b6f0a3063c",
                "sha256": "13158da272f43c1394f370887a56d822d3fe17cd175421782e8e3285a5107fdf"
            },
            "downloads": -1,
            "filename": "sopsy-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f551b2e17432d3098fcb88b6f0a3063c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6988,
            "upload_time": "2024-11-18T19:36:46",
            "upload_time_iso_8601": "2024-11-18T19:36:46.089268Z",
            "url": "https://files.pythonhosted.org/packages/f4/03/bb47d54941bb08ecc45e0e311c4089211fe5bfd169f6200d008cdffe7fcc/sopsy-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "14f9d52a5092f9e32bd7749d10174c9c2d408e20da28f407775dee088e0b1a25",
                "md5": "eb3c454eb64d3c86455db5e2816e0463",
                "sha256": "5b25c831c96a5248de7ebec6180879c8d5cd3894ab8b1ad12409e6180567e82a"
            },
            "downloads": -1,
            "filename": "sopsy-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "eb3c454eb64d3c86455db5e2816e0463",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 78194,
            "upload_time": "2024-11-18T19:36:47",
            "upload_time_iso_8601": "2024-11-18T19:36:47.916537Z",
            "url": "https://files.pythonhosted.org/packages/14/f9/d52a5092f9e32bd7749d10174c9c2d408e20da28f407775dee088e0b1a25/sopsy-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 19:36:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nikaro",
    "github_project": "sopsy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sopsy"
}
        
Elapsed time: 1.55129s