Skip to main content

wrapenvars

Encode and decode base64 strings — a tiny, zero-dependency Python utility for obfuscating configuration values, environment variables, or any string data.

PyPI Python License: MIT

Installation

pip install wrapenvars

Requires Python 3.12.13+ (< 3.14).

Usage

from wrapenvars import get_dict, get_str, set_dict, set_str

# ── Strings ─────────────────────────────────────
encoded = set_str("hello world")
# → "aGVsbG8gd29ybGQ="

decoded = get_str(encoded)
# → "hello world"

# ── Dictionaries ────────────────────────────────
token = set_dict({"api_key": "sk-abc123", "region": "us-east-1"})
# → "eyJhcGlfa2V5IjogInNr..."

config = get_dict(token)
# → {"api_key": "sk-abc123", "region": "us-east-1"}

API

Function Input Output On failure
set_str(stream: str) Plain string Base64-encoded string ""
get_str(stream: str) Base64 string Decoded string ""
set_dict(stream: dict) Dictionary Base64-encoded JSON ""
get_dict(stream: str) Base64 string Decoded dictionary {}

All functions handle invalid input gracefully — they return a safe default instead of raising exceptions.

Development

git clone https://github.com/deivguerrero/wrapenvars.git
cd wrapenvars

# Create venv and install dev dependencies
uv sync

# Run tests
uv run pytest

# Lint + type-check
uv run ruff check --fix
uv run mypy --strict wrapenvars tests

# Format
uv run ruff format

Pre-commit hooks

pre-commit install

Runs ruff (lint + format), mypy, and basic file checks on every commit.

License

MIT — see LICENSE.

Release files for wrapenvars 0.2.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 wrapenvars 0.2.0
File Size Uploaded
wrapenvars-0.2.0.tar.gz 26.9 kB Details

Built distribution (wheel)

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

Total release size: 30.1 kB

Release files / wrapenvars-0.2.0.tar.gz

Download URL wrapenvars-0.2.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dbc5654325fec8e3a8d415d95df52600dee5f4d2e49db449d88f792f7e599933
BLAKE2b-256 checksum
How to use checksums
76fc3fbce29565fed7167f034ac50d6ccd4dfead7350276b7eaecc85930c0f1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wrapenvars-0.2.0-py3-none-any.whl

Download URL wrapenvars-0.2.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a9c276deb50c108e00b46553e3e665bfac0750d1d7ba68a405615c2ea072641
BLAKE2b-256 checksum
How to use checksums
3641380e45f8df3910708638a46e48a31b0fb69331a07e88e51923416700716a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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