Skip to main content

ConfigSeal

ConfigSeal encrypts and decrypts INI files, so you can store secrets in a config file and read them safely in your Python code.

How ConfigSeal Works

ConfigSeal uses a key to encrypt and decrypt a file. Store the key in a safe place, because ConfigSeal cannot recover a lost key.

CLI Usage

ConfigSeal gives you one command: configseal-edit.

Create a New Encrypted File

Run this command to create a new file:

configseal-edit secrets.ini.enc

The command generates a new key and opens your editor with a template. Edit the template, save the file, and close the editor.

The command then prints the new key. Copy the key now and store it in a safe place, because ConfigSeal does not show the key again.

Edit an Existing Encrypted File

Run the same command on an existing file:

configseal-edit secrets.ini.enc

The command asks for the key. After you enter the key, the command decrypts the file and opens your editor so you can make changes. Save the file and close the editor when you are done.

The command then encrypts the new content and writes it back to the file.

Notes on the CLI

  • The CLI uses the EDITOR environment variable to select your editor, and falls back to vi if the variable is not set.
  • The CLI adds the .enc extension to the file name if the extension is missing.

API Usage

Import functions from the configseal package to read an encrypted file in your code.

from configseal import read_config, read_file

read_config

Use read_config to read an encrypted INI file as a ConfigParser object.

config = read_config("secrets.ini.enc", key="your-key")
value = config["section"]["key"]

read_file

Use read_file to read the raw decrypted text of an encrypted file.

text = read_file("secrets.ini.enc", key="your-key")

Key Resolution

Both functions accept a key in two ways: you can pass the key directly with the key parameter, or you can store the key as a systemd credential and set the creds parameter to the credential name (the default name is configseal-key). When you use a credential, ConfigSeal reads the key from $CREDENTIALS_DIRECTORY/<creds>.

If you do not supply a key and CREDENTIALS_DIRECTORY is not set, ConfigSeal raises an error.

Caching

read_config and read_file cache their results, so ConfigSeal reads a file only once per unique set of arguments during a process run.

Metadata

Release files for configseal 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for configseal 0.1.0
File Size Uploaded Provenance Actions
configseal-0.1.0.tar.gz 4.9 kB Without provenance Details for configseal-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for configseal 0.1.0
File Interpreter ABI Platform Actions
configseal-0.1.0-py3-none-any.whl Python 3 none any Details for configseal-0.1.0-py3-none-any.whl

Total release size: 10.8 kB

Release files / configseal-0.1.0.tar.gz

Download URL configseal-0.1.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8ce29c4064f6b075ffb070559ea0d8983c2c85d02df7dd0589cbe17f9e21878e
BLAKE2b-256 checksum
How to use checksums
79d764a08574e6af44800f859448020def1485b9fd753d74fb457a348843df3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / configseal-0.1.0-py3-none-any.whl

Download URL configseal-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78b73b514677d4f0f1b824d60504ce9133335d99c2009dcb3ccddc2c53e62423
BLAKE2b-256 checksum
How to use checksums
7e92b147ae844def7d7bfe2780be7f55454505406385b5412381fed2093ca233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for configseal 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page